Skip to content

Fall back to cached Claude CLI result on probe timeout - #904

Merged
Finesssee merged 3 commits into
mainfrom
fix/claude-cli-timeout-cache
Oct 16, 2026
Merged

Finesssee merged 3 commits into
mainfrom
fix/claude-cli-timeout-cache

Conversation

@Finesssee

Copy link
Copy Markdown
Collaborator

Summary

In Auto mode, a Claude CLI probe timeout now falls back to the retained CLI result from the last 15 minutes, the same way other CLI failures already did. Before this, record_auto_source propagated the timeout immediately as a transport failure, so the stale-cache fallback at the end of fetch_via_auto was never reached.

  • stale_cli_result_on_probe_timeout: when the CLI leg returns a transport-class error (the CLI probe has no network leg, so this is a probe timeout), return the retained CLI result if one is still within its TTL. With no retained result, the timeout propagates as before.
  • live_auto_success: a live OAuth or Web success in Auto mode clears the retained CLI result. Without this, a later CLI timeout could serve usage older than what the user already saw from OAuth or Web.
  • Unchanged: the Admin API path, the revoked or rate-limited OAuth cache path (which only runs when OAuth failed, so it never meets the new clear on one refresh), CLI success caching, and the "all sources failed" fallback.

Tests

New tests in rust/src/providers/claude/mod.rs (all behind CLI_CACHE_TEST_LOCK, no real CLI, OAuth, network or cookies):

  • cli_probe_timeout_returns_stale_cached_cli_result
  • cli_probe_timeout_without_cache_still_propagates
  • cli_auth_failure_skips_timeout_fallback_and_is_recorded
  • live_oauth_or_web_success_drops_retained_cli_result (OAuth and Web)
  • revoked_oauth_failure_keeps_retained_cli_result

Commands run

  • cargo fmt --all
  • cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings: pass
  • cargo clippy --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml --all-targets -- -D warnings: pass
  • cargo test --manifest-path rust/Cargo.toml claude: all new and existing timeout/cache tests pass on every run. Some runs had one failure in providers::claude::accounts::tests (a different test each time) from a Windows temp-file replace race (0x80070497); those tests pass alone, and accounts.rs is not touched here.

No UI change.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 36 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: nesszer/Win-CodexBar/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 4d9f8f61-e5b0-466b-848e-472d19bcafc6
📥 Commits

Reviewing files that changed from the base of the PR and between 8eb1c4a and 646acad.

📒 Files selected for processing: 2
  • CHANGELOG.md
  • rust/src/providers/claude/mod.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Finesssee
Finesssee merged commit b05e426 into main Oct 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant