fix(acp): emit terminal_info/_output/_exit meta for IDE terminal display#1016
Merged
fix(acp): emit terminal_info/_output/_exit meta for IDE terminal display#1016
Conversation
Follow the Zed _meta extension pattern used by Claude Code to render terminal output in the ACP thread panel. Previously, Zeph sent ToolCallContent::Terminal referencing a UUID from terminal/create. Zed's _output_task race condition caused terminal.output() to still be None when entry_view_state.sync() ran, triggering TerminalMovedToBackground and collapsing the block. Now Zeph uses tool_call_id as the display terminal ID and emits: - terminal_info in _meta on the initial ToolCall notification - terminal_output in _meta on an intermediate ToolCallUpdate - terminal_exit in _meta on the final ToolCallUpdate ToolCallContent::Terminal also references tool_call_id, which Zed looks up in its terminals map populated by terminal_info — bypassing the _output_task race entirely. The actual ACP terminal lifecycle (terminal/create, terminal/release) is unchanged.
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.
Summary
_metaextension pattern used by Claude Code for terminal output display in the ACP thread paneltool_call_idas the display terminal ID instead of the UUID fromterminal/createterminal_infoin_metaon the initialToolCallnotification (registers display terminal in Zed)terminal_outputin_metaon an intermediateToolCallUpdate(streams output to display)terminal_exitin_metaon the finalToolCallUpdate(completes terminal widget)Root Cause
Previously Zeph sent
ToolCallContent::Terminalreferencing the UUID fromterminal/create. Zed looked up this terminal in itsterminalsHashMap, but_output_task(which setsterminal.output = Some(...)) had a race condition: whenentry_view_state.sync()ran after processingtool_call_update,terminal.output()was stillNone, triggeringTerminalMovedToBackgroundand collapsing the block before output could be shown.The
_metaextension pattern avoids this entirely. Zed creates a display-only terminal viaterminal_info, populates it synchronously viaterminal_output/terminal_exitas the updates arrive, andterminal.output()isSome(...)by the timesync()runs.Test plan
loopback_tool_start_execute_sets_terminal_info, updatedloopback_tool_output_with_terminal_idto verify 2-update pattern with correct meta fieldszeph acp --stdioin Zed and execute a bash command — terminal output should appear in the Run Command block