mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-05-07 22:28:26 +08:00
Codex provider switch and live-state reads currently stop relying on disk auth as the only recoverable source. This change keeps the existing disk-first behavior, but when ~/.codex/auth.json is absent it falls back to the current provider's stored auth so switch backfill and live reads can still succeed. The fix is threaded through provider switch backfill, the Tauri command that reads live provider settings, and startup common-config extraction. Two regression tests cover the missing-auth.json switch path and direct live-read path. Constraint: Keep current behavior unchanged when auth.json exists Rejected: Make Codex fully DB-first for auth reads | broader semantic change than needed for this bug Confidence: high Scope-risk: moderate Reversibility: clean Directive: If Codex auth source precedence changes later, update both switch-backfill and read_live_settings fallback paths together Tested: cargo test --manifest-path src-tauri/Cargo.toml; cargo test --manifest-path src-tauri/Cargo.toml --test provider_service -- --nocapture; cargo test --manifest-path src-tauri/Cargo.toml --test provider_commands -- --nocapture; cargo fmt --manifest-path src-tauri/Cargo.toml --check Not-tested: pnpm typecheck / format:check (node_modules missing in local checkout); cargo clippy --all-targets -D warnings currently fails on pre-existing unrelated warnings in commands/settings.rs, commands/misc.rs, database/backup.rs, provider.rs, proxy/response_processor.rs