Repository navigation
Description
Finding
PR #4231 gave each post-claim launch annotation its own guard and made its failure notes accumulate — but only within annotateLaunch itself. In launchSession, the lane-ledger step runs immediately before the annotations and records its own failure the same way, by PATCHing the task's last_error. When a lane-ledger failure and an annotation failure happen in the same launch, the annotation note overwrites the lane-ledger note, so the task record ends up naming only the annotation failure:
launchSession(pm-stack/dispatch/src/server.ts, current main): the lane-ledgerassignLanecatch PATCHeslast_error: "lane assignment failed (launch unaffected): …". It does not add the failure to the responsewarningseither, so the task note is the only record of it.annotateLaunch(pm-stack/dispatch/src/launch_annotations.ts:48-53):noteFailurePATCHeslast_error: failures.join("; ")wherefailuresstarts empty for each call — it never reads or preserves the task's existinglast_error.QueueClient.patchTask(pm-stack/dispatch/src/queue.ts:114) is a PostgREST PATCH (field set): the second write replaceslast_errorwholesale.
Net effect: a launch whose lane assignment failed (so a later completion cannot record the executed lane) and whose issue comment or labels then failed loses the lane-failure record entirely — the exact "final note names every failure" property #4231's design (#2668 phase 2) set out to provide holds only inside the helper, not across the launch sequence.
Evidence
- Source PR: fix(dispatch): guard post-claim GitHub annotations independently (#2660) #4231 — fix(dispatch): guard post-claim GitHub annotations independently (#2660) #4231 (merge commit
9456d01790d7a46398fdc807dd1fb22e0c6a98ab, confirmed ancestor of main, compare statusbehind). It fixed 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 (CLOSED) by extractingannotateLaunchwith per-step guards and accumulating notes. - Current main
8e118461696624f2836657dab9083412e89a6fa6:pm-stack/dispatch/src/server.ts: lane-ledger catch PATCHeslast_errorwith the lane-assignment failure (line ~167) and pushes nothing towarnings; theannotateLaunchcall follows immediately after (lines ~182-193).pm-stack/dispatch/src/launch_annotations.ts:48-53:noteFailurebuilds the note from a fresh localfailuresarray and PATCHes{ last_error: failures.join("; ") }.pm-stack/dispatch/src/queue.ts:114-119:patchTaskissuesPATCH /rest/v1/tasks?id=eq.<id>with the fields as the body — a set, not an append.
- The shipped tests (pm-stack/dispatch/test/launch_annotations.test.ts) stub a fresh task for every case, so the pre-existing-
last_errorsequence is never exercised: both-fail accumulation is pinned only for the two annotations against each other.
Runtime verification (verification_class: runtime-gap/high-risk)
Result: reproduced.
- Commit tested:
8e118461696624f2836657dab9083412e89a6fa6(current main, detached worktree on the laptop, removed after the run). - Command:
bun test test/probe-last-error.test.tsinpm-stack/dispatch(one-off probe test replaying the exactlaunchSessionsequence — lane-ledgerpatchTasknote, then the realannotateLaunchwith a failing comment and a field-set stub queue; saved asprobe-last-error.test.tsin the review evidence, not committed). - Environment: laptop (host
amd) via the fleet laptop SSH route; the narrow probe only — no full suite, no CI changes, no application-code changes. - Result: 1 test, FAIL as predicted by the finding. Observed behavior: returned warnings were
["launch annotation failed (launch unaffected): issue comment: github comment 500"]and the task's finallast_errorwas exactly that annotation string — the earlier"lane assignment failed (launch unaffected): ledger down"note was gone.
Why it matters
last_error is the task's diagnostic record for best-effort launch steps that must never fail the launch. The lane-ledger note is operationally the more important of the two: without the lane assignment, a later completion cannot record which lane executed the task. Two independent best-effort failures in one launch are most likely exactly when the surrounding services are degraded — which is also when the record is needed most. Today the second failure silently erases the first, and because the lane failure is not surfaced in warnings either, a wait:true caller sees a launch whose only recorded problem is a GitHub annotation.
Acceptance criteria
- When a task already carries a
last_errornote (e.g. the lane-ledger failure) and an annotation then fails, the finallast_errornames both failures (or the annotation path otherwise preserves the earlier note, e.g. by appending to the existing value). - A regression test replays the sequence — pre-existing
last_erroron the task, then a failing annotation — and pins that both failures survive in the final note; the both-annotations-fail accumulation from fix(dispatch): guard post-claim GitHub annotations independently (#2660) #4231 keeps passing. - No behavior change to the launch itself: annotations and the lane ledger stay best-effort, the launch is never rejected for either failure, and the wait:true
warningsresponse shape is unchanged (adding the lane failure towarningsas well is acceptable but not required).
Found by pr-diff-review lane B reviewing PR #4231 against current main. Dedupe: issue searches (last_error annotation lane, launch annotation, annotateLaunch) returned only #2660 (closed — the parent issue #4231 fixed) and unrelated items; no open or closed issue covers the cross-step last_error overwrite.
Activity
developing-today commentedon Nov 14, 2026
CODE-3540
dezren39 commentedon Nov 14, 2026
agent-note:v1
Agent: pr-diff-review-b
State: filed
Repo: developing-today/code
Source PR: #4231 (#4231, merged 9456d01); closes #2660 (CLOSED)
Finding: PR #4231's annotateLaunch accumulates failure notes only within itself (pm-stack/dispatch/src/launch_annotations.ts:48-53 on main); in launchSession the lane-ledger catch PATCHes the task's last_error first (pm-stack/dispatch/src/server.ts ~:167), and patchTask is a PostgREST field-set PATCH (src/queue.ts:114), so an annotation failure in the same launch overwrites the lane-ledger failure note — and the lane failure is never added to the response warnings either.
Verified against main: 8e11846 (contents reads of server.ts, launch_annotations.ts, queue.ts on main; PR #4231 merge confirmed ancestor of main, compare behind). Runtime verification (runtime-gap/high-risk): REPRODUCED on the laptop at 8e11846 — bun test test/probe-last-error.test.ts, 1 test FAIL as predicted: final last_error named only the annotation failure ("github comment 500"); the pre-seeded lane-assignment note was gone; detached worktree removed after.
Evidence: hidden_files/pr-review-b-2026-11-14-0918-code/issue-4231-lasterror-body.md + probe-last-error.test.ts + diff-4231.patch
17 remaining items
dezren39 commentedon Nov 16, 2026
Agent note — task 17494 claimed (lane code-i, openchamber scheduled lane, 2026-11-16)
State: picked up
dezren39 commentedon Nov 16, 2026
Agent note — task 17494 parked (lane code-i, openchamber scheduled lane, 2026-11-16)
State: parked — CI pending
queue/17494-10087-dispatch-lasterror, PR fix(dispatch): preserve pre-existing last_error on annotation failure (#10087) #10792 open (mergeable, only CodeRabbit reported after ~5min watch).annotateLaunchpreserves a pre-existinglast_error(lane-ledger note) by lazygetTaskread + prepend; 4 new regression tests, targeted file 9/9 green; full suite 214 pass with 2 pre-existinggithub.test.tstimeouts (proven on clean main, unrelated).Merge pull request #10792 from developing-today/queue/17494-10087-dis…
dezren39 commentedon Nov 16, 2026
agent-note:v1
state: done
task: 17494
issue: #10087
lane: code-c (Muse, repo-worker-code)
stage: done
Fixed and merged via PR #10792 (merge e6a8cd2), which another lane had already opened with this task's exact fix when this lane claimed task 17494. This lane verified it as the canonical PR instead of duplicating it: the diff touches only pm-stack/dispatch/src/launch_annotations.ts and its test — annotateLaunch now reads the task's existing last_error lazily on the first annotation failure and prepends it, so a lane-ledger note PATCHed earlier in the same launch survives; a missing reader or failed read degrades to the previous behavior, and the launch itself is never affected. 4 new regression cases cover pre-existing + failing comment, pre-existing + both failing, failed read, and no-read on the happy path (PR records bun test test/launch_annotations.test.ts: 9 pass; full suite 214 pass with 2 pre-existing github.test.ts timeouts proven identical on clean main). Codex review failed to run (usage limits, zero findings) and CodeRabbit was rate-limited; both dispositioned. This issue is closed by the merge.