Skip to content

Fix OAuth callback race in corgea login#73

Open
asadeddin wants to merge 3 commits intomainfrom
codex/investigate-authorization-waiting-issue
Open

Fix OAuth callback race in corgea login#73
asadeddin wants to merge 3 commits intomainfrom
codex/investigate-authorization-waiting-issue

Conversation

@asadeddin
Copy link
Contributor

Motivation

  • The CLI could hang on Waiting for authorization... because the local callback loop blocked on listener.accept().await and missed an authorization code written by the spawned request handler, causing the spinner to never detect completion.

Description

  • Replace the blocking accept loop in start_callback_server with a tokio::select! that interleaves listener.accept() and a short timer tick so the loop can check the shared auth_code state frequently.
  • Move the auth_code check outside the accept() path so the server returns immediately when the handler stores the code, and keep the spawned task that serves each incoming connection intact.
  • Small related cleanup/formatting adjustments in src/authorize.rs to improve readability around the callback handling logic.

Testing

  • Ran cargo test which completed successfully (no failing tests in the repo).
  • Ran cargo fmt --check which reported formatting differences (repository has broader formatting drift, so formatting was not applied as part of this bugfix).

Codex Task

@asadeddin asadeddin requested a review from Ibrahimrahhal March 4, 2026 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant