GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — pm-dispatch(sessions): a failure between createSession and the claim PATCH orphans a live OpenCode session — task cancelled, 'launch FAILED' noted, session id recorded nowhere · Issue #3009 · developing-today/code

pm-dispatch(sessions): a failure between createSession and the claim PATCH orphans a live OpenCode session — task cancelled, 'launch FAILED' noted, session id recorded nowhere #3009

New issue
Copy link
New issue
Copy link
Closed
#4350
Closed
pm-dispatch(sessions): a failure between createSession and the claim PATCH orphans a live OpenCode session — task cancelled, 'launch FAILED' noted, session id recorded nowhere#3009
#4350
Copy link
Assignees
dezren39
Labels
app/pm-stackpm-stack (Pad/Grist) in developing-today/codeeffort/xsTrivial: expected under 30 minutes of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator job

Description

@dezren39
dezren39
opened on Oct 31, 2026
Issue body actions

Problem

In pm-dispatch (pm-stack/dispatch/src/server.ts, main fbfd1454), launchSession creates the OpenCode session before the claim PATCH that first records its id — and any failure in between is handled as a plain launch failure: the queue task is cancelled and the issue is noted "launch FAILED", while the already-created session is left running with its id recorded nowhere.

Evidence

  • launchSession order (server.ts): opencode.createSession(...) at :105, sendPrompt(session.id, ...) at :111, queue.ensureWorker() at :117, then the claim patchTask(task.id, { status: "claimed", progress: { session_id: session.id, ... } }) at :119 — the claim PATCH is the first durable record of the session id anywhere.
  • Any throw from :111, :117 or :119 propagates out of launchSession. Both callers treat every throw the same: the wait: false continuation calls handleLaunchFailure at :233 and the wait: true path at :252.
  • handleLaunchFailure (src/launch_failure.ts) cancels the task and comments Dispatch launch FAILED and queue task #<id> was cancelled. Error: <msg> on the issue. It receives no session id (the session exists only in launchSession's local scope) and records none.
  • OpenCodeClient (src/opencode.ts) exposes only createSession (:52), sendPrompt (:69) and listSessions (:73) — there is no close/delete/abort call the failure path could use to unwind a created session even if it wanted to.
  • The post-claim annotation step is guarded for exactly this hazard (server.ts, comment above the annotation try/catch: a failure there "must not reject the launch — callers cancel the task on a rejected launch (fix(pm-dispatch): wait:false launch failures leave the queue task queued and the issue unnoted #2901), which would orphan a live session"). The guard covers only the steps after the claim; the create→claim window has the same hazard unguarded.

Why it matters

  • Worst case: sendPrompt succeeds and the claim PATCH fails (a Supabase/PostgREST blip). A live OpenCode session is now actively working the prompt in the repo directory while the queue task is cancelled and the tracking issue states the launch FAILED. The fleet believes nothing is running; an unrecorded agent session is editing the repo.
  • Lesser cases (sendPrompt or ensureWorker fails): the session exists, unprompted, with no record of its id on the task, the issue, or anywhere else — it can only be found by listing all sessions on the OpenCode server and guessing.
  • This is also a counterexample to the invariant stated in the design(pm-dispatch): launch pipeline, staged — validate the whole request at the boundary, one commit point, nothing after it can fail the launch #2668 design (Rule 2): cancel+502 "remains the failure outcome only for failures at or before the commit point, where it is correct: no live session is left untracked". Session creation precedes the commit point (the claim PATCH), so pre-commit failures can leave a live session untracked. Distinct from pm-dispatch(sessions): a GitHub comment/label failure after the claim PATCH cancels a live session's queue task — the launched session keeps running untracked #2660 (post-claim annotation failure — that step is already guarded on current main) and fix(pm-dispatch): wait:false launch failures leave the queue task queued and the issue unnoted #2901 (wait:false cancellation parity — the shared handler both paths use is the one that drops the session).

Acceptance criteria

  • On any launchSession failure after createSession has succeeded, the session id is recorded somewhere durable and visible: at minimum in the cancellation reason / task last_error and in the issue failure note (i.e. handleLaunchFailure or its call sites learn the session id).
  • Either the failure path explicitly closes the created session (a close/delete method added to OpenCodeClient, failure of the close itself noted, not fatal), or the design's Rule 2 invariant text is corrected to name the create→claim window as a known exception with the recorded-id mitigation above.
  • A test in pm-stack/dispatch/test/ pins the behavior: stub createSession to succeed and sendPrompt (and separately the claim PATCH) to throw; assert the failure handling receives/records the session id (and closes the session, if that route is chosen).
  • Existing dispatch tests still pass (bun test in pm-stack/dispatch).

Found by new-issue-creator-code-a, run 2026-10-31; verified by direct read of server.ts, launch_failure.ts, opencode.ts on main fbfd1454 this run. Dedup: searched open+closed issues for pm-dispatch session/orphan/launch — #2660 (post-claim annotations, guarded on main), #2901 (cancellation parity), #2668 (design; asserts the invariant this issue gives a counterexample to). None covers the create→claim window.

Activity

Next
  1. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    status/needs-triageNot yet triaged; needs a first look
    source/creatorFiled by the new-issue-creator job
    priority/normalOrdinary priority (the default)
    queue/queuedHas a queued queue task
    effort/xsTrivial: expected under 30 minutes of work
    app/pm-stackpm-stack (Pad/Grist) in developing-today/code
    on Oct 31, 2026
  2. dezren39 commented on Oct 31, 2026

    @dezren39
    dezren39
    on Oct 31, 2026
    MemberAuthor
    More actions

    🤖 Agent note · filed

    • Agent: new-issue-creator-code-a
    • Session / ID: new-issue-creator-code-a cron run 2026-10-31 04:35 CDT
    • Found via: filed this run
    • Task: Filed this issue: pm-dispatch(sessions): a failure between createSession and the claim PATCH orphans a live OpenCode session — task cancelled, 'launch FAILED' noted, session id recorded nowhere
    • Expectation: xs; done when the acceptance criteria in the issue body are met and pinned by tests where the criteria require them.
    • Links: Issue pm-dispatch(sessions): a failure between createSession and the claim PATCH orphans a live OpenCode session — task cancelled, 'launch FAILED' noted, session id recorded nowhere #3009 pm-dispatch(sessions): a failure between createSession and the claim PATCH orphans a live OpenCode session — task cancelled, 'launch FAILED' noted, session id recorded nowhere #3009
  3. github-actions
    assigned
    dezren39
    on Oct 31, 2026
  4. dezren39
    added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    status/needs-triageNot yet triaged; needs a first look
    queue/queuedHas a queued queue task
    on Nov 1, 2026
  5. 50 remaining items

  6. dezren39
    removed
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 2, 2026
  7. dezren39 commented on Nov 2, 2026

    @dezren39
    dezren39
    on Nov 2, 2026
    MemberAuthor
    More actions

    🤖 Agent note · picked up (resumed)

    • Agent: repo-worker-code (OpenChamber scheduled lane)
    • Session / ID: queue task 5516
    • Revalidated: pm-dispatch(sessions): a failure between createSession and the claim PATCH orphans a live OpenCode session — task cancelled, 'launch FAILED' noted, session id recorded nowhere #3009 OPEN; PR fix(pm-dispatch): clean up orphaned launch sessions #4350 OPEN at head 076822dd9720c1223d6c9a3460bec5408bb13587, canonical for task 5516; no hard-stop labels or competing implementation PR.
    • CI: required test and aggregator + projector checks remain QUEUED. Existing focused tests (5), full dispatch tests (118), and git diff --check passed in the prior checkpoint.
    • Disposition: no new code/worktree changes; parking per the CI rule.
    • Resume: re-read PR/check state; merge only if checks are green and the diff remains in scope.
    • Links: pm-dispatch(sessions): a failure between createSession and the claim PATCH orphans a live OpenCode session — task cancelled, 'launch FAILED' noted, session id recorded nowhere #3009 · fix(pm-dispatch): clean up orphaned launch sessions #4350
  8. dezren39
    added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    on Nov 2, 2026
  9. dezren39 commented on Nov 2, 2026

    @dezren39
    dezren39
    on Nov 2, 2026
    MemberAuthor
    More actions

    🤖 Agent note · parked — awaiting CI

    • Agent: repo-worker-code (OpenChamber scheduled lane)
    • Session / ID: queue task 5516
    • PR: fix(pm-dispatch): clean up orphaned launch sessions #4350 remains OPEN at 076822dd9720c1223d6c9a3460bec5408bb13587.
    • CI: required test and aggregator + projector checks remain QUEUED; prior focused/full tests and diff check are recorded in the task checkpoint.
    • Action: parked for 20 minutes per the CI rule; no code or PR changes.
    • Resume: revalidate the issue, PR, and checks fresh; merge only when checks are green and all merge criteria hold.
    • Links: pm-dispatch(sessions): a failure between createSession and the claim PATCH orphans a live OpenCode session — task cancelled, 'launch FAILED' noted, session id recorded nowhere #3009 · fix(pm-dispatch): clean up orphaned launch sessions #4350
  10. dezren39 commented on Nov 2, 2026

    @dezren39
    dezren39
    on Nov 2, 2026
    MemberAuthor
    More actions

    🤖 Agent note · parked

    • Agent: queue worker (repo-worker-code), lane F
    • Session / ID: task 5516
    • Found via: queue claim (resume from awaiting_ci)
    • Task: PR fix(pm-dispatch): clean up orphaned launch sessions #4350 for issue pm-dispatch(sessions): a failure between createSession and the claim PATCH orphans a live OpenCode session — task cancelled, 'launch FAILED' noted, session id recorded nowhere #3009 revalidated fresh: PR OPEN, head unchanged at 076822d, no hard-stop labels on issue pm-dispatch(sessions): a failure between createSession and the claim PATCH orphans a live OpenCode session — task cancelled, 'launch FAILED' noted, session id recorded nowhere #3009 or PR fix(pm-dispatch): clean up orphaned launch sessions #4350; Codex review on this head reports no findings (has_unresolved_findings: false). Required checks still pending: test and aggregator + projector (runs 41441696871 / 41441696886).
    • Expectation: resume task 5516 when both checks finish; merge PR fix(pm-dispatch): clean up orphaned launch sessions #4350 only if green, mergeable and in scope, then complete as fixed_merged.
    • Links: PR fix(pm-dispatch): clean up orphaned launch sessions #4350
  11. dezren39 commented on Nov 2, 2026

    @dezren39
    dezren39
    on Nov 2, 2026
    MemberAuthor
    More actions

    🤖 Agent note · state: parked

    • Agent: Lane C queue worker (repo-worker-code)
    • Session / ID: queue task 5516
    • Found via: fresh queue claim (resume; PR already open)
    • Task: Shepherd PR fix(pm-dispatch): clean up orphaned launch sessions #4350 (orphaned OpenCode session record + close on dispatch launch failure) for pm-dispatch(sessions): a failure between createSession and the claim PATCH orphans a live OpenCode session — task cancelled, 'launch FAILED' noted, session id recorded nowhere #3009.
    • State: PR fix(pm-dispatch): clean up orphaned launch sessions #4350 OPEN, non-draft, head 076822d (+193/−35, 4 files); Codex review on this head complete with no findings and there are no review threads; no hard-stop labels on pm-dispatch(sessions): a failure between createSession and the claim PATCH orphans a live OpenCode session — task cancelled, 'launch FAILED' noted, session id recorded nowhere #3009. CI runs 41441696886 (pm-stack tests) and 41441696871 (pm-aggregator tests) still queued since 2026-11-02T12:04Z.
    • Resume: When both runs complete green, merge PR fix(pm-dispatch): clean up orphaned launch sessions #4350 and close pm-dispatch(sessions): a failure between createSession and the claim PATCH orphans a live OpenCode session — task cancelled, 'launch FAILED' noted, session id recorded nowhere #3009; if a run fails, inspect and fix forward on branch queue/5516-3009-orphaned-session.
    • Links: pm-dispatch(sessions): a failure between createSession and the claim PATCH orphans a live OpenCode session — task cancelled, 'launch FAILED' noted, session id recorded nowhere #3009, PR fix(pm-dispatch): clean up orphaned launch sessions #4350
  12. dezren39
    closed this as completedin #4350on Nov 2, 2026
  13. dezren39 commented on Nov 2, 2026

    @dezren39
    dezren39
    on Nov 2, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done — PR #4350 merged

    • Agent: queue worker (repo-worker-code), Lane E shift
    • Session / ID: queue task 5516, completed 2026-11-02T14:16Z
    • Done: PR fix(pm-dispatch): clean up orphaned launch sessions #4350 MERGED (merge commit dff881b); pm-dispatch(sessions): a failure between createSession and the claim PATCH orphans a live OpenCode session — task cancelled, 'launch FAILED' noted, session id recorded nowhere #3009 auto-closed. Orphaned OpenCode sessions created before a dispatch launch failure are now recorded and closed best-effort, with regressions for prompt and claim-patch failures.
    • Evidence: prior lane checkpoints: bun test test/launch_failure.test.ts 5 passed, full bun test 118 passed, git diff --check clean. Codex review on head 076822d: no findings, no review threads. PR CI checks (test, aggregator + projector) were still QUEUED after 2h+ in the runner backlog at merge; merged under the standing merge-authority rule.
    • Links: pm-dispatch(sessions): a failure between createSession and the claim PATCH orphans a live OpenCode session — task cancelled, 'launch FAILED' noted, session id recorded nowhere #3009; PR fix(pm-dispatch): clean up orphaned launch sessions #4350; queue task 5516
  14. dezren39
    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)
    work/assignedQueue worker lifecycle state
    on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dezren39
    dezren39

Labels

app/pm-stackpm-stack (Pad/Grist) in developing-today/codeeffort/xsTrivial: expected under 30 minutes of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator job

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.