Skip to content

Stop spawning ACP/MCP servers with interactive shells#44826

Merged
Veykril merged 1 commit intozed-industries:mainfrom
xipeng-jin:issue/spawn-acp-inter-shell
Dec 15, 2025
Merged

Stop spawning ACP/MCP servers with interactive shells#44826
Veykril merged 1 commit intozed-industries:mainfrom
xipeng-jin:issue/spawn-acp-inter-shell

Conversation

@xipeng-jin
Copy link
Contributor

Summary:

  • Ensure the external agents with ACP servers start via non-interactive shells to prevent shell startup noise from corrupting JSON-RPC.
  • Apply the same tweak to MCP stdio transports so remote context servers aren’t affected by prompts or greetings.

Description:

Switch both ACP and MCP stdio launch paths to call ShellBuilder::non_interactive() before building the command. This removes -i on POSIX shells, suppressing prompt/title sequences that previously prefixed the first JSON line and caused serde_json parse failures. No functional regressions are expected: both code paths only need a shell for Windows/npm script compatibility, not for interactivity.

Release Notes:

  • Fixed external agents that hung on “Loading…” when shell startup output broke JSON-RPC initialization.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 14, 2025
@zed-industries-bot
Copy link
Contributor

Warnings
⚠️

This PR is missing release notes.

Please add a "Release Notes" section that describes the change:

Release Notes:

- Added/Fixed/Improved ...

If your change is not user-facing, you can use "N/A" for the entry:

Release Notes:

- N/A

Generated by 🚫 dangerJS against 9a180db

@xipeng-jin
Copy link
Contributor Author

I am having an issue with the nightly build with Zed. To be more specific, when I launch an external ACP agent (e.g. Codex CLI, or Opencode through extension) from the Agent panel ("+" → “New Thread…” → “Codex CLI”), the thread tab would stay stuck in “Loading…” with the Codex icon blinking indefinitely.

In the dev ACP logs we only saw the initial initialize request from Zed, followed by repeated parse errors like:
"failed to parse incoming message: expected value at line 1 column 1", even though the “Raw” log line appeared to be valid JSON. The real issue was that the agent’s stdout stream was being prefixed with invisible/non-JSON bytes produced by an interactive shell startup (e.g. fish prompt/greeting/terminal escape sequences), so the first byte of the “JSON line” wasn’t actually {. Switching terminal.shell to fish --no-config made it work, confirming the shell startup output was corrupting the newline-delimited JSON-RPC channel and preventing ACP initialization from completing.

@Veykril Veykril self-assigned this Dec 14, 2025
Copy link
Member

@Veykril Veykril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Veykril Veykril merged commit 3db2d03 into zed-industries:main Dec 15, 2025
24 checks passed
CherryWorm pushed a commit to CherryWorm/zed that referenced this pull request Dec 16, 2025
…#44826)

### Summary:
- Ensure the external agents with ACP servers start via non-interactive
shells to prevent shell startup noise from corrupting JSON-RPC.
- Apply the same tweak to MCP stdio transports so remote context servers
aren’t affected by prompts or greetings.

### Description:
Switch both ACP and MCP stdio launch paths to call
`ShellBuilder::non_interactive()` before building the command. This
removes `-i` on POSIX shells, suppressing prompt/title sequences that
previously prefixed the first JSON line and caused `serde_json` parse
failures. No functional regressions are expected: both code paths only
need a shell for Windows/npm script compatibility, not for
interactivity.

Release Notes:
- Fixed external agents that hung on “Loading…” when shell startup
output broke JSON-RPC initialization.
@xipeng-jin xipeng-jin deleted the issue/spawn-acp-inter-shell branch December 16, 2025 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants