Skip to content

feat(app-server): migrate remote control to server tokens#24141

Open
apanasenko-oai wants to merge 3 commits into
mainfrom
codex/remote-control-server-token
Open

feat(app-server): migrate remote control to server tokens#24141
apanasenko-oai wants to merge 3 commits into
mainfrom
codex/remote-control-server-token

Conversation

@apanasenko-oai
Copy link
Copy Markdown
Collaborator

@apanasenko-oai apanasenko-oai commented May 22, 2026

Why

codex-backend now authenticates remote-control server websocket connections with short-lived server tokens instead of the user's ChatGPT access token. app-server needs to mint and refresh those server tokens without persisting them, so a restart can reconnect from durable enrollment identity while keeping the bearer token memory-only.

What Changed

Updated the remote-control transport to consume remote_control_token and expires_at from server enroll responses and added /server/refresh support for persisted enrollments or expiring cached tokens.

Websocket handshakes now send Authorization: Bearer <remote_control_token> with the existing server identity headers, and no longer send the ChatGPT bearer token or chatgpt-account-id on that websocket path.

The in-memory enrollment state now owns the ephemeral server token cache, while SQLite still persists only server_id, environment_id, and server_name. Websocket 401/403 clears only the cached token for refresh on reconnect; websocket or refresh 404 clears stale persisted enrollment and re-enrolls. Response body previews redact remote_control_token before surfacing parse errors.

Verification

Targeted remote-control transport coverage now exercises restart refresh, cached-token reconnects, websocket token invalidation, stale enrollment re-enrollment, and server-token handshake headers in codex-app-server-transport tests.

@apanasenko-oai apanasenko-oai marked this pull request as ready for review May 22, 2026 20:58
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: 4fd28a6f61

ℹ️ 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".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant