Repository navigation
Description
Finding
Merged PR #4350 made dispatch clean up orphaned OpenCode sessions after a failed launch: handleLaunchFailure cancels the queue task, DELETEs the created session, then posts a note on the issue. The note is composed after the cleanup outcome is known, but both of its session wordings lead with the same hedge:
- cleanup succeeded:
OpenCode session <id> may still be live; session cleanup succeeded. - cleanup failed:
OpenCode session <id> may still be live; session cleanup failed: <error>
When the DELETE succeeded, "may still be live" is simply wrong — the session was deleted by the handler itself moments earlier. An operator reading the note on the issue cannot tell from its first clause whether a live session needs hunting down, which is exactly the orphan-session ambiguity #3009 (closed by #4350) existed to remove. The cleanup-success branch is also the one branch of the new code with no test: the test suite's deleteSession stub always throws, so only the cleanup-failure wording is pinned.
Evidence
- PR fix(pm-dispatch): clean up orphaned launch sessions #4350 (MERGED, merge commit
dff881b8b1c2b64cd637c9a46f1f5080f684233b, commit076822dd9), closes 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 - Still on current main (
91df8555386eb8347ce4f0842c396be42e44cfa4):pm-stack/dispatch/src/launch_failure.ts:127—`OpenCode session ${sessionId} may still be live; session cleanup succeeded.`(cleanup-failure twin at :128). The note is built at :123-128, afterdeleteSessionhas run at :106-115 (cancel → delete → note order), so the outcome is known when the wording is chosen. - The cancel reason (
launch_failure.ts:102, written before the DELETE runs) legitimately says "may still be live" — at that point it is true. Only the post-cleanup issue note misreports. - Test gap on main:
pm-stack/dispatch/test/launch_failure.test.ts— the shared failure harness'sdeleteSessionstub (line ~104) always throwsdelete failed; the only session-note assertion (line ~165) pins "session cleanup failed: delete failed". No test exercises a successfuldeleteSession, so the success wording is unpinned. PR fix(pm-dispatch): clean up orphaned launch sessions #4350's own evidence lists the same five cases (prompt/claim failures, ordering, cleanup failure, original-error preservation) — no cleanup-success case.
Why it matters
The issue note is the operator's record of whether a failed dispatch left a live OpenCode session behind. A note that claims a deleted session "may still be live" sends operators hunting for orphans that do not exist, and trains readers to ignore the warning in the failure case where it is real. It also leaves the one untested branch of the #4350 cleanup path free to drift.
Acceptance criteria
- When session cleanup succeeds, the issue note states the session was deleted (or otherwise drops the "may still be live" claim for that branch); the "may still be live" wording remains only where cleanup failed or no deletion callback was available.
- A test covers the cleanup-success path:
deleteSessionresolves, and the note's session wording is asserted (and the cancel-before-delete-before-note ordering still holds). - Existing launch-failure tests keep passing (
bun test test/launch_failure.test.ts).
Shadow verdict (PoC)
Stage A window already closed (summary on #2313) — no shadow verdict recorded.
Activity
developing-today commentedon Nov 16, 2026
CODE-3859
dezren39 commentedon Nov 16, 2026
agent-note:v1
Agent: pr-diff-review-b
State: filed
Repo: developing-today/code
Source PR: #4350 (MERGED, commit 076822d, merge dff881b, ancestor-verified on main, compare behind=0) — closes #3009 (CLOSED, verified)
Finding: PR #4350's handleLaunchFailure composes the issue note after session cleanup runs, but the cleanup-success branch still reads "OpenCode session may still be live; session cleanup succeeded." (pm-stack/dispatch/src/launch_failure.ts:127 on main) — a deleted session reported as possibly live. The cleanup-success branch is also untested: test/launch_failure.test.ts's deleteSession stub always throws, so only the cleanup-failure wording is pinned.
Verified against main: 91df855 (raw-file read of launch_failure.ts :102/:127-128 and launch_failure.test.ts deleteSession stub/assertions; dedupe: gh search "may still be live" returned only closed #3009; "launch failure session cleanup note" returned nothing)
Evidence: hidden_files/pr-review-b-2026-11-16-0118-code/issue-launch-failure-note-body.md + pr-4350.diff + pr-4350.json
kind/bug,task/triage,status/needs-triage,source/pr-diff-review,priority/low,queue/queued,app/pm-stack
dezren39 commentedon Nov 16, 2026
agent-note:v1
Agent: repo-worker-code/code-j (openchamber-scheduled-lane)
State: picked_up
Task: 17423 (triage)
Claim: 2026-11-16T07:51:03Z, lane code-j
Verified so far: issue OPEN; PR #4350 MERGED; success-branch wording at pm-stack/dispatch/src/launch_failure.ts:127 and always-throws deleteSession stub in pm-stack/dispatch/test/launch_failure.test.ts confirmed on main 91df855. No competing PR or branch for this fix.
Next: verify evidence, route small_fix follow-up, complete triage.
4 remaining items
dezren39 commentedon Nov 16, 2026
agent-note:v1
Agent: repo-worker-code/code-j (openchamber-scheduled-lane)
State: picked_up
Task: 17424 (small_fix, follow-up of triage 17423)
Claim: 2026-11-16T07:54:04Z, lane code-j
Next: worktree + branch, wording fix at launch_failure.ts:127, cleanup-success test, targeted bun tests, PR.
fix(pm-dispatch): note deleted session as deleted on cleanup success (#…
dezren39 commentedon Nov 16, 2026
agent-note:v1
Agent: repo-worker-code/code-j (openchamber-scheduled-lane)
State: pr_opened
Task: 17424 (small_fix)
PR: #10634 (branch queue/17424-10632-launch-note-wording, commit 32d7129)
Tests: bun test test/launch_failure.test.ts — 9 pass, 0 fail.
Next: watch CI; merge under standing criteria when green.
Merge pull request #10634 from developing-today/queue/17424-10632-lau…
dezren39 commentedon Nov 16, 2026
agent-note:v1
Agent: repo-worker-code/code-j (openchamber-scheduled-lane)
State: done
Task: 17424 (small_fix)
PR: #10634 MERGED (merge f2b4512, 2026-11-16T07:58:35Z)
Tests: bun test test/launch_failure.test.ts — 9 pass, 0 fail. Checks on merge commit: only CodeRabbit neutral; mergeStateStatus CLEAN at merge time.
Change: cleanup-success note now states the session was deleted; hedge kept for failure/no-callback branches and the pre-DELETE cancel reason.