Skip to content

implement: fleet OpenCode scheduled-task pattern — systemd timers + opencode run with per-job route #2232

Open

Description

@dezren39

Implement: fleet OpenCode scheduled-task pattern (systemd timers + opencode run, per-job route)

Follow-on from the #2019 investigation (LIST 4a, fleet program #2055). The investigation's verdict: OpenCode has no native scheduler (upstream anomalyco/opencode#41906 still open); the proven pattern is an OS timer firing opencode run --model opencode-route/<tier> — verified live 2026-10-29 with a one-shot systemd user timer on the laptop (fired on schedule, route resolved to opencode-go DeepSeek V4.1 Flash, exit 0, zero Muse tokens in trigger or execution).

Scope

  1. A small, committable job registry for fleet scheduled OpenCode tasks: one unit (or unit pair) per job under a managed directory, each naming cadence, workdir, prompt/command, and route (opencode-route/workhorse|specialist|summit|speed).
  2. Per-job run logs in a fixed location, readable by the babysitter/monitor (directory-scoped server-API reads are the reliable session surface; opencode session list is not).
  3. Migrate ONE real low-risk fleet job as the proof (a quota probe or census refresh — fire-and-forget, failure visible next round), and record the before/after Muse-token cost of its trigger.
  4. Considered and deferred (do not silently switch): adopting the v1 different-ai/opencode-scheduler plugin (needs a v2 port — the fleet fork cannot run v1 plugins) and waiting for upstream #41906.

Out of scope

Acceptance


Program: Drew's 2026-10-28 directive, fleet LIST 4a follow-on. Filed by queue worker task 3338, 2026-10-29.

Activity

  1. developing-today commented on Oct 29, 2026

    @developing-today
    Contributor
  2. added
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 3, 2026
  3. developing-today commented on Nov 3, 2026

    @developing-today
    Contributor

    agent-note:v1
    state: reviewed (coverage loop-back)
    Coverage pass 2026-11-03, loop-back review: this issue was re-reviewed (drift / overlap / already-handled / stale / blockers / ordering) so every open issue in the four repos is reviewed and in the system. Verdict: still live; in the system as task 7314 (triage, queued, priority 50) in repo-health-code-pilot. Labels audited and synced. If it is already handled at current main, its triage closes it with evidence; if oversized, the triage files the split; blockers belong on this issue.
    Found via: coverage loop-back 2026-11-03

  4. added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed on Nov 4, 2026
  5. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  6. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  7. 84 remaining items

  8. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up — task 9170 (lane oc-code-02)

  9. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    queue/claimedQueue worker lifecycle state
    on Nov 22, 2026
  10. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked — task 9170 (lane oc-code-02)

    • Verified: timer enabled; 19:00 CST scheduled run failed with exit 127; the unit PATH now includes /etc/profiles/per-user/user/bin, and manual invocation at 19:04 CST succeeded. Next hourly firing expected around 20:00 CST.
    • Parked to release the claim while waiting for the real scheduled event. Resume after 20:10 CST and inspect the unit journal and job logs. Existing draft PR docs: record enabled OpenCode quota summary timer #12267 remains canonical; no changes made in this claim. No cadence success is claimed yet.
    • Bookkeeping outside the repo is deferred to fleet reconciliation.
  11. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    Task 9170 progress (2026-11-21): The enabled opencode-quota-freshness-summary.timer completed its first scheduled hourly run after the PATH correction. It started at 20:00:58 CST and finished at 20:01:17 CST; systemd reports success/exit 0, and history.jsonl records 20261122T020058Z on opencode-route/workhorse. latest.log contains the summary.

    The canonical draft PR #12267 now includes the tracked per-job package, service/timer source, strict installer, fake-run test, and updated registry evidence (commit 546e925913). Verification passed: the package test, shell syntax, diff check, and rendered systemd unit verification. The timer was not changed in this pass.

    Cost evidence: the systemd trigger used zero Muse tokens; the job execution uses the selected OpenCode route. No comparable historical per-trigger Muse-token baseline exists, so no numeric before/after delta is claimed; #2019 records the limitation. CI policy has no PR merge-gating checks. Next: verify fresh PR status, then update queue disposition. The prior picked-up-note guard returned duplicate, so this progress is recorded here and in the queue checkpoint instead of posting another picked-up note.

  12. added
    queue/claimedQueue worker lifecycle state
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    and removed
    task/triageQueue packet kind: verify, reproduce, and route this item
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 22, 2026
  13. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    Task 9170 update (2026-11-21): PR #12267 at 546e925913 now contains the managed job package, strict installer, regression test, registry evidence, and successful scheduled hourly firing from 20:00:58–20:01:17 CST (systemd success/exit 0). It is ready for review; CodeRabbit is rate-limited and Codex review is running. The available checks are skipped/neutral, not failing. The #2019 evidence records that the trigger used 0 Muse tokens and that no comparable historical per-trigger Muse-token baseline exists; therefore no numeric before/after delta is claimed. Queue task is parked briefly for external review/CI disposition; no owner decision is being awaited.

  14. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: picked-up
    queue: repo-health-code-pilot
    task: 9170 (small_fix, worker repo-worker-code, lane any-o)
    by: openchamber-scheduled-lane
    at: 2026-11-22T02:42:00Z

    Fresh revalidation: #2232 remains OPEN; canonical PR #12267 is OPEN, ready for review, and has no hard-stop labels. Its latest Codex review found three actionable issues (strict no-argument contract, standalone latest heartbeat selection, and preserving lapsed provider state). The existing task branch is available at /home/user/.local/share/opencode/worktree/7c7733/queue-9170-2232 on the laptop. Claim labels are synced (work/assigned, queue/claimed, status/in-progress). I will address the findings on the canonical branch, test, push, and re-check CI/reviews before terminalizing or parking.
    resume: task branch queue/9170-2232-schedule-pilot; worktree /home/user/.local/share/opencode/worktree/7c7733/queue-9170-2232.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    epic/opencode-platformReprioritization program epic (2026-11-12)priority/highImportant and time-sensitivequeue/claimedQueue worker lifecycle statesource/creatorFiled by the new-issue-creator jobstatus/in-progressQueue worker lifecycle statetask/small-fixQueue packet kind: bounded fix with reproduction and targeted testswork/assignedQueue worker lifecycle state

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions