feat(tui): show MCP tool calls as they run, with /lcs opt-out#12
Merged
Conversation
MCP tool calls were batched into the interrupt queue during a streaming turn and only surfaced when it flushed (often at turn end), so the LCS substrate ran as invisible background work. Two changes: A. Render immediately. on_mcp_tool_call_started/completed now flush the interrupt queue (preserving order) and handle the event at once instead of deferring it via defer_or_handle while stream_controller is active. The MCP handlers already flush the answer stream first, so inserting the cell mid-turn is coherent. B. Opt-out toggle. New show_lcs_substrate flag on ChatWidget (default true) gates McpToolCallCell creation in the started/completed handlers. /lcs toggles, /lcs hidden sets false, /lcs visible sets true (mirrors /raw). Tests: /lcs toggles and accepts hidden|visible; invalid arg reports usage. 178 slash + 13 bottom_pane tests green. Co-Authored-By: Claude <noreply@anthropic.com>
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.
MCP tool calls were batched into the interrupt queue during a streaming turn and only surfaced when it flushed (often at turn end) — the LCS substrate ran as invisible background work.
A — render immediately
on_mcp_tool_call_started/completednow flush the interrupt queue (preserving order) and handle the event at once, instead of deferring viadefer_or_handlewhilestream_controlleris active. The MCP handlers already flush the answer stream first, so inserting the cell mid-turn is coherent.B — opt-out toggle
New
show_lcs_substrateflag onChatWidget(default true) gatesMcpToolCallCellcreation in the started/completed handlers:/lcstoggles/lcs hidden→ false/lcs visible→ true (mirrors/raw)Proven
/lcstoggles and acceptshidden|visible; invalid arg reports usage. 178 slash + 13 bottom_pane tests green, codex-tui builds clean. Worth an interactive eyeball before merge — it's a visibility-behavior change.🤖 Generated with Claude Code