fix(mothership): parallel subagent rendering#4299
fix(mothership): parallel subagent rendering#4299icecrasher321 wants to merge 1 commit intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Updates the message-content block parser to skip rendering dispatch Reviewed by Cursor Bugbot for commit 340c154. Configure here. |
Greptile SummaryThis PR fixes a visual bug where parallel subagent lanes would appear to still be running after completion. It does so via two coordinated changes: in Confidence Score: 4/5Safe to merge — changes are narrowly scoped to the parallel subagent rendering path and introduce no regressions in the normal single-agent flow. Only P2 findings present. Both changes are logically sound: the duplicate-open-block guard in stream.ts correctly uses No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant SSE as SSE Stream
participant SL as stream.ts
participant CB as contentBlocks[]
participant UI as message-content.tsx
Note over SSE,UI: Parallel subagent scenario (A & B start together)
SSE->>SL: span.start (subagentName=A, toolCallId=A1)
SL->>CB: includes(A1)? No → push A1 to stack
SL->>CB: some(open A block)? No → push {type:subagent, content:A}
SSE->>SL: span.start (subagentName=B, toolCallId=B1)
SL->>CB: includes(B1)? No → push B1 to stack
SL->>CB: some(open B block)? No → push {type:subagent, content:B}
Note over SSE,SL: Duplicate start event for A (retry/reconnect)
SSE->>SL: span.start (subagentName=A, toolCallId=A1)
SL->>CB: includes(A1)? Yes → skip stack push
SL->>CB: some(open A block)? Yes → skip block push ✓
SSE->>SL: dispatch tool_call for A (blocks[i])
SL->>CB: push tool_call block
UI->>UI: parseBlocks() called
UI->>UI: pre-pass: lastSubagentBlockIndex = {A→idx7, B→idx8}
UI->>UI: tool_call dispatch for A at idx5 → hasSubagentBlockAfter(A,5)? Yes → skip ✓
UI->>UI: subagent block for A at idx7 → render AgentGroup(A)
UI->>UI: subagent block for B at idx8 → render AgentGroup(B)
Reviews (1): Last reviewed commit: "fix(mothership): parallel subagent rende..." | Re-trigger Greptile |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 340c154. Configure here.
| ) { | ||
| context.contentBlocks.push({ | ||
| type: 'subagent', | ||
| content: subagentName, |
There was a problem hiding this comment.
Parallel same-name subagents collapse into single block
Medium Severity
The alreadyOpen check for subagent blocks incorrectly dedupes by subagentName without considering toolCallId. This results in only one subagent block being created for parallel instances sharing a name. Consequently, the first subagent's end event prematurely closes the shared block, causing visual inconsistencies where lanes finish early and subsequent text attaches to an ended block.
Reviewed by Cursor Bugbot for commit 340c154. Configure here.


Summary
Parallel subagent rendering would sometime leave lane looking like it was still running, even though everything works correctly.
Type of Change
Testing
Tested manually
Checklist