Files
codex/codex-rs/cli
vishnu-oai 4c75131c9c Validate config server policy before replacing login credentials (#65066)
## Why

An explicit `codex login` can reuse a saved config server grant, leaving
users without a way to switch accounts through that command. Saving a new
grant before validating its managed configuration can also displace a
working session if the policy fetch or validation fails.

## What changed

- Start a fresh config server sign-in for explicit browser and device-code
  logins, even when a grant is already saved.
- Hold the new grant in memory while fetching and validating its managed
  configuration. Save the grant and then update the policy cache after
  validation succeeds.
- Recheck config server and proxy settings and reload local network rules
  before fetching policy. Reject logout while a config server sign-in owns
  the login lock, including during the first sign-in.

## Testing

Cover successful grant replacement and preservation of the saved grant
when authorization, policy fetch, or policy validation fails. Verify that
network restrictions can block the policy fetch and that logout detects
an in-progress first sign-in.

GitOrigin-RevId: 427a70d556f92fd96c43f6e8737371aa3651e70c
2026-12-01 19:33:48 +00:00
..
…