feat: load AgentIdentity from JWT env#18904
feat: load AgentIdentity from JWT env#18904efrazer-oai wants to merge 1 commit intodev/efrazer/agent-identity-auth-callersfrom
Conversation
db51937 to
f15803b
Compare
ca0aeac to
0d52d99
Compare
There was a problem hiding this comment.
💡 Codex Review
codex/codex-rs/login/src/auth/manager.rs
Lines 1023 to 1030 in ca0aeac
The new JWT/object deserialization for auth.json.agent_identity is ineffective unless auth_mode is also set, because resolved_mode() ignores agent_identity. A JWT-only auth.json falls back to Chatgpt mode and later behaves as missing token auth, which contradicts the “paste one token into auth.json” flow introduced here.
ℹ️ 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".
f15803b to
ae57449
Compare
0d52d99 to
455f6d5
Compare
ec85840 to
d343533
Compare
455f6d5 to
fdfad31
Compare
Disagree here, we should absolutely set |
d343533 to
74c78b4
Compare
fdfad31 to
a87f5e0
Compare
74c78b4 to
ae23fca
Compare
a87f5e0 to
b7a4275
Compare
ae23fca to
bccee32
Compare
b7a4275 to
7bbbecd
Compare
bccee32 to
160793a
Compare
7bbbecd to
c305e9e
Compare
160793a to
df5a2df
Compare
c305e9e to
8afc806
Compare
df5a2df to
ed51cb2
Compare
8afc806 to
f195c46
Compare
| #[serde( | ||
| default, | ||
| skip_serializing_if = "Option::is_none", | ||
| deserialize_with = "deserialize_agent_identity" |
There was a problem hiding this comment.
why are we not storing in a consistent format?
| } | ||
|
|
||
| #[derive(Deserialize)] | ||
| struct AgentIdentityJwtClaims { |
There was a problem hiding this comment.
can this go into agent identity crate?
Summary
This PR lets programmatic AgentIdentity users paste one token into the environment or
auth.json.auth.json.agent_identitynow accepts either the normal object form or a JWT string. The JWT is decoded into the sameAgentIdentityAuthRecordused by the explicitCodexAuth::AgentIdentitymode.When env auth is enabled,
CODEX_AGENT_IDENTITYcan provide that same JWT without writing auth state to disk.CODEX_API_KEYstill wins if both env vars are set.Reference old stack: https://github.com/openai/codex/pull/17387/changes
Reference JWT/env stack: #18176
Stack
CODEX_AGENT_IDENTITYTesting
Tests: targeted Rust checks for AgentIdentity JWT/env loading and CI.