You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the orchestrator runs a multi-agent workflow, every sub-agent's full output (tool calls, thinking blocks, intermediate transcript, final answer) gets concatenated into the parent's context. With 5–10 sub-agents, the parent turn balloons fast — slow API requests, mid-turn compaction churn, and a UI that looks frozen because each round-trip is huge. This is structural, not lock contention; it happens even if #510 fixes the freeze.
Pairs with #510 — both make multi-agent workflows feel broken, for different reasons.
Two structural fixes
1. Summarize sub-agent results at the boundary
When a sub-agent finishes, the parent currently receives the raw agent_result payload — full transcript, every tool call, every thinking block. Replace with a structured summary:
Final answer / deliverable (verbatim).
A short narrative of what the sub-agent did, not the raw transcript.
File paths touched + what changed (one line each).
This is the same pattern compaction.rs uses for the parent's own history — apply it at the sub-agent boundary.
2. Don't keep agent-card progress in the model's context
The Agents sidebar / agent_card widget is for the user. It shouldn't flow into the model's context as a running history. Right now (verify) each agent state change ends up in the orchestrator's transcript window. With 5 agents transitioning through pending → running → step N/100 → completed, that's hundreds of low-information lines.
Keep progress events in the UI/event stream only. The model gets one event per terminal transition with the summary from (1).
Likely areas
crates/tui/src/tools/subagent/mod.rs — sub-agent result payload constructor.
Wherever the result tool returns its payload.
runtime_threads.rs / runtime_api.rs — split the UI-event stream from the model-context stream so progress doesn't bleed in.
Summary
When the orchestrator runs a multi-agent workflow, every sub-agent's full output (tool calls, thinking blocks, intermediate transcript, final answer) gets concatenated into the parent's context. With 5–10 sub-agents, the parent turn balloons fast — slow API requests, mid-turn compaction churn, and a UI that looks frozen because each round-trip is huge. This is structural, not lock contention; it happens even if #510 fixes the freeze.
Pairs with #510 — both make multi-agent workflows feel broken, for different reasons.
Two structural fixes
1. Summarize sub-agent results at the boundary
When a sub-agent finishes, the parent currently receives the raw
agent_resultpayload — full transcript, every tool call, every thinking block. Replace with a structured summary:full_log_reftoken pointing to the spillover file (OPENCODE: Tool-output spillover file with retention #422) so the parent can request the full log on demand.This is the same pattern
compaction.rsuses for the parent's own history — apply it at the sub-agent boundary.2. Don't keep agent-card progress in the model's context
The Agents sidebar / agent_card widget is for the user. It shouldn't flow into the model's context as a running history. Right now (verify) each agent state change ends up in the orchestrator's transcript window. With 5 agents transitioning through
pending → running → step N/100 → completed, that's hundreds of low-information lines.Keep progress events in the UI/event stream only. The model gets one event per terminal transition with the summary from (1).
Likely areas
crates/tui/src/tools/subagent/mod.rs— sub-agent result payload constructor.runtime_threads.rs/runtime_api.rs— split the UI-event stream from the model-context stream so progress doesn't bleed in.compaction.rs— possibly extend with a sub-agent-specific compaction template (matches the spirit of OPENCODE: Compaction template - structured Markdown #429).Related
full_log_reftarget.