fix(vscode): prevent duplicate reasoning with subagent inspectors - #13430
Merged
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (4 files)
Reviewed by grok-4.6 · Input: 98.2K · Output: 11.3K · Cached: 455.6K Review guidance: REVIEW.md from base branch |
marius-kilocode
enabled auto-merge
August 25, 2026 15:53
iscekic
approved these changes
Aug 25, 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.
What Problem This Solves
Assistant reasoning and response text could appear twice while a turn was still streaming in Agent Manager. The duplication disappeared when the turn finished because the final persisted
message.part.updatedevent replaced the temporary client-side text with the canonical server value.This was especially easy to misdiagnose as duplicate SSE delivery because the persisted conversation and completed transcript were correct.
Why This Change Was Made
This fixes a regression introduced by #13173, feat(vscode): add subagent inspector tabs, merged on August 18. Its nested
SessionProviderinSubagentPanel.tsxallowed the main Agent Manager transcript and an open subagent inspector to consume the same webview message object.Solid stores proxy their underlying objects instead of copying them. When both providers adopted the same incoming reasoning or text part, their stores shared the same raw part object. Each provider then processed the same valid streaming delta and mutated
part.textin place. A single" chunk"therefore changed"start"into"start chunk chunk". The original event payload was also mutated.A live backend capture recorded 494 SSE frames, including 172
message.part.deltaevents, with zero duplicate event IDs. The regression was shared client-side object ownership, not duplicate backend events, reconnects, or durable live/sync compatibility envelopes.The fix creates a shallow, provider-owned copy whenever incoming parts enter a session store, including history snapshots, initial message parts, new streamed parts, optimistic replacements, and cloud-session history. Shallow copies preserve existing nested data without copying streamed strings or dropping legitimate repeated provider output.
User Impact
Reasoning and response fragments now appear exactly once when the subagent inspector is open, including when multiple session providers process the same webview event. Final turn reconciliation, optimistic attachment replacement, session history, and completed reasoning rendering retain their existing behavior.
Evidence
"start chunk chunk"before the fix.SessionProviderinstances were mounted, dispatched one reasoning delta through the actual webview message path, and verified exactly one rendered fragment plus an unchanged original event payload.