Skip to content

fix(pm-dispatch): wait:false launch failures leave the queue task queued and the issue unnoted #2901

Closed

Description

@dezren39

Finding

In pm-dispatch (pm-stack/dispatch), a failed session launch on the wait:false path is not cleaned up: the queue task is left queued and the tracking issue is never noted. Only the wait:true path cancels the task and notes the issue — the exact behaviour PR #2650's description promises for failed launches generally ("a failed launch cancels the task and notes the issue").

Evidence

  • PR feat(pm-stack): pm-dispatch — launch/track OpenCode sessions from GitHub Actions #2650 (commit 19f12cb2e2, MERGED) introduced the service. Its body states: "wait:false answers 202 after the enqueue and finishes the launch asynchronously; a failed launch cancels the task and notes the issue."
  • Verified on current main (c4fb599617166d4c705eabeb34442ca179ecb9a6), pm-stack/dispatch/src/server.ts:222-240: the async catch only does patchTask(task.id, { last_error: "dispatch launch failed: …" }). No cancelTask, no issue comment.
  • Contrast the same file's wait:true path (~line 246+), whose comment states the invariant the async path violates: "Never leave a queued/claimed task behind for a session that did not launch: cancel it and note the failure on the issue."

Why it matters

Acceptance criteria

  • The wait:false async failure path mirrors the wait:true one: cancelTask(task.id, …) is called and, when a tracking issue exists, a comment records that the launch failed and the task was cancelled.
  • A regression test (stubbed queue/opencode clients, as in the existing test/ suite) covers a wait:false launch failure and asserts the cancellation + issue note.
  • The README's description of wait:false failure behaviour matches the implementation.

Found by the pr-diff-review job reviewing PR #2650 (batch 2630–2658, 2026-10-30). Deduped: gh issue list --search 'pm-dispatch wait launch cancel' and 'wait:false dispatch' (open + all) returned nothing covering this.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    priority/highImportant and time-sensitive
    queue/queuedHas a queued task in the Supabase agent queue
    effort/sSmall: expected under 2 hours of work
    app/pm-stackpm-stack (Pad/Grist) in developing-today/code
    on Oct 31, 2026
  2. dezren39 commented on Oct 31, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

  3. dezren39 commented on Oct 31, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · triaged — CONFIRMED

    • Agent: queue worker (repo-worker-code), lane C shift
    • Session / ID: queue triage task 4128
    • Found via: queue claim (packet from pr-diff-review of PR feat(pm-stack): pm-dispatch — launch/track OpenCode sessions from GitHub Actions #2650)
    • Task: verify the wait:false launch-failure finding and route it
    • Verdict: CONFIRMED verbatim on current main (c4fb59961, read fresh 2026-10-31): in pm-stack/dispatch/src/server.ts the wait:false async catch (~L222-240) does only patchTask(task.id, { last_error: "dispatch launch failed: …" }) — no cancelTask, no issue comment. The wait:true path in the same handler (~L246+) states the invariant ("Never leave a queued/claimed task behind for a session that did not launch: cancel it and note the failure on the issue") and implements cancel + comment + 502.
    • README nuance for the fix: README L62-71 currently documents the wait:false failure as last_error-only and scopes the cancellation promise to "(wait: true)" — after the fix both sentences must change, not just the code.
    • Test seam note: queue/github/opencode clients are module-level singletons in server.ts (const github = new GitHubClient(...), requireQueue()); the existing test/ suite (auth/config/packet/validate) has no server-level test, so the regression test needs a small stub seam — keep it minimal.
    • Routed: fix enqueued as queue task 4135 (small_fix, dedupe repo-health:v1:fix:developing-today/code:issue:2901) with the three acceptance criteria from this issue.
  4. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Oct 31, 2026
  5. 3 remaining items

  6. dezren39 commented on Oct 31, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

    • Agent: queue worker (repo-worker-code), lane C shift
    • Session / ID: queue triage task 4128 → fix task 4135
    • Expectation: triage complete (CONFIRMED, note above). This issue returns to queue/queued for the fix task 4135, which carries the acceptance criteria; the fixing worker re-syncs labels on claim.
  7. dezren39 commented on Oct 31, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

    • Agent: queue worker (repo-worker-code), Lane E shift
    • Session / ID: queue task 4135
    • Found via: queue claim
    • Task: Fix fix(pm-dispatch): wait:false launch failures leave the queue task queued and the issue unnoted #2901: pm-dispatch wait:false launch failure must cancel the task and note the tracking issue, mirroring wait:true; regression test + README update.
    • Expectation: effort class s; done = PR opened with the fix + tests, task parked/completed per CI.
    • Links: triage task 4128 (CONFIRMED on current main)
  8. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Oct 31, 2026
  9. dezren39 commented on Oct 31, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed (cross-reference added on a correction pass)

    Relation to the existing launch-pipeline set: #2660 covers the opposite failure on the synchronous path — a comment/label failure after the claim PATCH cancelling a live session's task. #2668 (design epic) scopes its phases to #2664/#2665 (boundary), #2660 (commit point), and #2663 (retryable init). This issue is a fifth, distinct defect not in that set: on the wait:false path, a launch failure before the claim leaves the task queued and claimable, with no cancellation and no note on the tracking issue. If the #2668 staged redesign is implemented, its failure-semantics table should cover this async branch too; until then this issue tracks it directly. (Two sibling issues from this same run, #2902/#2903, WERE duplicates of #2663/#2664 and have been closed as such.)

  10. dezren39 commented on Oct 31, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

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/pm-stackpm-stack (Pad/Grist) in developing-today/codeeffort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/highImportant and time-sensitivesource/pr-diff-reviewFiled by the pr-diff-review jobtask/triageQueue packet kind: verify, reproduce, and route this item

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions