Repository navigation
Description
This was generated by AI during triage.
A Spec run on a private repository (2026-10-01) ended as a Failed run with its Spec PR left a draft, although the Spec review had finished: fixes committed and pushed, PR body rewritten, CI green. The cause thirdshift gave was
spec-review session ended while waiting on a background task (Run each browser test file except the one that stalled, in the foreground), which was killed
The session was not waiting on that task. It had abandoned it.
What happened
-
spec-review session. The agent ran the target repo's browser test suite. One test file in that repo hangs, so the command outlived its Bash timeout and was moved to the background. The agent tried to
killits own hung process; the auto mode classifier denied that four times ([Interfere With Workloads]). It never usedTaskStop. It finished the review, pushed, and ended its turn with the hung task and a watcher on it still running. Both were killed asclaude -pexited. -
Resume. Told to re-run the work in the foreground, the agent ran the browser test files one at a time in a single command. A second test file hangs too, so that command hit the 600s Bash timeout and was moved to the background. The agent ran the remaining files in a separate command, recorded 22 of 24 files passing in the PR body, and ended its turn saying:
One background run is still stuck inside
…BrowserTest(taskb05rbh8is). Nothing depends on it, and it will end with the session. -
thirdshift. The stuck task was killed after the last
result, so it counted as killed background work a second time, and the Run failed. The steps after the Spec review never ran: the Tickets checklist was not written back, the Spec PR was not marked ready, and it was not taken to its goal.
Why this is a bug
The prompt and the detector disagree.
- Every Session prompt ends: "Never end your turn while a background task you depend on is still running: ending the turn kills it." That permits ending the turn with a task the agent no longer depends on, which is what this agent did, and said so.
- The detector treats every task killed after the last
resultas "work the session was still waiting on". It cannot tell an abandoned task from an awaited one.
A hung command in the target repo is not rare, and the agent cannot always kill it with kill: auto mode may deny it. TaskStop works (an implement session in the same Spec run used it on the same hang and its Run landed), but it is a deferred tool the prompts never mention.
Sessions from the run, on the machine that ran it: the …-spec-review.jsonl and …-spec-review-resume.jsonl logs stamped 20261001T191722Z.
Related: #58 introduced the detection and the Resume; #180 added waiting on a task by its own id.
Activity
JacobStephens2 commentedon Oct 2, 2026
Agent Brief
Category: bug
Summary: A session that ends its turn with an abandoned background task should not fail a Run whose work is done
Current behavior:
Progress::killed_background_workreturns every background task killed after the session's lastresult, andSessions::run_to_final_messagetreats a non-empty list as work the session was waiting on: one Resume, then a hard failure,<kind> session ended while waiting on a background task (<task>), which was killed. A task the agent deliberately abandoned (a hung test run it could not kill) is indistinguishable from one it was waiting on, so a session that finished its job fails the Run. In a Spec run this skips writing the Tickets checklist, marking the Spec PR ready and delivering it.The headless paragraph that ends every Session prompt, and the Resume prompt, tell the agent not to end its turn while a task it depends on is running. Neither says what to do with a task it no longer needs, and neither names
TaskStop.Desired behavior:
Prompt. The headless paragraph tells the agent that before ending its turn it must stop every background task it no longer needs with the
TaskStoptool, by task id, and that a task still running when the turn ends is taken as work it was waiting on. The Resume prompt says the same and covers the case that led here: if the re-run hangs or is moved to the background again, stop it withTaskStopand say what could not be run, rather than leaving it running. Keep the existing guidance (foreground, raised Bash timeout, wait by task id or output file, never by process name).Detector. A first session that ends with killed background work still gets its one Resume, as now. If the Resume also ends with killed background work, the session no longer fails for that reason alone: thirdshift prints a progress line naming the killed work and carries on, so the steps that follow (PR check, marking ready, CI, mergeability) decide the Run's outcome. If the Run then fails at a later step, the cause it reports and records (stderr, the Failed run commit, the Run notification) also names the killed work, so a session that really did stop short is not reduced to a bare
no PR found(the problem #58 fixed).The same holds wherever a session's ending is judged this way, including the Architect run's review session, which reads the final message: it gets the final message of the Resume rather than an error.
A session with no session id to resume, which today fails on killed work without a Resume, behaves like a Resume that ended with killed work: warn and carry on.
Key interfaces:
HEADLESSandprompt::resume()in the prompt module: the new wording.prompts/is generated: regenerate it withUPDATE_PROMPTS=1 cargo test prompts_page, never edit it by hand.Sessions::run/Sessions::run_to_final_message: no longer return an error for killed background work after a Resume. How the killed work reaches a later failure's cause is the implementer's choice (for example, returned alongside the final message, or kept onSessions); it must not depend on the caller remembering to ask.Progress::killed_background_work: its doc comment, and theProgressdoc comment, stop claiming a task killed after the lastresultis work the session was waiting on; it is work that may have been.CONTEXT.md: the Resume entry, and any entry describing this failure, say what a second ending with killed work now means. Use the glossary's terms (Run, Resume, Failed run, Session prompt).Acceptance criteria:
TaskStopand tell the agent to stop background tasks it no longer needs before ending its turn;prompts/is regenerated and the prompts page test passesresultwas an error is unaffected: no Resume, no warningCONTEXT.mdand the doc comments match the new behaviorOut of scope: