Skip to content

fix(subagent): grow child-session transcript as one message instead of fragments - #114

Merged
justin-carper merged 2 commits into
mainfrom
subagent-message-polling
Aug 26, 2026
Merged

fix(subagent): grow child-session transcript as one message instead of fragments#114
justin-carper merged 2 commits into
mainfrom
subagent-message-polling

Conversation

@justin-carper

Copy link
Copy Markdown
Collaborator

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:

A critical finding concerns
the IsStaged() method.
The IsStaged() change is mandatory…

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 publishes part.updated, so live views re-render). Each flush carries the FULL cumulative transcript (replace, not append).

Also:

  • Tool activity no longer duplicates into the transcript markdown — the child session's tool parts already render it live on the subagent card
  • tool-result no longer forces a flush (was cutting paragraphs at every tool boundary)
  • finalize merges resultSuffix + conversationSteps + activity line into the single cumulative transcript instead of three extra messages
  • Falls back to the old per-flush new-message post only when the seed response has no parts or the PATCH fails (identical fallback posts deduped)

Result: child session renders as prompt + one live-updating message.

Carries the 0.9.1-next.0 pre-release bump (publishes to the next dist-tag; latest stays on 0.9.0). Revert-friendly if pre-release testing doesn't pass.

Verification: npm run typecheck clean, vitest run 621/621 pass (41 files), tsup build success.

…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.
@justin-carper
justin-carper merged commit 1f2600a into main Aug 26, 2026
8 checks passed
@justin-carper
justin-carper deleted the subagent-message-polling branch August 26, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant