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 review of PR #688 (Codex auth.json publication retry): 1 finding.
|
|
Follow-up: the finding is fixed at the new head. Nothing left open. Commands run: |
Upstream loadCredentials(retryStale: true) also rereads a native credential that needs renewal, because the Codex CLI may be publishing its renewal. The usage path now repeats every failed read, including the gate's stale AuthRequired, up to three reads 50 ms apart. The last error keeps its category, so unchanged stale credentials still need the owner's renewal. The retry loop is a separate function so the tests can count reads like upstream's injected reader. The tests run on a paused clock and publish between reads, so they no longer race a writer thread: - an owner publication in progress (missing, partial, incomplete, expired, near expiry) is picked up on the second read and keeps its workspace; - retries are bounded at three reads and keep the final error category; - an unpolled or dropped load stops reading. The external-OAuth gate now loads settings only when the opt-in decides the outcome (no refresh provenance). Repeated reads no longer reload the host settings each time.
Lane B review: fixes at 4b93d3dReviewed the full diff against its base Defect: a stale credential was never reread (fixed in 4b93d3d). Upstream's usage path calls On Windows, that source is Now every failed read is repeated, up to three reads 50 ms apart, which matches upstream's Tests rewritten to be deterministic. The retry loop is now
Gate loads settings lazily. Not ported
Validation (Windows, toolchain 1.98.0)
UI proof: not applicable. The change is to backend credential reads, with no visible surface. |
Summary
CodexApi::load_credentials(rust/src/providers/codex/api.rs) now tolerates the Codex CLI publishingauth.jsonwhile we read it. A missing, unreadable, or partially published (parse failure) file is re-read up to twice, 50 ms apart, before the error is reported. The delay is an asynctokio::time::sleep, so dropping the fetch future cancels it.After the retries the error categories stay separate: missing ->
NotInstalled, unreadable ->Other, malformed/incomplete ->Parse. A stale or gated credential (AuthRequired) is not retried. Nothing is written and the credential cache TTL/mtime semantics are unchanged. The single-read logic moved unchanged intoload_credentials_once.Upstream reference
Sources/CodexBarCore/Providers/Codex/CodexProviderDescriptor.swift(CodexOAuthFetchStrategy.loadCredentials, 2 retries, 50 ms),Sources/CodexBarCore/Providers/Codex/CodexOAuth/CodexOAuthCredentials.swift,docs/codex-oauth.md.Ported / Deferred
codex-plan-change-baselinemicro PR: discarding the previous plan's quota baseline on a plan change (half (b)).needsRefreshoncodexHome). Local behavior treats an in-window external credential asAuthRequiredand this PR keeps "stale unchanged" per the audit spec. The upstreamisAvailablepath has no local counterpart. The other refactors in fix(codex): retry auth reads and reset quota baselines on plan changes steipete/CodexBar#4088 (result construction, backfill helpers,prepareCredentialsForUsagesignature) are Swift-internal and not applicable.Validation
Run with
cargo +1.98.0, E-core pinned, slot-1 target dir.cargo fmt --all: clean.cargo clippy --workspace --all-targets -- -D warnings: pass.cargo test -p codexbar credential_retry: 7 passed, 0 failed (published-after-60ms missing file, torn-then-replaced file, missing -> NotInstalled, unreadable -> Other, malformed -> Parse, stale not retried, cancellable delay).cargo test -p codexbar providers::codex: 55 passed, 0 failed.cargo test -p codexbarnot run: no shared code touched (core, settings, cost_scanner, spend_contract).port-auditscratch dir (IMPLEMENT.md, ecargo.sh) was wiped mid-run; cargo was run through an equivalent local wrapper (start /affinity FFFF0000 /belownormal).Affected areas
UI proof
Not applicable.