Skip to content

Conversation

@etraut-openai
Copy link
Collaborator

@etraut-openai etraut-openai commented Oct 26, 2025

This PR does the following:

  1. Changes try_refresh_token to handle the case where the endpoint returns a response without an id_token. The OpenID spec indicates that this field is optional and clients should not assume it's present.
  2. Changes the attempt_stream_responses to propagate token refresh errors rather than silently ignoring them.
  3. Fixes a typo in a couple of error messages (unrelated to the above, but something I noticed in passing) - "reconnect" should be spelled without a hyphen.

This PR does not implement the additional suggestion from @pakrym-oai that we should sign out when receiving refresh_token_expired from the refresh endpoint. Leaving this as a follow-on because I'm undecided on whether this should be implemented in try_refresh_token or its callers.

@etraut-openai
Copy link
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ 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".

@etraut-openai etraut-openai marked this pull request as ready for review October 26, 2025 20:33
@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ 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".

Copy link
Collaborator

@pakrym-oai pakrym-oai left a comment

Choose a reason for hiding this comment

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

Approved too early.

{
let _ = manager.refresh_token().await;
manager
.refresh_token()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Will this throw for API keys? We have this in refresh_token

    pub async fn refresh_token(&self) -> Result<String, std::io::Error> {
        tracing::info!("Refreshing token");

        let token_data = self
            .get_current_token_data()
            .ok_or(std::io::Error::other("Token data is not available."))?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yep:
image

Copy link
Collaborator

Choose a reason for hiding this comment

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

We should also prefix the message.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch!

@etraut-openai etraut-openai merged commit 0c1ff1d into main Oct 27, 2025
20 checks passed
@etraut-openai etraut-openai deleted the etraut/token_refresh branch October 27, 2025 17:09
@github-actions github-actions bot locked and limited conversation to collaborators Oct 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

3 participants