Skip to content

feat: add run task identity primitives#19047

Open
adrian-openai wants to merge 1 commit into
mainfrom
dev/adrian/codex/hai-task-primitives
Open

feat: add run task identity primitives#19047
adrian-openai wants to merge 1 commit into
mainfrom
dev/adrian/codex/hai-task-primitives

Conversation

@adrian-openai

@adrian-openai adrian-openai commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Stack

This is PR 1 of the simplified HAI single-run-task stack:

  • #19047 Agent Identity assertion and task-registration primitives, including the shared run-task helper used by existing Agent Identity JWT auth.
  • #19049 Disabled-by-default ChatGPT auth opt-in that provisions/reuses persisted Agent Identity runtime auth and its single run task.
  • #19051 Run-scoped provider auth that uses one backend-owned task id for first-party inference and compaction requests.

#19054 collapsed out of the active stack because the simplified design no longer needs a separate background/control-plane task helper.

Summary

The simplified POC shape is one backend-owned task per Agent Identity run. This PR makes the first layer match that final shape directly instead of introducing task targets, caller-owned external task refs, or intermediate wrappers that later PRs would need to undo.

What changed:

  • keeps the AgentAssertion wire payload as agent_runtime_id, task_id, timestamp, and signature
  • exposes register_agent_task as the single task-registration helper for both existing Agent Identity JWT auth and the ChatGPT-registration path added later in the stack
  • makes task registration send only the signed registration timestamp; the backend owns the returned opaque task id
  • removes the unused target/task-kind/external-task-ref surfaces from codex-agent-identity
  • keeps Agent Identity JWT JWKS lookup separate from agent/task registration URL derivation
  • updates Agent Identity JWT auth to register one run task during auth construction and share that task across cloned auth handles

This PR intentionally does not enable ChatGPT-derived Agent Identity. That opt-in and config gate are added in the next PR.

Testing

  • just test -p codex-agent-identity

@efrazer-oai efrazer-oai force-pushed the dev/efrazer/agent-identity-env-jwt branch from c588673 to c74a2f3 Compare April 22, 2026 23:57
@adrian-openai adrian-openai force-pushed the dev/adrian/codex/hai-task-primitives branch from 3254ce5 to 0324e8a Compare April 23, 2026 01:02
@adrian-openai adrian-openai changed the title feat: add agent task identity primitives feat: add agent identity primitives and opt-in flag Apr 23, 2026
@adrian-openai adrian-openai force-pushed the dev/adrian/codex/hai-task-primitives branch from 0324e8a to 2685c9e Compare April 23, 2026 03:55
@adrian-openai adrian-openai marked this pull request as ready for review April 23, 2026 04:27
@adrian-openai adrian-openai requested a review from a team as a code owner April 23, 2026 04:27
@adrian-openai adrian-openai marked this pull request as draft April 24, 2026 00:05
@adrian-openai adrian-openai force-pushed the dev/adrian/codex/hai-task-primitives branch from 2685c9e to 55dced3 Compare April 24, 2026 02:57
@adrian-openai adrian-openai changed the title feat: add agent identity primitives and opt-in flag feat: add external task refs and opt-in flag Apr 24, 2026
@adrian-openai adrian-openai marked this pull request as ready for review April 24, 2026 06:07
@adrian-openai adrian-openai requested review from efrazer-oai, nicksteele-oai and pakrym-oai and removed request for efrazer-oai and pakrym-oai April 24, 2026 06:08

@nicksteele-oai nicksteele-oai left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This looks fine to me

@efrazer-oai efrazer-oai force-pushed the dev/efrazer/agent-identity-env-jwt branch 3 times, most recently from 8d2470f to c5d5e7c Compare April 25, 2026 01:45
Base automatically changed from dev/efrazer/agent-identity-env-jwt to main April 26, 2026 19:49
@adrian-openai adrian-openai force-pushed the dev/adrian/codex/hai-task-primitives branch 2 times, most recently from baf2618 to 110e2a4 Compare May 11, 2026 19:04

@tigrantsat-openai tigrantsat-openai left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Let's ensure full set of features + launching internally before enabling into codex.

@adrian-openai adrian-openai force-pushed the dev/adrian/codex/hai-task-primitives branch 2 times, most recently from 0e79c01 to 03963fc Compare May 18, 2026 20:40
@adrian-openai adrian-openai force-pushed the dev/adrian/codex/hai-task-primitives branch from 03963fc to 8810088 Compare May 26, 2026 19:00
@adrian-openai adrian-openai force-pushed the dev/adrian/codex/hai-task-primitives branch from 8810088 to ef4a89f Compare June 3, 2026 02:07
@adrian-openai adrian-openai force-pushed the dev/adrian/codex/hai-task-primitives branch 4 times, most recently from 1d62ce5 to f220d79 Compare June 9, 2026 21:01
Comment thread codex-rs/agent-identity/src/lib.rs Outdated
Comment thread codex-rs/agent-identity/src/lib.rs Outdated
Comment thread codex-rs/agent-identity/src/lib.rs Outdated
@adrian-openai adrian-openai force-pushed the dev/adrian/codex/hai-task-primitives branch 2 times, most recently from 134085f to d13cbcc Compare June 9, 2026 23:38
@adrian-openai adrian-openai changed the title feat: add external task refs and opt-in flag feat: add run task identity primitives Jun 9, 2026
Comment thread codex-rs/agent-identity/src/lib.rs
@adrian-openai adrian-openai force-pushed the dev/adrian/codex/hai-task-primitives branch 3 times, most recently from 7026cbc to d7289e0 Compare June 10, 2026 03:16
@adrian-openai adrian-openai force-pushed the dev/adrian/codex/hai-task-primitives branch 3 times, most recently from 2b9ca9a to 7f15c05 Compare June 10, 2026 06:05
@adrian-openai adrian-openai force-pushed the dev/adrian/codex/hai-task-primitives branch from 7f15c05 to 796f8f0 Compare June 10, 2026 21:32

pub fn agent_identity_jwks_url(chatgpt_base_url: &str) -> String {
let trimmed = chatgpt_base_url.trim_end_matches('/');
pub fn agent_identity_jwks_url(agent_identity_jwt_base_url: &str) -> String {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

i think in future this should be the standard issuer derivation (i.e. https://[agent_id].something.something/.well-known) so this doesn't have to be so specific

task_id: task_id.to_string(),
timestamp: timestamp.clone(),
signature: sign_agent_assertion_payload(key, target.task_id, &timestamp)?,
signature: sign_agent_assertion_payload(key, task_id, &timestamp)?,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In future let's remove the signature collision via JSON.stringify([ field_1, field_2, field_3 ]) or something to that effect.

) -> String {
agent_identity_authapi_url(
agent_identity_authapi_base_url,
&format!("/v1/agent/{agent_runtime_id}/task/register"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

the agent_runtime_id needs to be escaped, clamped or have other URL parts stripped

))
fn agent_identity_authapi_url(agent_identity_authapi_base_url: &str, api_path: &str) -> String {
let base_url = normalize_agent_identity_authapi_base_url(agent_identity_authapi_base_url);
format!("{base_url}{api_path}")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

would be great to do this via a proper URL construction rather than a naiive string concatenation


pub fn agent_identity_authapi_base_url_from_chatgpt_base_url(chatgpt_base_url: &str) -> String {
let mut base_url = chatgpt_base_url.trim_end_matches('/').to_string();
for suffix in [

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this seems very brittle but is probably fine for v0

break;
}
}
if matches!(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

perhaps we can build all these mappings statically? so there's no ambiguity at runtime?

@adrian-openai adrian-openai force-pushed the dev/adrian/codex/hai-task-primitives branch from 796f8f0 to d7994fd Compare June 11, 2026 00:54
@adrian-openai adrian-openai force-pushed the dev/adrian/codex/hai-task-primitives branch from d7994fd to bcf4294 Compare June 11, 2026 04:01
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.

4 participants