Skip to content

Accept JWT agent identity auth input#18176

Open
efrazer-oai wants to merge 1 commit intomainfrom
efrazer/codex/agent-identity-jwt
Open

Accept JWT agent identity auth input#18176
efrazer-oai wants to merge 1 commit intomainfrom
efrazer/codex/agent-identity-jwt

Conversation

@efrazer-oai
Copy link
Copy Markdown
Contributor

@efrazer-oai efrazer-oai commented Apr 16, 2026

Stack

  1. Accept JWT agent identity auth input #18176 - Accept JWT agent identity auth input
  2. Enable agent identity for tokenless startup auth #18177 - Enable agent identity for tokenless startup auth
  3. Load agent identity from CODEX_AGENT_IDENTITY #18180 - Load agent identity from CODEX_AGENT_IDENTITY

What changed

auth.json.agent_identity can now be either the existing object or a JWT string.

The JWT payload requires:

  • workspace_id
  • agent_runtime_id
  • agent_private_key

It can also include:

  • chatgpt_user_id
  • registered_at

background_task_id is not part of the JWT contract. Codex can cache that later in the stored object after task registration.

Why

Launchers can pass one predictable string for an existing registered agent identity. Codex decodes the JWT payload into the same AgentIdentityAuthRecord it already stores.

Validation

  • cd codex-rs && just fmt
  • cd codex-rs && cargo check -p codex-login -p codex-core
  • cd codex-rs && cargo test -p codex-login agent_identity
  • cd codex-rs && cargo test -p codex-core agent_identity
  • cd codex-rs && just fix -p codex-login

@efrazer-oai efrazer-oai force-pushed the efrazer/codex/agent-identity-jwt branch from cf52e2b to bf44dee Compare April 16, 2026 23:35
@efrazer-oai efrazer-oai marked this pull request as ready for review April 17, 2026 03:18
Copy link
Copy Markdown
Contributor

@adrian-openai adrian-openai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fine, although I still don't understand why we go through the trouble of signing this payload.

Comment thread codex-rs/login/src/auth/storage.rs Outdated
}

fn agent_identity_from_jwt(jwt: &str) -> std::io::Result<AgentIdentityAuthRecord> {
let claims: AgentIdentityJwtClaims = decode_jwt_payload(jwt).map_err(std::io::Error::other)?;
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.

I don't understand why we wrap these fields in a JWT.

@efrazer-oai efrazer-oai force-pushed the efrazer/codex/agent-identity-jwt branch from bf44dee to 27ac8b7 Compare April 17, 2026 19:06
@efrazer-oai efrazer-oai changed the base branch from main to dev/adrian/codex/agent-identity-background-task-more-calls April 17, 2026 19:07
@adrian-openai adrian-openai force-pushed the dev/adrian/codex/agent-identity-background-task-more-calls branch 3 times, most recently from a1d28fe to b014f14 Compare April 20, 2026 01:10
@adrian-openai adrian-openai force-pushed the dev/adrian/codex/agent-identity-background-task-more-calls branch 6 times, most recently from 8f3ed7b to 5171ebb Compare April 20, 2026 13:53
Base automatically changed from dev/adrian/codex/agent-identity-background-task-more-calls to main April 20, 2026 14:24
@efrazer-oai efrazer-oai force-pushed the efrazer/codex/agent-identity-jwt branch 2 times, most recently from bae7e87 to 6c7bf25 Compare April 20, 2026 16:58
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.

2 participants