Repository navigation
fix(subagent): return the chain's final result and mark unstarted steps - #227
Merged
Merged
Conversation
A blocking chain returned records[0] as the tool content, so the parent model only saw the first step's output, and a failed or aborted chain still read as the first step's success. Unstarted steps were seeded as "running" and stayed that way after the chain stopped. - Chain content now carries a per-step status line plus the last step's output on success, or the stopping step's error and the last completed output on failure/abort. - Add "queued" for steps not yet dispatched (later chain steps, parallel tasks behind maxConcurrency) and "skipped" for chain steps after a stop. - Partial updates keep mode "chain" instead of flipping to "single". - TUI headings and widget counts handle queued/skipped; the chain heading no longer reads results[0]. - Background lanes treat queued records as still running. Fixes #220
This was referenced Oct 9, 2026
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.
Fixes #220
Problem
A blocking
subagentchain returnedrecords[0]as the toolcontent(execute.ts), sharing the single-mode path. The parent model only seescontent, neverdetails, so:details.results;runningand stayedrunningafter the chain stopped (in the TUI too: a ticking timer and(running...)).Partial updates also flipped
details.modefromchaintosinglemid-run.Changes
Chain stopped at step N/M (...); the chain did not complete., the stopping step's error, and the last completed output (truncated at 50k).Earlier step bodies stay in
details.resultsrather than piling into the parent's context.queued— not dispatched yet (later chain steps, parallel tasks behindmaxConcurrency); nostartedAt, so no clock. Flipped torunningwhen the step is dispatched.skipped— chain steps after a failed/aborted step.mode: "chain".queued/skipped; widget and parallel headings count them separately (skipped no longer counted as failed); chain heading readsN/N steps completed/failed at step 2/3instead ofresults[0].status.queuedrecords as still running.Single and parallel content are unchanged.
Testing
test/subagent-chain-result.test.ts(8 cases, deterministic runner): success, mid-chain failure, abort, first-step failure, queued→running ordering for chain and parallel, plus single/parallel unchanged. 4 of them fail onmain.pnpm run checkpasses.step-5-preview: successful chain, unknown-agent failure at step 2, and Esc during step 2 — parent got the expected content in each case, and the widget showed1/3 complete, 1 running, 1 queuedwhile step 2 ran.Note for consumers
StepSubagentResultRecord.statusgainsqueuedandskipped. Anything renderingdetails.results[].statusdirectly (e.g. Desktop) should handle both.