Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Reviewed by Codex gpt-6-luna (xhigh); verified and validated by Claude Thermo-nuclear reviewScope: Behavior check against spec: the Auto-mode web fallback is retained; the guidance message replaces the web error only when the CLI credential is stale or rejected ( Findings:
No other valid findings. Validation (pinned Rust 1.98.0, E-cores): |
|
Fixes landed at current head 7d0742f Finding 1 (redact the CLI token in |
Summary
In Auto mode, a Kimi Code CLI credential that is stale (expired or inside the 60 s safety margin) or rejected by the server (401/403) no longer disappears silently. The web fallback still runs first. If the web fallback then has no usable session (server-rejected, none found, or Cookie Source off/manual without a token), the fetch now fails with:
Unchanged: CLI credential files stay read-only (never refreshed or rewritten), the message never contains token values, transport/parse/HTTP errors from the web fallback are still surfaced as-is, and a working web session still succeeds.
Implementation:
kimi/code_api.rs:kimi_code_cli_access_token -> Option<String>becomeskimi_code_cli_credential -> KimiCliCredential { Unavailable, Stale, Fresh(token) }so a stale credential is distinguishable from an absent one; addskimi_cli_credential_error()with the guidance text.kimi/mod.rs: Auto-mode tracks "CLI credential unusable" (stale, or fresh but rejected withAuthRequired) and maps a session-unavailable web failure to the guidance.kimi/web.rs:is_session_unavailableclassifies which web failures mean "no web session" (AuthRequired, NoCookies, or the Cookie Source Off/Manual-without-token error).Upstream reference
kimior configure an API key in Settings, while retaining web fallback and leaving rotating CLI credentials read-only (Kimi provider: CLI credential goes stale ~14 min after kimi-code CLI quits (refresh_token never used) steipete/CodexBar#4063)".Sources/CodexBarCore/Providers/Kimi/KimiAPIError.swift,Tests/CodexBarTests/KimiAPIErrorTests.swift,Tests/CodexBarTests/KimiCLICredentialLifecycleTests.swift,docs/kimi.mdatv0.69.0.codex/integrate-reviewed-ports-20260923), which modifieskimi/code_api.rsandkimi/mod.rs.Ported / Deferred
Ported: the unified guidance text, stale/rejected CLI credential handling with retained web fallback, read-only credential guarantee, 14-minute staleness of a 15-minute token (60 s margin), no token values in the message.
Deferred / not applicable:
docs/kimi.mdprose: this repo has no matching Kimi doc page; a CHANGELOG entry is added instead.kimi.api,kimi.cli,kimi.web) have no Windows counterpart (no fetch-plan pipeline); the equivalent behavior is covered by unit tests of the credential state, session classification and message.fetch_usageAuto mode: it readsSettings::load()from disk and hits the network, so it cannot be made deterministic without new test seams.Validation
Run on the pinned toolchain 1.98.0, slot-2 target dir, pinned to E-cores 16-31 at BelowNormal (see note below).
cargo +1.98.0 fmt --allandfmt --all -- --check: clean.cargo +1.98.0 clippy --workspace --all-targets -- -D warnings: pass, no warnings.cargo +1.98.0 test -p codexbar kimi -- --test-threads=4: 65 passed, 0 failed (new: stale/fresh boundary at 839/840/900 s with file bytes unchanged, missing credential is Unavailable not Stale, guidance text contents, no token value in message, web session-unavailable classification).Note:
C:\Users\FSOS\AppData\Local\Temp\port-audit\ecargo.shdisappeared mid-task (the directory was wiped by something outside this task), so cargo was run through an equivalent local stand-in:cmd /c start /affinity FFFF0000 /belownormal /wait /b cargo ....Affected areas
rust/src/providers/kimi/)UI proof
Not applicable (error text only; no UI surface changed).