Skip to content

Expose browser-login progress phases and durable auth logging#15135

Closed
joshka-oai wants to merge 2 commits intomainfrom
joshka/browser-login-progress-observability
Closed

Expose browser-login progress phases and durable auth logging#15135
joshka-oai wants to merge 2 commits intomainfrom
joshka/browser-login-progress-observability

Conversation

@joshka-oai
Copy link
Copy Markdown
Contributor

Problem

When browser login fails, Codex has historically exposed too little of the flow to make OAuth failures
understandable. Users mostly saw a static startup line and a final generic error, while support had to infer
where the flow broke from sparse logs. That is especially painful for transport/proxy failures around token
exchange, where the OAuth mechanics are already hard to reason about.

What This Delivers

This adds a shared login progress model for the browser OAuth flow, renders a small set of user-facing CLI
milestones, and classifies failures by stage and category so the terminal output is easier to understand.
It also adds durable tracing for the same milestones and preserves more non-secret provider/token-endpoint
context in codex-login.log.

Mental Model

codex-login owns structured flow state: phase, failure phase, and failure category. The CLI consumes that
state, prints only the milestones that matter to a user, and suppresses the generic fallback error when a
structured failure was already shown. Token-exchange errors keep the useful lower-level reqwest detail, but
strip the attached URL and log a sanitized endpoint separately.

Non-Goals

This does not migrate the flow to openidconnect, replace tiny_http with axum, or wire TUI/app-server
onto the progress stream yet.

Tradeoffs

The default user-facing strings now live in the login crate with the flow vocabulary. That makes the CLI path
simple and keeps the snapshot coverage close to the state model, but it does mean LoginPhase carries one
default presentation via Display plus a separate is_user_visible() filter.

Observability

The callback path still avoids logging raw authorization codes, device codes, tokens, or raw callback query
strings. It does now log provider error_description and token-endpoint error detail, and it records startup
and completion milestones that were previously only visible through the live progress stream.

Tests

  • cargo test -p codex-login
  • cargo test -p codex-cli --lib
  • just fmt
  • cargo clippy --fix --tests --allow-dirty --allow-no-vcs -p codex-login -p codex-cli

joshka-oai and others added 2 commits March 18, 2026 19:40
Add a shared progress and failure model for browser OAuth login, with
CLI rendering for user-facing milestones and classified failures.

Split token-exchange error handling into a private type that preserves
useful transport detail without logging sensitive URL data, and cover
the rendered progress and failure text with per-message snapshots.

Co-authored-by: Codex <noreply@openai.com>
Add durable tracing for browser-login startup and completion milestones
that were previously only visible through the live progress stream.

Preserve more provider and token-endpoint failure context in logs while
still avoiding raw callback secrets, so support can diagnose failures
from codex-login.log without reproducing the flow interactively.

Co-authored-by: Codex <noreply@openai.com>
@joshka-oai joshka-oai requested a review from ccy-oai March 19, 2026 02:41
@joshka-oai
Copy link
Copy Markdown
Contributor Author

Closing for another simpler approach on this

@joshka-oai joshka-oai closed this Mar 20, 2026
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.

1 participant