Skip to content

fix: advertise slash commands after the session/new and session/fork responses - #273

Merged
setoelkahfi merged 1 commit into
developmentfrom
fix/zed-commands-after-session-response
Nov 17, 2026
Merged

setoelkahfi merged 1 commit into
developmentfrom
fix/zed-commands-after-session-response

Conversation

@setoelkahfi

@setoelkahfi setoelkahfi commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Slash commands only worked in Zed with a leading space.

Zed creates a thread once it has the session/new response, and it drops available_commands_update for a session id it doesn't know yet. We advertised the commands before returning the response, so Zed never got the list and rejected /whoami. A leading space got past Zed's check, and parse_slash trims it.

The dispatcher for session/new and session/fork now writes the response first, then advertises the commands. Notifications and responses share one ordered writer, so the update arrives second. Load and resume are unchanged, because the client already knows the session id there.

Test plan:

  • acp_commands_after_response reads the raw wire and checks the update follows the response for both session/new and session/fork. It fails on the old code.
  • cargo fmt -- --check, cargo clippy --tests -- -D warnings and cargo test --locked pass.
  • Still to check by hand in Zed: /whoami without a leading space in a fresh thread and in a forked one.

First PR of a four-PR stack on development.

@setoelkahfi
setoelkahfi added this pull request to stack #277 October 29, 2026 16:37
@setoelkahfi
setoelkahfi marked this pull request as ready for review October 29, 2026 16:55
@setoelkahfi
setoelkahfi requested a review from paydii October 29, 2026 16:55
@setoelkahfi setoelkahfi self-assigned this Oct 29, 2026

@sigit-code-review sigit-code-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This change ensures that the list of available slash commands is advertised to clients only after the session/new and session/fork responses are sent, fixing a bug where Zed would drop command updates sent before it knew the session id. The dispatcher now writes the response first, then advertises commands, guaranteeing correct ordering. The new test acp_commands_after_response verifies this behavior by checking the wire order for both session creation and forking. The code comments and test coverage are clear and directly address the described bug. No previous findings are present or need to be re-raised, and the test plan is thorough.


Automated review by siGit Code Review · commit 96c5096 · see the review dashboard

@setoelkahfi
setoelkahfi force-pushed the fix/zed-commands-after-session-response branch from 96c5096 to 294a2dc Compare November 7, 2026 09:32
@setoelkahfi
setoelkahfi force-pushed the fix/zed-commands-after-session-response branch 2 times, most recently from 42c351e to cc57ce2 Compare November 7, 2026 12:31
…responses

Zed creates a thread only once it has the session/new response, and it
drops available_commands_update for a session id it doesn't know yet. We
sent the command list before returning the response, so Zed never got it
and rejected /whoami unless the user typed a leading space (which
parse_slash trims).

The dispatcher now writes the response first and advertises commands
right after. Notifications and responses share one ordered writer, so the
update arrives second. Load and resume are unchanged, since the client
already knows the session id there.

The new test reads the raw wire and checks the update follows the
response for both session/new and session/fork.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@setoelkahfi
setoelkahfi force-pushed the fix/zed-commands-after-session-response branch from cc57ce2 to 5f6b4e6 Compare November 17, 2026 09:10
@setoelkahfi
setoelkahfi merged commit 12d61fb into development Nov 17, 2026
9 checks passed
@setoelkahfi
setoelkahfi deleted the fix/zed-commands-after-session-response branch November 17, 2026 17:35
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.

3 participants