Skip to content

[codex-http-state] add per-surface HTTP state store#26137

Open
cooper-oai wants to merge 1 commit into
mainfrom
cooper/codex-native-http-state/1
Open

[codex-http-state] add per-surface HTTP state store#26137
cooper-oai wants to merge 1 commit into
mainfrom
cooper/codex-native-http-state/1

Conversation

@cooper-oai
Copy link
Copy Markdown
Contributor

@cooper-oai cooper-oai commented Jun 3, 2026

Why

Native Codex surfaces need cookie-like local HTTP state so a remote service can return opaque rotations without storing each user's request state server-side. This PR isolates persistence from transport, authentication, and product policy.

What changed

  • Add codex-http-state, a generic store for opaque per-surface values under ~/.codex/state/.
  • Store each surface in its own JSON file and replace files atomically.
  • Support compare-and-set rotation without a file lock. Concurrent valid writers are last-writer-wins.
  • Advance a sibling clear generation before deleting state so a late response from an earlier login epoch cannot restore cleared state.

Review guide

  • The crate intentionally knows nothing about integrity headers, ChatGPT hosts, or login flows.
  • The important invariants are atomic replacement, generation-aware clear, and well-formed JSON after concurrent writes.
  • Later PRs decide when to read, attach, rotate, and clear these values.

Stack

This is PR 1 of 7 in the native HTTP-state stack.

  1. #26137: per-surface store (this PR)
  2. #26138: app-server bridge
  3. #26139: HTTP and WebSocket transport
  4. #26140: login, refresh, logout, and remote control
  5. #26141: shared model and backend clients
  6. #26142: app-owned requests
  7. #26143: standalone CLI requests

Validation

  • just test -p codex-http-state
  • just fix -p codex-http-state
  • just bazel-lock-check

@cooper-oai
Copy link
Copy Markdown
Contributor Author

@codex review

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: f8a301c3f5

ℹ️ 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/http-state/src/lib.rs Outdated
Comment thread codex-rs/Cargo.toml
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: f8a301c3f5

ℹ️ 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/http-state/src/lib.rs
@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/1 branch from f8a301c to ebda365 Compare June 3, 2026 11:11
@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/1 branch from ebda365 to 73b27cf Compare June 3, 2026 11:12
@cooper-oai
Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. 👍

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