Skip to content

Register agent identities behind use_agent_identity#15588

Closed
adrian-openai wants to merge 3 commits into
dev/adrian/codex/agent-identity-flagfrom
dev/adrian/codex/agent-identity-register-agent
Closed

Register agent identities behind use_agent_identity#15588
adrian-openai wants to merge 3 commits into
dev/adrian/codex/agent-identity-flagfrom
dev/adrian/codex/agent-identity-register-agent

Conversation

@adrian-openai

@adrian-openai adrian-openai commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Stack

Summary

  • add AgentIdentityManager and the agent-registration flow behind use_agent_identity
  • persist the registered agent identity and key material per ChatGPT workspace/account
  • keep this PR focused on long-lived identity registration only so task/assertion work can layer on top

Testing

  • stack validation was run on the top branch after the full flow landed

@adrian-openai adrian-openai force-pushed the dev/adrian/codex/agent-identity-register-agent branch from 5a580fd to e0d4f9e Compare March 24, 2026 04:16
}
}

pub(crate) async fn ensure_registered_identity(&self) -> Result<Option<StoredAgentIdentity>> {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could be a future thing, but If the agent is unable to register, shouldn't codex hang until it is capable of registering? I'd assume that an enterprise user wouldn't be able to do much with an unregistered agent.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think that's pretty reasonable. But only if the feature flag is on, of course!

@etraut-openai etraut-openai added the oai PRs contributed by OpenAI employees label Mar 24, 2026

// Start the watcher after SessionConfigured so it cannot emit earlier events.
sess.start_file_watcher_listener();
sess.start_agent_identity_registration();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We should probably try to start registration after the user has gone through the onboarding flow and/or logged in, because no credentials would be available yet for this session. In this current flow, the user would need to restart the codex client in order for the session to get the credentials and actually succeed in registering an agent.

@adrian-openai adrian-openai Mar 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We should probably try to start registration after the user has gone through the onboarding flow and/or logged in, because no credentials would be available yet for this session. In this current flow, the user would need to restart the codex client in order for the session to get the credentials and actually succeed in registering an agent.

Interesting! That's a good catch. Let me update that.


impl AgentIdentityBinding {
fn from_auth(auth: &CodexAuth, forced_workspace_id: Option<String>) -> Option<Self> {
if !auth.is_chatgpt_auth() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Does this mean that we don't support AuthTokens either?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We support only chatgpt auth, which is the auth token, right?

@nicksteele-oai nicksteele-oai Mar 24, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

My understanding is that there were two Auth flows that used tokens in codex, where one was used more directly. Looking at the current version of the auth, I'd say this is fine.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It looks like both of these flows are considered.. the same auth flow? So it's fine!

Comment thread codex-rs/core/src/agent_identity.rs Outdated
debug!(
url = %url,
status = %status,
"agent identity registration endpoint unavailable at candidate URL; trying fallback"

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 don't think it falls back

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well, it falls back to the other URL, right? Probably don't need to do that, though.

@github-actions

github-actions Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 14 days. If you plan to continue working on it, feel free to reopen or open a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

oai PRs contributed by OpenAI employees

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants