Skip to content

fix(remote-control): preserve enrollment on generic websocket 404s#26741

Merged
apanasenko-oai merged 2 commits into
mainfrom
codex/preserve-enrollment-on-generic-websocket-404
Jun 6, 2026
Merged

fix(remote-control): preserve enrollment on generic websocket 404s#26741
apanasenko-oai merged 2 commits into
mainfrom
codex/preserve-enrollment-on-generic-websocket-404

Conversation

@apanasenko-oai

@apanasenko-oai apanasenko-oai commented Jun 6, 2026

Copy link
Copy Markdown
Collaborator

Why

A remote-control WebSocket handshake can receive a generic HTTP 404 when an intermediary routes the request without preserving the WebSocket upgrade. Treating every 404 as proof that the remote app server is gone clears valid enrollment and causes repeated re-enrollment, new environment and server IDs, Habitat churn, and noisy /server/enroll traffic.

What Changed

  • Clear enrollment only when a 404 JSON response explicitly contains {"detail":"Remote app server not found"}.
  • Preserve enrollment for empty, plain-text, malformed, or otherwise unrecognized 404 responses, return the transport error, and retry with the existing reconnect backoff.
  • Log the status, correlation headers (request-id or x-oai-request-id, plus cf-ray), and bounded/redacted response body for unrecognized 404s.
  • Cover both explicit missing-server re-enrollment and generic 404 enrollment preservation/reconnect behavior.

Verification

just test -p codex-app-server-transport passes all 114 tests on the rebased branch, including the targeted explicit and generic WebSocket 404 scenarios.

Related issue: N/A

@apanasenko-oai apanasenko-oai changed the title fix(remote-control): preserve enrollment on generic websocket 404 fix(remote-control): preserve enrollment on generic websocket 404s Jun 6, 2026
@apanasenko-oai apanasenko-oai marked this pull request as ready for review June 6, 2026 05:14

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

Copy link
Copy Markdown
Contributor

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: 3fa39945c7

ℹ️ 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/app-server-transport/src/transport/remote_control/websocket.rs Outdated
Comment thread codex-rs/app-server-transport/src/transport/remote_control/tests.rs Outdated
@apanasenko-oai apanasenko-oai merged commit 87b808b into main Jun 6, 2026
31 checks passed
@apanasenko-oai apanasenko-oai deleted the codex/preserve-enrollment-on-generic-websocket-404 branch June 6, 2026 05:54
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 6, 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