fix(analytics): replace retired model id in Anthropic token count estimator - #1868
Open
scemii wants to merge 1 commit into
Open
fix(analytics): replace retired model id in Anthropic token count estimator#1868scemii wants to merge 1 commit into
scemii wants to merge 1 commit into
Conversation
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.
Checklist
CONTRIBUTING.mdregarding the scope of PRs.CHANGELOG.md, which concisely describes the change.What
AnthropicTokenCountrequestsclaude-sonnet-4-20250514. Anthropic retired that model on the Claude API on 15 June 2026, so requests to it now fail. Replaced withclaude-sonnet-4-6, the replacement Anthropic lists for it.Two occurrences in
src/serena/analytics.py: the__init__default and theANTHROPIC_CLAUDE_SONNET_4branch of_create_estimator.Impact
Only affects users who set
token_count_estimator: ANTHROPIC_CLAUDE_SONNET_4— the template default isCHAR_COUNT, so most installs are unaffected. For those who did opt in, the estimator has been calling a retired model since mid-June.On the enum name
I deliberately did not touch
RegisteredTokenCountEstimator.ANTHROPIC_CLAUDE_SONNET_4. It is a documented config value inserena_config.template.yml, so renaming it would break existingserena_config.ymlfiles. The consequence is that the name now says "Sonnet 4" while the request uses Sonnet 4.6. If you would rather rename it and migrate configs, or add an alias, happy to follow up — that felt like your call rather than something to slip into a bug fix.Verification
Clean clone, isolated environment:
ruff==0.12.5 check src/serena/analytics.py— passed before and afterruff==0.12.5 format --check src/serena/analytics.py— already formatted, before and afterpython -m py_compile src/serena/analytics.py— OK before and afterI did not run the full suite: it needs the language servers, which I could not provision here. Nothing in
test/coversanalytics.py, and the change is a constant, so I would not expect movement there — but flagging it rather than implying I ran more than I did.Scope
2 files: the fix, plus the
CHANGELOG.mdentryCONTRIBUTING.mdasks for. No refactoring, no other model identifiers touched.