Repository navigation
A session that abandons a hung background task no longer fails a Run whose work is done - #305
Merged
Merged
Conversation
…n: the work may have been abandoned, so thirdshift names it and carries on, and a later failure's cause names it too; prompts tell the agent to stop tasks it no longer needs with TaskStop Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…it, a session with no id to resume covered, Sessions' doc comments covering that case too Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A session that ends its turn with a background task still running gets its one Resume, as before. If the Resume ends the same way, the task may have been abandoned rather than awaited (a hung test run the agent could not stop), so the Run no longer fails there: thirdshift names the killed work in a progress line and carries on, and the steps that follow decide the outcome.
Sessions::run(kind, prompt) start the session if background work was killed after its last result, and it has a session id Resume it, once if background work was killed again (or there was no session id to resume) - fail: "<kind> session ended while waiting on a background task (<task>), which was killed" + progress line: "<kind>: the Resume ended with a background task still running (<task>), which was killed; carrying on, …" + remember it on Sessions + return the final message (the Resume's, if there was one)So that a session that really did stop short is not reduced to a bare
no PR found, a later failure names the killed work ahead of its own cause, on stderr, in the Failed run commit and in the Run notification:No caller has to ask for that.
Sessionscan now only be had throughSessions::within, which runs the steps it is given and adds the killed work to their failure:Session prompts: the headless paragraph that ends every Session prompt, and the Resume prompt, now name
TaskStop.Also:
prompts/and the site's prompts page regenerated;CONTEXT.md's Resume entry, the README and theProgressdoc comments say a task killed after the lastresultmay have been awaited.Two things a reviewer might not expect:
{error:#}, first line), not only the outermost message. This is what lets it name both the killed work and the later failure, but it applies to every Failed run whose error carries context.Evidence
implement session ended while waiting on a background task (./mvnw test -Dtest=GamesPageTest), which was killed, with the PR check, marking ready and delivery never reached.After:
cargo testpasses in full (30 test binaries, 0 failed),cargo clippy --all-targetsis clean. New and changed tests:Unaddressed findings
Standards
run_to_final_messagerecords killed work onSessionsthrough aRefCell, rather than returning it (codebase-design: return results, not side effects). Kept: returning it would make every caller carry it to the failure, which the issue rules out ("it must not depend on the caller remembering to ask"), and the issue names "kept onSessions" as an option.Sessionskeeps each ending as a formatted string, not kind plus tasks. Kept: the same wording goes to the progress line and the cause, and nothing reads the parts back.reviewinsrc/architect.rsgrew to 7 parameters and now also concludes. Kept: the session andconcludehave to share oneSessions::withinfor a failure to conclude to name the killed work, andreviewowns the worktree and plugin directory that scope borrows.progress::step, without thewarning:prefix. Kept: the issue asks for "a progress line naming the killed work", andprogress::warnis for an error plus something to do by hand, which this is not.{error:#}insrc/failed_run.rstouches every Failed run with a context chain (possible Divergent Change). Kept, see Spec below.Spec
Merge Danger
Door: two-way
Reverting restores the old failure. No data, config or stored state changes shape.
Blast Radius: Runs
Every session of every Run, Spec run and Architect run gets the longer headless paragraph. A Run whose session leaves a task running past its Resume now goes on to the PR check and CI instead of failing: if that session had in fact stopped short while its PR was already open and green, the PR can now be marked ready, or merged in a Merge run, where before the Run failed. Failed run commit subjects get longer where the error has context.
Closes #302
🤖 Generated with Claude Code