Skip to content

auth: stop retrying invalid_grant refresh tokens, surface actionable 401s#312

Open
samcm wants to merge 1 commit into
masterfrom
worktree-panda-auth-reauth-handling
Open

auth: stop retrying invalid_grant refresh tokens, surface actionable 401s#312
samcm wants to merge 1 commit into
masterfrom
worktree-panda-auth-reauth-handling

Conversation

@samcm

@samcm samcm commented Jul 17, 2026

Copy link
Copy Markdown
Member

When the OAuth provider rejects a stored refresh token with invalid_grant, the credential store now marks it dead and stops calling the token endpoint, returning ErrReauthRequired until a new credential lands via panda auth login or another process's rotation. The server's proxy relay and the proxy client's query path no longer send unauthenticated requests when no token is available; they fail with a 401 telling the user to run panda auth login. The CLI attaches the same hint to any 401 from the server, which covers older servers too.

…401s

A rotating refresh token consumed by the provider mid-outage (response lost
to a connection drop) can never succeed again. The store now records the
rejected token, fails fast with ErrReauthRequired instead of calling the
token endpoint on every request, and resumes automatically when a new
credential is written (panda auth login, or another process's rotation).

Request paths that previously sent unauthenticated requests when the token
source failed (server proxy relay, proxy client query) now fail fast with
'run panda auth login' instead of relaying the proxy's opaque
'missing or invalid Authorization header' 401. The CLI also attaches a
re-auth hint to any 401, which covers older servers.
@github-actions

Copy link
Copy Markdown
Contributor

🐼 Smoke eval — 91a5ce6: ✅ 8/8 pass

📊 Interactive report — tokens p50 16,778 · tokens/solve 19,619.

Reference points: master@4e689dd 100% · v0.38.5 98%.

question result tokens tools
forky_node_coverage 16,664 8
tracoor_node_coverage 18,001 6
mainnet_block_arrival_p50 16,253 9
list_datasources 13,014 2
block_count_24h 16,279 9
missed_slots_24h 27,369 15
chartkit_default_arrival_distribution 32,484 16
storage_upload_session_scoped 16,891 8
🔭 Langfuse traces (8 runs; ⚠️ = failed)

The report walks this branch's commits against the master baseline and the most recent release. A self-contained copy is in the run's eval-smoke-* artifact.

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