[codex] restore websocket session compatibility#300
Merged
Conversation
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.
This PR fixes a WebSocket compatibility regression introduced during the recent mission-control API cleanup.
The immediate user-facing problem was that the server started requiring
keyin request payloads and only accepted the renamedsessions.*method names, but the protocol version was not bumped and older clients were still sendingsessionKeytogether with legacy method names such assession_setLabel,sessions_send, andsession_delete. In practice that meant previously working clients could suddenly fail withINVALID_REQUESTorMETHOD_NOT_FOUNDwithout any negotiated protocol change.The root cause was that the refactor normalized the new request and response shape, but removed backward-compatible aliases at the deserialization and request-dispatch layers. At the same time,
sessions.liststill returnedsession_key, so the response format was only partially migrated to the newkeyterminology. Its filtering was also too narrow because search only matched the raw session key and ignored the visible label and preview text.This change restores compatibility by accepting
key,sessionKey, andsession_keyfor the relevant WebSocket request payloads, and by recognizing both the newsessions.*method names and the legacy method names. Responses are normalized aroundkeywhile still including legacy aliases where needed so older clients continue to work.sessions.listnow returnskey,sessionKey, andsession_key, and its search matches session key, label, and last message preview.I also cleaned up the formatting drift that was causing
cargo fmt --checkto fail on the branch.Validation:
cargo fmt --all --checkcargo clippy --all-targets -- -D warningscargo testnode scripts/generate_docs_artifacts.mjs --check --no-websitenpm --prefix web run build