Skip to content

refactor(codex): one identity resolver per purpose, no unused context - #237

Merged
HTExplicit merged 1 commit into
mainfrom
refactor/codex-identity-call-shape
Oct 4, 2026
Merged

HTExplicit merged 1 commit into
mainfrom
refactor/codex-identity-call-shape

Conversation

@HTExplicit

Copy link
Copy Markdown
Owner

Problem

#233 removed the native Codex runtime host and its dispatch layer. Three identity functions kept what only existed for it: an unused context parameter and a ...Context twin each. Five account-test messages still said "Codex identity policy unavailable", naming a policy that no longer exists. #233 deferred these so they would not collide with the v0.2.13 sync; that sync is merged now.

Change

  • One function per purpose, no unused context: resolveCodexOutboundIdentityForAccount (returns the identity and an error), enforceCodexIdentityHeadersForAccount, and resolveCodexIdentitySnapshot. The bodies are the former ...Context bodies.
  • Failure contract unchanged. An identity whose version cannot form a valid User-Agent still fails the send on every send path: forward, passthrough, messages, WS headers, alpha search, models manifest, token refresh, usage probe and account tests.
  • Two diagnostic readers keep ignoring that error, now explicitly, as before: the UA predictor for the sandbox tag and the identity snapshot.
  • The five account-test messages now read Codex client identity is invalid: <error>.
  • One test in codexruntime/profile drops "Policy" from its name.

No request changes what it sends or when it fails.

Verification

  • gofmt; go build ./...; go vet with no tag and with -tags unit on the touched packages;
  • targeted tests for identity resolution and enforcement, the invalid-version failure, the snapshot, the UA predictor, token refresh, the account tests (text, compact, image) and the forward/passthrough identity cases;
  • two review passes (behaviour per call site, completeness), each finding verified. The one in-scope finding, a stale test name, is fixed.

Not run: full suites, real model calls.

🤖 Generated with Claude Code

The Codex identity resolvers kept a context parameter and a "...Context"
twin from the dispatch layer removed in #233. Fold each pair into one
function: resolveCodexOutboundIdentityForAccount,
enforceCodexIdentityHeadersForAccount and resolveCodexIdentitySnapshot.
The one real failure is unchanged: an identity whose version cannot form
a valid User-Agent still fails the send. The predictor that only reads
the identity for the sandbox tag keeps ignoring that error explicitly.

The five account-test messages that named a "policy" now say what failed:
"Codex client identity is invalid: ...".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HTExplicit
HTExplicit merged commit c29da30 into main Oct 4, 2026
18 checks passed
@HTExplicit
HTExplicit deleted the refactor/codex-identity-call-shape branch October 4, 2026 05:04
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