Orchestrator reports why a child stopped, not just that it stopped - #538
Merged
TheGreatAxios merged 4 commits intoAug 23, 2026
Conversation
Forced stops (repetition guard, stall abort, salvage caps, operator cancel) now attach a machine-readable reason to the child's terminal state. The report envelope gains a dedicated Stopped: line (e.g. 'Stopped: repetition — window "Groaning. " × 1363'), the session store records it as stopReason, and the fleet transcript row announces 'lane stopped — <reason>' instead of a bare done/cancelled.
…urned-it-cancelled-with Amp-Thread-ID: https://ampcode.com/threads/T-01a02c68-0d8d-777b-b717-81fb9a282023 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a02c68-0d8d-777b-b717-81fb9a282023 Co-authored-by: Amp <amp@ampcode.com>
…urned-it-cancelled-with
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.
Problem
When a child agent is terminated by the repetition guard, stall watchdog, salvage caps, or operator cancel, the parent only learned "it stopped" — triage required reading raw trace files.
What already existed
Most of the plumbing was in place:
forcedStopReportbuilds a full Summary/Findings/Blockers/Paths salvage envelope per stop class, the repetition path already led Findings with the looped window snippet + repeat count, andappendSubAgentParentHintsstacks per-class re-dispatch hints. The gaps were (1) no machine-readable reason field — only prose in Summary, (2) the child's terminal state (SubAgentSession) carried no reason at all for forced stops that land as status "done", and (3) the TUI's finished-lane transcript row printed a bare "done"/"cancelled".What this adds (minimal diff on top of the existing plumbing)
SubAgentReportgains an optionalstoppedfield, rendered as a dedicated first line of the envelope:Stopped: repetition — window "Groaning. " × 1363. Survives the parse/format normalization round-trip; a nested salvage report quoted under Findings cannot leak its own line as the outer reason.SubAgentSession.stopReasonrecords the reason on the child's terminal state — parsed from the report's Stopped line oncomplete(), and set tocancelled — <reason>oncancel(). The bare pre-progress cancel message to the parent now includes the recorded reason too.observeFleet) announces<lane> stopped — <reason>as an attention line instead of a silent "done" or a bare "cancelled".Tests
forcedStopReport→ parse/format round-trip.complete()captures the report's reason;cancel()records the cancel reason; clean completes stay reason-free.tsc --noEmit, build, and the full suite (5122 pass / 0 fail) are green. The repo-wideprettier --check/ eslint drift inbun run lintis pre-existing on main (the CI lint job already fails there); changed files introduce no new findings.Fixes CL-6903