Skip to content

fix: reauth stale GitHub OAuth tokens#10602

Open
s-zaizen wants to merge 1 commit intowarpdotdev:masterfrom
s-zaizen:s-zaizen/gh10053-refresh-github-auth
Open

fix: reauth stale GitHub OAuth tokens#10602
s-zaizen wants to merge 1 commit intowarpdotdev:masterfrom
s-zaizen:s-zaizen/gh10053-refresh-github-auth

Conversation

@s-zaizen
Copy link
Copy Markdown
Contributor

Description

Handles stale or invalid GitHub OAuth tokens when loading GitHub repo info. If userGithubInfo fails in the stale-token path, Warp now routes the user back through GitHub auth by requesting a fresh GitHub integration auth transaction, with a fallback to the generic GitHub connect URL.

Linked Issue

Closes #10053

  • The linked issue is labeled ready-to-spec or ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).
スクリーンショット 2026-05-10 22 32 51

Testing

  • cargo fmt

  • cargo test -p warp server::server_api::integrations::tests --lib

  • cargo test -p warp settings_view::update_environment_form::tests::test_render_repos_field_auth_required --lib

  • cargo test -p warp settings_view::update_environment_form::tests::test_render_repos_field_error_state --lib

  • cargo clippy -p warp --lib --tests -- -D warnings

  • I have manually tested my changes locally with ./script/run

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

Changelog Entries for Stable

CHANGELOG-BUG-FIX: Fixed GitHub reauthorization when a stored OAuth token is stale or revoked.

@cla-bot cla-bot Bot added the cla-signed label May 10, 2026
@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label May 10, 2026
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 10, 2026

@s-zaizen

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This PR adds client-side handling to route stale GitHub OAuth token failures through a fresh GitHub auth transaction.

Concerns

  • The new UserFacingError union variant is converted to a generic error after stale-token detection, so auth-related user-facing failures can still bypass the reauth flow.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread app/src/server/server_api/integrations.rs
Treat userGithubInfo failures from stale or invalid GitHub OAuth credentials as an auth-required state, and request a fresh GitHub integration auth transaction before falling back to the generic connect URL.
@s-zaizen s-zaizen force-pushed the s-zaizen/gh10053-refresh-github-auth branch from ee431d3 to a998edb Compare May 10, 2026 13:51
@s-zaizen
Copy link
Copy Markdown
Contributor Author

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 10, 2026

@s-zaizen

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This PR routes stale GitHub OAuth-token failures from userGithubInfo into a fresh GitHub authorization flow and updates the environment form to surface auth-required results.

Concerns

  • The refresh heuristic currently treats any missing UserGithubInfo response data as a stale GitHub credential, which can misroute unrelated GraphQL/backend failures into GitHub OAuth instead of showing an error.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

fn should_refresh_github_auth_for_user_github_info_message(message: &str) -> bool {
let message = message.to_ascii_lowercase();
let missing_user_github_info_data =
message.contains("missing response data") && message.contains("usergithubinfo");
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.

⚠️ [IMPORTANT] This branch catches every missing-data response for UserGithubInfo, including unrelated server/query errors like rate limits or internal failures, and sends users through GitHub OAuth. Require an auth-specific error term here before returning true so non-token failures remain visible as load errors.

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

Labels

cla-signed external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redirect to GitHub auth flow if token is invalid

1 participant