fix(openai-codex-auth): clear stale error fields on successful auth - #404
Draft
rita-aga wants to merge 1 commit into
Draft
fix(openai-codex-auth): clear stale error fields on successful auth#404rita-aga wants to merge 1 commit into
rita-aga wants to merge 1 commit into
Conversation
A successful device login / token refresh / already-fresh check left the prior failure's `error` and `error_message` on the OpenAICodexAuth entity, because set_success_result writes status + success fields and merges into existing state. provider_auth_gate keys off `status` (so this never blocked sessions), but the stale text misled operators diagnosing Codex auth — a clean re-login still surfaced the old `refresh_token_reused` message. Add `with_cleared_error` to blank both fields on every success/in-progress result: start_device_login, the already-fresh path, and store_tokens_and_complete. Unit test covers the helper. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Clears the stale
error/error_messagefields on theOpenAICodexAuthentity when auth succeeds (device login, token refresh, or already-fresh check).Why
set_success_resultwritesstatus+ success fields and merges into existing entity state, so a prior failure's error text persisted after a successful login.provider_auth_gatedecides offstatus(blocking set:starting/devicecodeready/polling/refreshing/disconnected/idle), so this never blocked sessions — but the lingering error misled diagnosis.Observed 2026-06-16: after a clean Codex re-login (status
Ready, fresh token, sessions callinggpt-5.5successfully), the entity still showedHTTP 401 ... "code":"refresh_token_reused", which sent an operator down the wrong path.Change
with_cleared_error(fields)— blankserror+error_message.set_success_resultsites:start_device_login, the already-fresh branch ofensure_tokens_fresh, andstore_tokens_and_complete.with_cleared_error_blanks_error_fields_and_preserves_rest.Verification
cargo test(openai-codex-auth) — 4 passed, incl. the new test.Deploy note
Cosmetic/diagnostic only; the auth gate is unaffected. Recommend shipping with the next paw-agent release rather than a standalone Genesis republish, to avoid clobbering in-flight paw-agent work.
🤖 Generated with Claude Code