Strip the sub-agent report envelope from expanded task details - #376
Merged
TheGreatAxios merged 1 commit intoAug 7, 2026
Conversation
A task tool result wraps a sub-agent's reply as `Sub-agent "desc" reported:` followed by raw `## Summary` / `## Findings` markdown headings. The collapsed one-line preview already stripped this envelope, but the expanded detail behind the arrow rendered the result text as plain lines, so the raw prefix and literal `##` markers leaked straight into the transcript. Give "task" results the same always-curated treatment tool_search catalogues already get in resultSummary, and strip the envelope and heading markers from the text that becomes the expanded body.
TheGreatAxios
merged commit Aug 7, 2026
6a79984
into
cl-4869-stale-back-to-parent-session-link-persists-in-the-main
3 checks passed
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
Stacked on #372 (CL-4869) — both tickets concern how sub-agent
activity renders in the parent transcript.
Auditing the live TUI's task/tool-row rendering against CL-4866's
outcomes:
describeToolCall's "task" case (src/tui/tool-formatter.ts)reduces a spawn's
prompt/intent/tier/maxTurns/criteria briefto just its description, and
toolCallRowuses it. Confirmed witha rendered frame below.
correct and tested (
command-display.test.ts,stream.tstruncateLine/indentBody).(
tool-rows.tscanCoalesceCall/coalesceCallRows, "a run ofidentical calls / is one row").
summarizeTaskResultPreview— which strips theSub-agent "desc" reported:/## Summaryenvelope — existed insrc/tui/tool-formatter.tswith zero callers anywhere in thecodebase. The one-line collapsed preview happened to go through it
indirectly via
summarizeToolResult, but the expanded detail behindthe arrow fell through to
bodyLines(content)on the raw text, soexpanding a task result showed the literal
Sub-agent "..." reported:prefix and
##heading markers.This PR fixes the one real gap:
resultSummaryinmcp-view.tsnowgives "task" results the same always-curated treatment
tool_searchcatalogues already get, and strips the envelope/heading markers from
the text that becomes the expanded detail.
Investigation note (CL-4869 connection)
Digging into why these fixes seemed to exist already (PR #298/#300,
superseded by merged #312) turned up something more important: #312
touched only
src/tui/app.tsxand its Ink component tree, which haszero importers anywhere in the repo —
package.jsoncarries noink/reactdependency, and the live entrypoint renders throughsrc/tui-opentui/shell.tsinstead. Those merged fixes never reachedthe shipping TUI. That's documented in #372's description. This PR's
stripTaskReportEnvelopeaddition is new, not a port of dead-treecode — the dead tree's equivalent (
mergedToolCollapsedPreview) wasunused there too.
Verification
bun run typecheckbun run test(full suite, 4040 pass / 0 fail)bun test ./src ./tests ./evals --randomize --seed 42(4040 pass / 0 fail; one earlier run on this seed showed an unrelated one-off flake in an unrelated file that did not reproduce on rerun)OpenTUI test harness:
No raw
prompt/intent/tierdump on the collapsed line, noSub-agent "..." reported:prefix, no literal##in the expandedbody.
Closes CL-4866