Repository navigation
fix(tokens): honor zero cache retention - #6236
Open
elysiopires wants to merge 1 commit into
Open
elysiopires wants to merge 1 commit into
elysiopires wants to merge 1 commit into
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
|
|
Contributor
There was a problem hiding this comment.
No issues found across 2 files
Heads up: you’re close to your flex budget. Increase your flex budget so reviews don’t pause.
View guided diff | Re-trigger cubic
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6235.
TokenCost.clean_old_caches(keep_count=0)currently keeps all files because[:-0]selects an empty slice. Select all matching-source files for zero retention; retain the existing positive-count behavior and source filtering.Added temporary-directory tests for 0, 1, and 3 retained caches, including checks that foreign-source and malformed files survive. The zero case fails before the change; the positive controls pass.
Validation:
ANONYMIZED_TELEMETRY=false BROWSER_USE_SETUP_LOGGING=false .venv/bin/python -m pytest tests/ci/test_token_cost_cache_cleanup.py tests/ci/test_openrouter_token_cost.py -q -o addopts='' --tb=short: 8 passed..venv/bin/pre-commit run --files browser_use/tokens/service.py tests/ci/test_token_cost_cache_cleanup.py: all applicable hooks passed, including Ruff and Pyright.Searched issues and open PRs for this method and pricing-cache retention; no overlapping fix found. Codex assisted with investigation, implementation, and testing; the reported checks ran locally.
Summary by cubic
Fixes
TokenCost.clean_old_caches(keep_count=0)so it removes all cached pricing files instead of keeping everything, because Python's[:-0]slice selects an empty range.Written for commit 83dcaf0. Summary will update on new commits.