You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: clean_old_caches(keep_count=0) retains every pricing cache #6235
TokenCost.clean_old_caches(keep_count=0) leaves every pricing cache file in place. The final removal loop uses own_files[:-keep_count]; for zero that becomes own_files[:0], so it iterates over no files. Asking to keep zero caches therefore keeps all of them.
Reproduce without a browser, model, or network request:
Expected: zero matching-source cache files remain. Actual: the assertion fails.
I have a focused fix that treats zero as removal of all matching-source caches, with regression coverage for retention counts 0, 1, and 3. The tests verify that another pricing source's cache and malformed JSON are untouched. Before the fix, zero fails and the two positive counts pass. Afterward, those cases plus the existing token-cost suite pass (8 tests), and all pre-commit hooks pass.
Duplicate checks: searched issues for clean_old_caches and open PRs for cache/keep_count and pricing cache cleanup; no matching fix found. Prepared with Codex assistance and verified locally.
Activity
test(tokens): add targeted tests for clean_old_caches keep_count sema…
test(tokens): add targeted tests for clean_old_caches keep_count sema…