Repository navigation
fix: advertise slash commands after the session/new and session/fork responses - #273
Conversation
There was a problem hiding this comment.
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
96c5096 to
294a2dc
Compare
42c351e to
cc57ce2
Compare
…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>
cc57ce2 to
5f6b4e6
Compare
Slash commands only worked in Zed with a leading space.
Zed creates a thread once it has the
session/newresponse, and it dropsavailable_commands_updatefor 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, andparse_slashtrims it.The dispatcher for
session/newandsession/forknow 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_responsereads the raw wire and checks the update follows the response for bothsession/newandsession/fork. It fails on the old code.cargo fmt -- --check,cargo clippy --tests -- -D warningsandcargo test --lockedpass./whoamiwithout a leading space in a fresh thread and in a forked one.First PR of a four-PR stack on
development.