Usage
Preview which accounts would be restored without making changes.
Output machine-readable JSON instead of human-friendly text.
Verify only - do not restore healthy flagged accounts.
What Are Flagged Accounts?
Accounts are moved to the flagged list when:-
Token refresh fails with hard failures:
invalid_grant- Refresh token revokedinvalid_client- OAuth client issueunauthorized_client- Authorization removed- Account deletion or email change
- Consecutive failures exceed threshold (typically 3)
- Manual flagging via dashboard (Delete → Move to Flagged)
How It Works
- Loads all flagged accounts
- Attempts token refresh for each account
- Tests access token validity
- Optionally performs live quota probe
- Restores healthy accounts back to main pool (unless
--no-restore) - Updates flagged list with verification timestamps
Example Output
Default Mode (Restore Enabled)
Dry Run Mode
Verify-Only Mode (--no-restore)
JSON Output
Restoration Criteria
An account is restored if:- Token refresh succeeds - New access token obtained
- Access token is valid - Not expired or malformed
- No active rate limits - Not currently cooling down
- Not in
--no-restoremode - Not a dry run
Exit Codes
All flagged accounts verified (restored or confirmed broken)
Verification failed (storage errors, network issues)
Examples
Verify and restore
Preview restorations
Check status without restoring
Machine-readable check
Automated recovery
Why Accounts Get Flagged
Common Reasons
- Password changed - User changed ChatGPT password
- Token revoked - Manual token revocation in ChatGPT settings
- Account deleted - ChatGPT account deleted
- OAuth app removed - User removed OAuth authorization
- Email changed - Primary email address changed
Temporary Failures (Not Flagged)
These failures do NOT flag accounts:- Network timeouts
- Rate limit errors (429)
- Server errors (5xx)
- Temporary auth service outages
Restoration Impact
When an account is restored:- Moved back to main pool -
openai-codex-accounts.json - Health score reset - Starts at 100
- Cooldowns cleared - Rate limit timers reset
- Metadata updated - Email, account ID refreshed
- Flagged entry removed - Deleted from
openai-codex-flagged-accounts.json
Best Practices
Regular Verification
Run weekly to catch recovered accounts:Before Important Work
Check flagged accounts before long sessions:Dry Run First
Always preview in production:Troubleshooting
No Flagged Accounts
All Verifications Fail
Network or auth service issue:Restored Account Immediately Fails
The account may have transient issues:Storage Permission Denied
Check file permissions:Related Commands
codex auth check- Health check active accountscodex auth fix- Repair storage and accountscodex auth doctor- Full diagnostics including flagged accountscodex auth report- Include flagged accounts in reportcodex auth login- Manually restore accounts via dashboard
Storage Files
Flagged Accounts Storage
~/.codex/multi-auth/openai-codex-flagged-accounts.json
Verification Metadata
Each verification updates:lastVerified- Timestamp of last verification attemptverificationCount- Total verification attempts- Status outcome (still broken, restored, etc.)