Repository navigation
fix(subagent): stop background lanes from flickering and flooding the transcript - #229
Merged
Merged
Conversation
… transcript Each background lane had its own widget, republished on every streamed delta with the child's live text. The host re-inserts a widget on every set, so lanes swapped places, and wrapping text changed the block height. Progress notifications were displayed in the transcript every 15s per lane as raw <agent-notification> pseudo-XML. - Render all background lanes in one shared list widget, reusing the blocking call's SubagentListWidget: fixed spawn order, task titles instead of live text, republished only on status/token changes, and cleared once the whole batch settles. A 1s tick keeps elapsed moving while the parent is idle. - Keep background_progress notifications for the model only (display: false). - Render the remaining agent-notification events as a status line with a collapsible preview; notifications without structured details keep the host's default rendering. - Drop the token readout from settled rows in the list widget.
# Conflicts: # packages/coding-agent/src/features/subagent/rendering.ts
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
User feedback: while background subagents run, the TUI "flickers enough to hurt the eyes", and the transcript fills with
[agent-notification]blocks of raw internal data.Flicker. Each background lane had its own
aboveEditorwidget (step-agent:<id>), republished on every streamed delta with the child's live text (~ general | <last line of output>). The host deletes and re-inserts a widget on everysetWidget, so whichever lane updated last moved to the bottom: lanes kept swapping places. Long lines wrapped, so the block's height changed too. The blocking call's list widget had already been fixed for the same issues; background lanes never got the fix.Notification flood. With
subscribe: "progress", every lane sent abackground_progressnotification every 15s withdisplay: true.agent-notificationhas no message renderer, so each one showed up as a purple box of raw pseudo-XML (<agent-notification agentId="…" event="background_progress" …>step 1/1; tool write_file; turns 107, in:188830 out:46766</agent-notification>).Changes
step-agent-lanes), reusing the blocking call'sSubagentListWidgetwith the titlebackground agents:1/3 complete, 2 runningand doesn't shrink as lanes finish, then clears;background_progressstays model-only (display: false); the parent model still receives it.agent-notification: one status line plus up to 3 preview lines, with Ctrl+O to expand:details(label,agents, unescapeddetail). Messages from older sessions without them fall back to the host's default rendering.The content the model receives is unchanged.
Testing
test/subagent-background-tui.test.ts(4 cases): shared widget with stable order and no republish on text-only deltas, clearing when the batch settles; progress hidden from the transcript but still sent; notification rendering collapsed/expanded; legacy fallback. All 4 fail onmain.ExtensionAPIs gained a no-opregisterMessageRenderer.pnpm run checkpasses.step-5-previewwith 3 background lanes (subscribe: "progress"): one stable list, clock advancing while the parent was idle, no progress entries in the transcript, and three one-line completion entries at the end.Note
This PR and #227 both touch
SubagentListWidgetinrendering.ts(#227 changes the header counts; this one adds a title parameter and the settled-row metric). The changes don't overlap; whichever lands second may need a trivial rebase.