Skip to content

Support alternative websocket API#10861

Merged
by-openai merged 6 commits intomainfrom
responses-websockets-v2
Feb 6, 2026
Merged

Support alternative websocket API#10861
by-openai merged 6 commits intomainfrom
responses-websockets-v2

Conversation

@by-openai
Copy link
Contributor

@by-openai by-openai commented Feb 6, 2026

Test plan

cargo build -p codex-cli && RUST_LOG='codex_api::endpoint::responses_websocket=trace,codex_core::client=debug,codex_core::codex=debug' \
  ./target/debug/codex \
    --enable responses_websockets_v2 \
    --profile byok \
    --full-auto

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@by-openai by-openai requested a review from pakrym-oai February 6, 2026 07:49
@etraut-openai etraut-openai added the oai PRs contributed by OpenAI employees label Feb 6, 2026
if needs_new {
let headers =
self.websocket_last_items.clear();
if let Ok(mut last_response_id) = self.websocket_last_response_id.lock() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we just assign?

client: ModelClient,
connection: Option<ApiWebSocketConnection>,
websocket_last_items: Vec<ResponseItem>,
websocket_last_response_id: Arc<std::sync::Mutex<Option<String>>>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

this feels like an overkill. ModelClientSession isn't shared across threads. Does Option work here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

looks like the callback that scans the result stream and sees the completed event doesn't have a mutable reference to the ModelClientSession -- removed the old Arc<Mutex<_>> and switched to a per-request oneshot sender/receiver, which should be lighter and also prevents stale late completions from older streams from overwriting newer state

@by-openai
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Feb 6, 2026
@by-openai by-openai force-pushed the responses-websockets-v2 branch from 88cb71f to 2c14f77 Compare February 6, 2026 20:00
@by-openai by-openai marked this pull request as ready for review February 6, 2026 20:32
@by-openai by-openai enabled auto-merge (squash) February 6, 2026 21:30
Co-authored-by: Codex

Codex changes

Co-authored-by: Codex

fix

rm unnecessary
@by-openai by-openai force-pushed the responses-websockets-v2 branch from bf01657 to 13bc164 Compare February 6, 2026 21:39
@by-openai by-openai disabled auto-merge February 6, 2026 22:09
@by-openai by-openai merged commit 1fbf5ed into main Feb 6, 2026
41 of 44 checks passed
@by-openai by-openai deleted the responses-websockets-v2 branch February 6, 2026 22:40
@github-actions github-actions bot locked and limited conversation to collaborators Feb 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

oai PRs contributed by OpenAI employees

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants