Skip to content

Slash commands no longer leave a chat empty or stuck - #1489

Open
katulevskiy wants to merge 3 commits into
mainfrom
zeron/slash-command-hang
Open

katulevskiy wants to merge 3 commits into
mainfrom
zeron/slash-command-hang

Conversation

@katulevskiy

@katulevskiy katulevskiy commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Typing a slash command such as /mcp in a chat made the chat look bricked (user report).

Cause

Claude Code. The CLI answers its built-in commands itself (/mcp, /model, /config, /login, /resume, /permissions…), with no model turn. It writes a synthetic assistant message (model: "<synthetic>") and sends no stream events. The adapter only showed streamed text, so those turns ended in about half a second with no reply at all. Verified against CLI 2.1.326 with Zeron's exact flags and wire frames: lifecycle queued/started, then the synthetic assistant frame, the replay, the result and completed.

Codex. Zeron refuses the Codex commands it doesn't run (/mcp, /permissions, …). A refused command sent between turns failed steer_as_new_turn, and the runtime tore down without a Steered or a Done for that message, while the engine had already marked the chat working.

Fix

  • claude/normalize.rs: a synthetic assistant frame that streamed nothing and carries no error shows its text as the reply. A synthetic failure stays a single error part, and a streamed reply isn't repeated.
  • codex/mod.rs: the refusal check is split out of start_turn (turn_request). A refused message between turns is now its own turn: Steered, then Done { Errored } with the reason. The runtime stays up for the next message. The refusal now reads "/mcp only works in Codex's own terminal app. Here, Codex runs /compact and /review."

Both apps (zgx and GPUI) go through these adapters; no UI change.

Tests

  • claude::normalize::tests::a_local_commands_reply_is_shown and a_synthetic_failure_is_not_also_a_reply.
  • tests/claude.rs a_command_the_cli_runs_itself_shows_its_reply: a fake CLI plays the frames captured from the real /mcp.
  • tests/codex.rs a_refused_command_between_turns_ends_its_turn_and_keeps_the_runtime: one turn, then /mcp (refused, errored with the reason), then a normal message that still completes.

Both end-to-end tests fail without the fix. With it, cargo test -p zeron-harness --lib --test claude --test codex passes: 534 + 46 + 52.

Checked in a sandboxed engine and zgx app built from this branch: /mcp, /model and /login each show the CLI's answer and the chat stays idle and usable.

Screenshots

before-slash-commands
after-slash-commands


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

… or stuck

Claude Code answers its built-in commands (/mcp, /model, /config, /login,
/resume...) itself, with a synthetic assistant message that never streams.
The adapter only showed streamed text, so those turns ended with no reply.
The text of a synthetic reply is now shown; a synthetic failure stays an
error part only.

Codex refuses the commands Zeron does not run (/mcp, /permissions...). Sent
between turns, the refusal tore the runtime down with neither a Steered nor
a Done for the message, while the engine counted it as running. The refused
message is now its own turn, ended errored with the reason, and the runtime
takes the next message. The refusal says the command only works in Codex's
own terminal app.
A command Zeron does not run (/mcp...) sent while a turn runs waits in the
queue for that turn's end. The turn's end took one queued message: when it
was the refused command, its turn ended at once and the message queued
behind it waited for a turn end that never came. The queue now keeps
going until a message starts a Codex turn, and a closed mailbox with
nothing left running ends the runtime.
The streamed-text mark now resets at each turn's end: a turn cut off
before its assistant frame no longer hides the next command's answer.
A synthetic message the CLI wraps around an API error
(is_api_error_message) and its "No response requested." placeholder are
not shown as a reply, as the CLI hides them itself (checked in 2.1.332).

A Codex steer builds its turn request once, not once to check and again
to send.

@jsgrrchg jsgrrchg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Pushed small follow-ups, a prompt queued behind a refused Codex command no longer gets stranded, streamed_text resets per turn, and API-error and "No response requested." synthetic messages don't show as replies. CI failures are unrelated; they're fixed on main by #1511.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants