Skip to content

Refactor exec-server websocket pump#23327

Merged
starr-openai merged 8 commits into
mainfrom
starr/exec-server-ws-keepalive-20260517
May 19, 2026
Merged

Refactor exec-server websocket pump#23327
starr-openai merged 8 commits into
mainfrom
starr/exec-server-ws-keepalive-20260517

Conversation

@starr-openai
Copy link
Copy Markdown
Contributor

@starr-openai starr-openai commented May 18, 2026

Why

Exec-server websocket handling had separate reader and writer tasks for the same socket. That made websocket control-frame handling asymmetric: the task reading frames could observe Ping, but the task allowed to write frames was elsewhere. This PR moves each physical websocket onto one always-running pump so the socket owner can handle application frames and websocket control frames together.

What changed

  • Refactored direct exec-server websocket connections in connection.rs to use one task that owns the websocket for outbound JSON-RPC, inbound JSON-RPC, periodic keepalive pings, and Ping -> Pong replies.
  • Refactored relay websocket handling in relay.rs the same way for both the harness-side logical connection and the multiplexed executor physical socket.
  • Preserved the existing keepalive ownership policy: outbound direct websocket clients still send periodic pings, inbound Axum accepts only reply with pongs, and relay physical websocket endpoints keep their existing periodic pings.
  • Added focused websocket pump tests for ping/pong, binary JSON-RPC, relay data, malformed relay text frames, and close/disconnect behavior.
  • Reconnect behavior is intentionally left for a follow-up.

Validation

  • Devbox Bazel focused unit target:
    • //codex-rs/exec-server:exec-server-unit-tests --test_filter='websocket_connection_|harness_connection_|multiplexed_executor_'

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8a9300e92a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/exec-server/src/relay.rs
Comment thread codex-rs/exec-server/src/connection.rs
Comment thread codex-rs/exec-server/src/relay.rs
Comment thread codex-rs/exec-server/src/connection.rs Outdated
Comment thread codex-rs/exec-server/src/relay.rs Outdated
Comment thread codex-rs/exec-server/src/connection.rs Outdated
@starr-openai starr-openai merged commit 83af3ab into main May 19, 2026
31 checks passed
@starr-openai starr-openai deleted the starr/exec-server-ws-keepalive-20260517 branch May 19, 2026 20:32
@github-actions github-actions Bot locked and limited conversation to collaborators May 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants