Skip to content

fleet queue: resume-by-session, claim-any-task, and manual-only items #9178

Open

Description

@dezren39

fleet queue: resume-by-session, claim-any-task, and manual-only items

Priority: High. Intrinsic urgency: 400. Drew directive, 2026-11-12 20:41 CST.

Parent epic: #8990 (fleet tool — one door for coordination, mirroring, and backups).

Why this exists

The Fleet CA design mill incident exposed a queue-semantics gap. Epic #9155's bound Summit session was stopped and queue task 15345 was parked. The eventual resume had to create a fresh OpenCode session and rebuild the design context from artifacts; roughly 600K tokens of shared context from the stopped Summit run were not recoverable through the queue because a task cannot name the session that should resume it.

The queue needs first-class support for four related operations:

  1. resume a task in a named OpenCode session;
  2. claim any specific task by number, including a parked or attempt-capped task, under an explicit owner override;
  3. claim several tasks under one session; and
  4. create work that automatic lanes never claim.

Section 5 records a broader fleet-attribution proposal for an explicit decision. It is not adopted by filing this issue.

1. Resume by session ID

Specification

  • Add a nullable resume_session_id column to the fleet-queue tasks table. It may be set when a task is enqueued or by an authorized later update.
  • When a worker claims a task with resume_session_id, the launcher must continue that OpenCode session by session ID instead of creating a new session. This builds on the session-state work in impl(fleet): session state — session id in env + worktree pwd-file #9075 and the create-path provenance stamping in impl(fleet): fleet gh Metadata superset — create-path stamping + DB insert (extends #9016) #9073.
  • Record both the requested session and the session actually used on the task's claim/attempt record. A silent substitution is not allowed.
  • Only an authorized actor may set, replace, or clear the value: the task creator, the currently bound worker/session, or an explicit operator action. Every change is audit-logged with actor, prior value, new value, time, and reason.
  • The resume hint does not override task ownership. If the task is already claimed, section 3's normal skip/take-over rules apply.

Edge cases to settle in the design and cover with tests

  • Session no longer exists on the target OpenCode server: fall back to a fresh session in the correct worktree, record resume_fallback=missing_session and the new session ID on the task, and surface the substitution in the claim result. Do not fail forever or repeatedly retry the missing session.
  • Session exists in a different worktree: never silently execute the task in the wrong tree. Either (a) require an explicit rebind action that records old worktree, new worktree, actor, and reason, or (b) fall back to a fresh session in the task's worktree and record the mismatch. The implementation issue must choose one rule and test it; silent cross-worktree execution is prohibited.
  • Session exists but is busy/owned by another active task: do not steal it implicitly. The claim is skipped unless the section 3 take-over path is explicitly used.
  • Host/server restart: the stored session ID survives in the queue. On claim, existence is checked against the target server; the missing-session fallback above applies if the server no longer knows it.
  • No resume_session_id: behavior is unchanged from today.

Acceptance criteria

  • Schema migration adds resume_session_id and the audit fields/events needed to distinguish requested session from actual session.
  • Enqueue and update paths can set/clear the column with authorization checks and audit records.
  • A claim with a live matching session continues that session; evidence from the OpenCode server shows the same session ID receiving the task prompt.
  • Missing-session, wrong-worktree, and busy-session cases each have automated tests and produce the specified recorded outcome.
  • A task without resume_session_id follows the existing claim path unchanged.

2. Claim any task by number, including parked or attempt-capped tasks

Specification

  • Provide a fleet CLI verb for claiming one task by numeric ID. Working name: fleet queue claim --task <id>. The final verb must follow the existing fleet queue verb conventions from fleet gh step 2: higher-level sync tools on the token rotation #9016.
  • The claim path must be able to claim a task that is queued, parked, or at max_attempts. It must not pretend those states do not exist; it records an explicit manual-claim override.
  • The override record includes claimant identity, session ID when known, timestamp, reason, prior task status, prior not_before/park reason when present, and prior attempt count.
  • A manual claim does not silently reset the attempt history. The max-attempts gate is bypassed for this claim by the recorded override, while the historical attempts remain visible.
  • The resulting claim carries an override marker/epoch that startup and supervision logic can see. A worker booting under that manual claim must not immediately re-stop or re-park the task for the same unchanged condition that caused the earlier park. A materially new condition may still stop or park it, with that new condition recorded.
  • Repeating the same claim while the same worker/session owns it is idempotent and returns the existing claim. A claim by a different worker follows section 3's skip/take-over rules.

Acceptance criteria

  • A specific queued task can be claimed by ID without waiting for normal lane selection.
  • A specific parked task can be claimed by ID; the resulting task record shows the override, prior park state, actor, session, time, and reason.
  • A specific task at max_attempts can be claimed by ID without erasing attempt history.
  • A manually claimed task's first boot does not re-park solely for the same recorded park condition; a test reproduces the original park condition and proves the override is honored.
  • A second claim by the same owner is idempotent; an attempted claim by another owner does not disturb the live claim unless take-over is explicitly requested.

3. Claim multiple tasks under one session

Specification

  • Extend the claim verb so one session can claim multiple task IDs in one operation, for example fleet queue claim --task <id1> --task <id2> --session <session-id>.
  • The result is reported per task: claimed, already-owned-by-this-session, skipped-claimed, not-found, or failed, with the reason for each non-claim.
  • Tasks already picked up by another worker are skipped by default.
  • An explicit --take-over flag may claim an already-picked-up task. A take-over atomically transfers the lease/claim, ends or supersedes the prior claim according to the queue's lease rules, and records prior worker/session, new worker/session, actor, time, and reason. Where the prior worker can be signalled, it receives a hand-back/stop signal; where it cannot, that limitation is recorded.
  • Resume-by-session, parked, max-attempts, and manual-only semantics compose with batch claims: each task's override/take-over/manual authorization is independently auditable.

Acceptance criteria

  • One command can claim at least two unclaimed tasks for the same session and returns a per-task result.
  • Already-claimed tasks are skipped by default and their existing claims are unchanged.
  • With --take-over, an already-claimed task transfers to the requesting session and both sides of the transfer are audit-logged.
  • A mixed batch (unclaimed, already owned by requester, owned by another worker, missing, parked) produces the specified per-task outcomes without disturbing skipped tasks.

4. Manual-only queue items

Automatic lanes must have a trustworthy way to leave an item alone until a person or a named session claims it. Direct-dispatch design-mill work is the immediate use case: today such work is made effectively manual by parking it or by relying on dispatch discipline, but neither state says what it means.

Options

Option Assessment
Create the item as parked, then manually claim/start it Works as a stopgap and needs no schema, but conflates “waiting for a stated condition/date” with “waiting for a human/named session.” It also inherits park semantics, including watchers and reports treating the item as stalled or blocked.
Give it a very, very low priority Not a guarantee. Priority changes, queue drains, priority boosts, and lane scope changes can all make the item claimable. It is a race, not a contract.
First-class manual_only / no_auto_claim flag (recommended) States the actual contract. The automatic claim query excludes the item regardless of priority. Only the explicit claim-by-ID path can claim it. The flag and every change to it are auditable.

Recommendation and specification

Adopt a first-class boolean, working name manual_only, on tasks:

  • The automatic claim query must exclude manual_only = true unconditionally; priority, age, lane, and queue depth do not change that.
  • The item remains visible in queue listings and dashboards with its manual-only state shown as an intentional state, not as parked, stalled, or blocked.
  • Only section 2's explicit claim-by-ID path can claim it. Batch claims follow the same rule per task.
  • The flag may be set at enqueue time or by an authorized later update. Setting or clearing it is audit-logged. Clearing it makes the item eligible for normal automatic claiming.
  • Migration: audit current parked-for-manual/direct-dispatch items individually and convert only those whose record shows they are waiting for a human/named session. Do not blanket-convert parked tasks; most parks mean something else.

Acceptance criteria

  • Schema and enqueue/update paths support manual_only with audit history.
  • With a manual-only item as the highest-priority and only otherwise-claimable item, an automatic lane run claims nothing.
  • The same item can be claimed through the explicit claim-by-ID path, including under a named session.
  • Queue listings distinguish manual-only from parked and blocked.
  • A migration report lists current parked-for-manual candidates and the disposition of each; no blanket conversion occurs.

5. Proposal for decision — fleet init, run identity, and a complete transaction log

Status: proposal to decide, not an approved design. Drew's suggestion, recorded here so the decision is explicit:

Use the fleet tool for queue and GitHub interactions. Require a fleet init step that mints a unique run/task ID and stamps everything discoverable — or require a flag/env var that ties that ID to a task or cron job. Carry the ID into GitHub operations so comments, edits, closes, and merges are attributable to the run that performed them. Log every fleet transaction to a durable log file that is backed up and can be injected into Atlas.

The motivation is concrete: the automation that labeled #9155 status:done and closed it during an active bound Summit run has not been identified from the GitHub surface alone. A fleet-carried run identity and transaction log would make “who stopped, merged, closed, or edited this?” a lookup instead of an investigation.

Decisions this issue must produce

  • Scope: Does “all interactions” mean all fleet-mediated queue/GitHub mutations, all GitHub operations including reads, interactive human use as well as agents/cron, or a phased scope? Which bypasses remain allowed, and how are they detected?
  • Init contract: What does fleet init mint and stamp (run ID, task ID, cron/job ID, session ID, host, worktree, repo, actor/route, start time)? What is inherited from env, the impl(fleet): session state — session id in env + worktree pwd-file #9075 pwd-file, flags, and task claims? What happens when init is missing: fail closed for mutations, warn-and-log, or read-only mode? Is there an audited emergency bypass?
  • GitHub carriage: How is the run ID represented on issue/PR comments, edits, closes, and merges — pm-metadata, a hidden marker, a database mapping, or a combination — without noisy duplication on every operation?
  • Transaction log: Append-only local file, queue/DB table, or both? Required fields, secret-redaction rules, rotation/retention, backup target/frequency, failure behavior when logging fails, and the Atlas ingestion path/schema.
  • Adoption boundary: If adopted, file separate implementation issues for init/identity, GitHub carriage, and logging/backup/Atlas ingestion. If rejected or narrowed, record the rationale and the alternative attribution mechanism.

Acceptance criteria for this section

  • A decision record exists for the proposal (see the companion decision-records issue) stating adopted, narrowed, or rejected, with scope and rationale.
  • No implementation of fleet-init is treated as authorized merely because the proposal appears in this issue.
  • If adopted, follow-on implementation issues are filed and linked here before work begins.

Cross-links

Overall acceptance

  • Sections 1–4 are implemented with migrations, CLI help/docs, audit records, and the tests named above.
  • Existing tasks without a resume session or manual-only flag behave exactly as before.
  • Queue docs/runbooks describe resume, manual claim, take-over, and manual-only semantics using the same terms as the CLI and task records.
  • Section 5 ends in an explicit decision record, not silent adoption or silent abandonment.

{"pm_meta": 1, "kind": "feature-spec", "urgency": 400, "direct_parent": "#8990", "related": ["#9155", "#9075", "#9073", "#9016"], "queue_task": 15345}

Activity

  1. added
    kind/featureNew feature or capability request
    priority/highImportant and time-sensitive
    app/fleetpkgs/fleet multicall binary + platform crates
    epic/fleet-toolEpic: fleet-tool - all issues of this effort carry it
    on Nov 13, 2026
  2. developing-today commented on Nov 13, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Nov 13, 2026

    @dezren39
    MemberAuthor

    Companion decision-records issue filed: #9180 — fleet decision records: document queue and attribution decisions durably. Section 5 of this issue (fleet init / run identity / transaction log) is seeded there as FDR-0005, and sections 1–4 as FDR-0001–FDR-0004. This issue is not complete until those decisions have durable records.

  4. dezren39 commented on Nov 13, 2026

    @dezren39
    MemberAuthor

    Part 4 of the 90-day closed-item review filed as #9221 (fleet gh: closure records + reason-required closes) — it builds on this issue's §(e) attribution proposal: closure recording into the backed-up transaction record, with the run ID this issue specifies. Motivating counts so far: darwin-nix 3 wrongly-closed of 1,810 reviewed; code checkpoint 1: 0 of 56 (7,724 in scope).

  5. dezren39 commented on Nov 15, 2026

    @dezren39
    MemberAuthor

    Two production regression cases for §4 (automatic lanes must skip manual/direct-only work even when the park expires and there is no bound session): #9399 / task 15864 and #9568 / task 16121. Both were picked by ordinary lanes and parked again; absence of a binding did not release the separately recorded Summit ownership. Separately, #4712 / task 6693 is a still-bound case (ledger row 628) for §§1–3: reconcile the existing binding and never implicitly take it over. These are acceptance fixtures, not evidence the historical sessions are live, and not a new claim or request to retry those tasks.

  6. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    state: triaged
    lane: any-b, worker: repo-worker-code, task 18908

    Triage verdict for #9178 (checked fresh this shift, 2026-11-17): real, priority/high — but its completion condition is gated on the FDR convention reconciliation in #9180, and its semantics work belongs to the fleet-tool program, not a lane fix.

  7. 1 remaining item

  8. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    state: picked_up
    lane: any-o, worker: repo-worker-code, task 20350

    Picked up for scheduled-lane revalidation. I am checking the current issue and the decision-record dependency before routing or closing this task.

  9. added
    queue/blockedQueue or user escalation state
    status/blockedQueue or user escalation state
    and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 17, 2026
  10. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    state: blocked
    lane: any-o, worker: repo-worker-code, task 20350

    Fresh triage: #9178 remains OPEN and real/high priority. Completion is gated on the FDR convention reconciliation tracked by #9180, which remains OPEN; the companion decision records have not been established as complete. #9199, #9200, #9201, and #9204 remain OPEN; #9202 and #9203 are CLOSED. The prior triage verdict remains applicable: do not allocate FDR-000x or file duplicate implementation work before #9180 settles the naming convention. Blocked this task on #9180; resume after its convention decision is recorded.

  11. removed their assignment
    on Nov 20, 2026
  12. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    Drew clarified on 2026-11-22 that task/session binding and blocking should apply only while the specific agent is actively working the item. Once that work is no longer active, any agent must be able to resume, unblock, or implement it by default. Keep only explicit, documented special cases exclusive (for example manual-only work or a task with a live claim/session). This clarification governs the resume/takeover/unblock design here; update the relevant FDR records and tests in the implementation slice. Do not treat a stale session/lane-ledger reference as proof of active work.

  13. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    state: triaged
    lane: archer, worker: muse (Lane DZ), task 20350

    Fresh triage verdict for #9178 (2026-11-22, supersedes the 2026-11-17 blocked verdict): the #9180 gate has cleared; the issue stays open for its implementation and its §5 decision.

    What changed since the last verdict:

    Remaining, in order:

    1. §5 decision — Drew's call. FDR-0005 (fleet init / run identity / transaction log) needs an explicit adopted / narrowed / rejected ruling with scope, per the decision list in §5. Nothing in §§1–4 waits on it.
    2. §§1, 3, 4 implementation slices (resume-by-session column + claim path; batch claim with per-task results and --take-over; manual_only flag with auto-claim exclusion and listing distinction) — file under epic epic: fleet tool — one door for coordination, mirroring, and backups #8990 once checked against design(pm-orchestration): Claim and lease contract compatibility against #9178 #9512's compatibility design; each slice cites its FDR (0001/0003/0004) and the 2026-11-22 clarification.
    3. §2 remainder rides with fleet queue: no unblock/release verb — blocked tasks cannot be released or dep-corrected from any seat #12777 (unblock/release/unpark verbs + override record for parked/attempt-capped claims).

    No code or new issues from this triage lane: the design-compat ownership (#9512, design mill) and the pending §5 decision make a lane-filed implementation packet premature today; the durable record and routing above are the landable slice.

  14. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Block lifted — stale-block sweep, 2026-11-23 (Survey B, archer).

    Named blocker of record: #9180 (fleet decision records / FDR convention reconciliation), per the 2026-11-17 blocked verdict on this issue.

    Evidence the blocker resolved, verified first-hand via gh GraphQL this sweep:

    Action: queue/blocked removed, queue/queued added. This issue stays open for its implementation slices and its §5 decision (FDR-0005), which is recorded on the issue itself and does not gate §§1–4.

  15. added and removed
    queue/blockedQueue or user escalation state
    on Nov 23, 2026
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

    app/fleetpkgs/fleet multicall binary + platform cratesepic/fleet-toolEpic: fleet-tool - all issues of this effort carry itkind/featureNew feature or capability requestpriority/highImportant and time-sensitivequeue/queuedHas a queued queue taskstatus/blockedQueue or user escalation state

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions