fix(subagent): grow child-session transcript as one message instead of fragments - #114
Merged
Conversation
…f fragments Polling snapshots were posted as a NEW noReply user message on every flush (1.5s timer + every tool-result + up to 4 more on finalize), so a single subagent turn rendered as 5-20 fragment messages — a flowing paragraph split mid-sentence across messages. Now the seeded prompt message's text part grows in place: each flush PATCHes it via `part.update` (same endpoint the tool parts already use; opencode patches text parts in place and publishes `part.updated`, so live views re-render). Each flush carries the FULL cumulative transcript (replace, not append); identical fallback posts are deduped. Degrades to the previous per-flush new-message post only when the seed response has no parts or the PATCH fails. Tool activity drops out of the transcript markdown entirely — the child session's `tool` parts already render it live on the subagent card, so writing both duplicated it. `tool-result` no longer forces a flush, and finalize merges resultSuffix + conversationSteps + activity line into the single cumulative transcript.
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
The TUI subagent pane fragments a subagent's flowing answer into many small messages. Live activity snapshots were posted as a new noReply user message on every flush — the 1.5s timer, every tool result, plus up to four more on finalize — so one subagent turn rendered as 5–20 fragments, e.g. a paragraph split mid-sentence:
Fix
The seeded prompt message's text part now grows in place: each flush PATCHes it via
part.update(the same endpoint the child session's tool parts already use; opencode patches text parts in place and publishespart.updated, so live views re-render). Each flush carries the FULL cumulative transcript (replace, not append).Also:
toolparts already render it live on the subagent cardtool-resultno longer forces a flush (was cutting paragraphs at every tool boundary)finalizemergesresultSuffix+conversationSteps+ activity line into the single cumulative transcript instead of three extra messagesResult: child session renders as prompt + one live-updating message.
Carries the
0.9.1-next.0pre-release bump (publishes to thenextdist-tag;lateststays on 0.9.0). Revert-friendly if pre-release testing doesn't pass.Verification:
npm run typecheckclean,vitest run621/621 pass (41 files),tsupbuild success.