Skip to content

refactor: make ExternalAuth return CodexAuth#31355

Open
lt-oai wants to merge 1 commit into
mainfrom
codex/external-auth-codex-auth-precursor
Open

refactor: make ExternalAuth return CodexAuth#31355
lt-oai wants to merge 1 commit into
mainfrom
codex/external-auth-codex-auth-precursor

Conversation

@lt-oai

@lt-oai lt-oai commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • refactor ExternalAuth to return CodexAuth directly
  • remove the parallel ExternalAuthTokens wrapper
  • preserve existing external bearer and app-server refresh behavior

This is a mechanical precursor refactor; it does not add auth capabilities or change recovery behavior.

Testing

  • cargo fmt --all
  • cargo test -q -p codex-login --lib
  • cargo test -q -p codex-app-server --test all external_auth_refreshes_on_unauthorized

@lt-oai

lt-oai commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 104087bdca

ℹ️ 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".

Comment thread codex-rs/login/src/auth/manager.rs Outdated
Comment thread codex-rs/login/src/auth/manager.rs Outdated
@lt-oai lt-oai force-pushed the codex/external-auth-codex-auth-precursor branch 3 times, most recently from 038f72f to cd99341 Compare July 7, 2026 05:39

lt-oai commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cd99341185

ℹ️ 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".

Comment thread codex-rs/login/src/auth/manager.rs Outdated
Comment thread codex-rs/login/src/auth/manager.rs Outdated
@lt-oai lt-oai force-pushed the codex/external-auth-codex-auth-precursor branch from cd99341 to bcb4958 Compare July 7, 2026 05:54

lt-oai commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bcb4958fca

ℹ️ 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".

Comment thread codex-rs/login/src/auth/manager.rs Outdated
Comment thread codex-rs/login/src/auth/manager.rs Outdated
@lt-oai lt-oai force-pushed the codex/external-auth-codex-auth-precursor branch 2 times, most recently from aa63fe0 to 739a48c Compare July 7, 2026 06:07

lt-oai commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 739a48c51b

ℹ️ 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".

Comment thread codex-rs/login/src/auth/manager.rs Outdated
Comment thread codex-rs/login/src/auth/manager.rs
Comment thread codex-rs/login/src/auth/manager.rs
@lt-oai lt-oai force-pushed the codex/external-auth-codex-auth-precursor branch from 739a48c to 2f0c001 Compare July 7, 2026 06:24

lt-oai commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2f0c0016f2

ℹ️ 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".

Comment thread codex-rs/login/src/auth/manager.rs Outdated
Comment thread codex-rs/login/src/auth/manager.rs Outdated
Comment thread codex-rs/login/src/auth/manager.rs Outdated
@lt-oai lt-oai force-pushed the codex/external-auth-codex-auth-precursor branch from 2f0c001 to 6b78fb4 Compare July 7, 2026 06:40

lt-oai commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6b78fb4e71

ℹ️ 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".

Comment thread codex-rs/login/src/auth/manager.rs
@lt-oai lt-oai force-pushed the codex/external-auth-codex-auth-precursor branch from 6b78fb4 to c226676 Compare July 7, 2026 06:52

lt-oai commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: c226676ede

ℹ️ 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".

@lt-oai lt-oai marked this pull request as ready for review July 7, 2026 07:15

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c226676ede

ℹ️ 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".

Comment thread codex-rs/login/src/auth/manager.rs Outdated
Comment thread codex-rs/login/src/auth/manager.rs Outdated
Comment thread codex-rs/login/src/auth/manager.rs Outdated
@lt-oai lt-oai force-pushed the codex/external-auth-codex-auth-precursor branch from c226676 to ac10d34 Compare July 7, 2026 07:55

lt-oai commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: ac10d34cb6

ℹ️ 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".

@lt-oai lt-oai force-pushed the codex/external-auth-codex-auth-precursor branch from ac10d34 to 1ba8f66 Compare July 7, 2026 08:35

lt-oai commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 1ba8f664b2

ℹ️ 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".

@lt-oai lt-oai force-pushed the codex/external-auth-codex-auth-precursor branch from 1ba8f66 to f28d829 Compare July 7, 2026 08:45

lt-oai commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: f28d829aa0

ℹ️ 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".

/// auth on demand via `refresh()`.
pub trait ExternalAuth: Send + Sync {
/// Indicates which top-level auth mode this external provider supplies.
fn auth_mode(&self) -> AuthMode;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can this be deleted?

return Ok(());
}
let Some(chatgpt_metadata) = refreshed.chatgpt_metadata() else {
if refreshed.api_auth_mode() != AuthMode::ChatgptAuthTokens {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

do we need this enforcement?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we make all token types work on refresh?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Okay, I've read the code a bit more and it's very confusing. We push both types of auth through the same infra (ExternalAuth) but consume it through different paths.

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.

The enforcement was because the old return type could only represent external ChatGPT tokens on this path; with CodexAuth, other variants are now representable, so the check keeps those out for now.

That split already existed: bearer auth uses resolve(), while app-server auth uses refresh() and ephemeral persistence. I kept that unchanged so the refactor only replaces ExternalAuthTokens with CodexAuth.

Let me know if we should pursue different direction!

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