Repository navigation
Port v0.60.4 OpenRouter credits fallback - #514
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe OpenRouter provider concurrently fetches credits and key data. It resolves normal and fallback usage through stable primary and secondary lanes. Tests cover quota behavior across normal, fallback, and recovered states. ChangesOpenRouter usage handling
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant fetch_usage_api
participant OpenRouterCredits
participant OpenRouterKey
participant resolve_usage
participant UsageSnapshot
fetch_usage_api->>OpenRouterCredits: request account credits
fetch_usage_api->>OpenRouterKey: request key quota
OpenRouterCredits-->>fetch_usage_api: credits result
OpenRouterKey-->>fetch_usage_api: key result
fetch_usage_api->>resolve_usage: resolve both results
alt credits succeed
resolve_usage->>UsageSnapshot: build credits usage and add quota and spend windows
else credits fail with usable quota
resolve_usage->>UsageSnapshot: build fallback usage and add spend windows
end
Merge Risk: ⚪ Minimal · up to The fallback preserves account-balance and API-key quota states without introducing an actionable current-head failure. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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 |
Thermo-nuclear code-quality reviewReviewed head ec785f9 against main using the full thermo-nuclear maintainability rubric. P2 — API-key lane composition is duplicated across recovery pathsrust/src/providers/openrouter/mod.rs:309-315 builds the fallback secondary lane and label directly, while :419-426 builds the same lane and label again in add_key_quota; resolve_usage then separately appends spend windows at :297-300. Keep API-key lane composition in one helper with an explicit account-availability state, so labels and metadata cannot drift between healthy and degraded paths. |
e9c2f57 to
7dcb601
Compare
Summary
/creditsis unavailable.API key limitand keep the account balance explicitly unavailable.Upstream reference
0cbaaea11(OpenRouter credits fallback).Validation
cargo fmt --allcargo test --manifest-path rust/Cargo.toml providers::openrouter— 19 passedcargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warningscargo test --manifest-path rust/Cargo.toml --quiet— 1,822 passed, 1 ignoredThis PR is intentionally left unmerged for review.
Summary by CodeRabbit