Repository navigation
Prefer the more exhausted Kimi reading - #856
Conversation
When a reliable legacy counter and a ratio pool describe the same 5-hour or weekly window with resets within two seconds, use the counter if it reports strictly more usage. Drop the older zero-only rule, the monthly-pool guard, and the reliable-weekly-counters guard, matching upstream steipete#4311 (fixes steipete#4306). Equal readings keep the ratio metadata.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Summary
Port of upstream steipete#4311 (fixes steipete#4306). The Kimi usages endpoint can report the same quota window twice with different readings. In steipete#4306 a 5-hour counter showed 100/100 next to a zero 5-hour ratio, and Windows showed 0%.
New rule: a legacy counter replaces the ratio window only when it has the same duration, is reliable, resets within 2 s of the ratio reset, and shows a strictly higher percent (clamped to 0..100). Equal readings keep the ratio metadata. The zero-only check, the monthly-pool guard and the reliable-weekly guard are gone, matching upstream.
Stacked on #854 (silent test sounds); the diff collapses to one commit once #854 merges.
Tests
exhausted_legacy_counter_beats_zero_session_ratio_with_monthly_pool(fixture from Kimi: contradictory legacy/ratio response renders 100% on exhausted 5h window steipete/CodexBar#4306): session 100% with "100/100 credits", monthly Total lane 55.31%.cargo test --manifest-path rust/Cargo.toml --lib -- kimi→ 112 passed; full suite 4287 passed (worker run)-D warningsclean;cargo fmt --all -- --checkcleanWindows keeps its
N/M creditsdescription wording.Summary by CodeRabbit