Skip to content

fix(analytics): replace retired model id in Anthropic token count estimator - #1868

Open
scemii wants to merge 1 commit into
oraios:mainfrom
scemii:fix/deprecated-anthropic-model
Open

fix(analytics): replace retired model id in Anthropic token count estimator#1868
scemii wants to merge 1 commit into
oraios:mainfrom
scemii:fix/deprecated-anthropic-model

Conversation

@scemii

@scemii scemii commented Aug 14, 2026

Copy link
Copy Markdown

Checklist

  • This PR follows the guidelines in CONTRIBUTING.md regarding the scope of PRs.
  • For changes that add features or fix problems, I have added an entry to CHANGELOG.md, which concisely describes the change.

What

AnthropicTokenCount requests claude-sonnet-4-20250514. Anthropic retired that model on the Claude API on 15 June 2026, so requests to it now fail. Replaced with claude-sonnet-4-6, the replacement Anthropic lists for it.

Two occurrences in src/serena/analytics.py: the __init__ default and the ANTHROPIC_CLAUDE_SONNET_4 branch of _create_estimator.

Impact

Only affects users who set token_count_estimator: ANTHROPIC_CLAUDE_SONNET_4 — the template default is CHAR_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 in serena_config.template.yml, so renaming it would break existing serena_config.yml files. 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 after
  • ruff==0.12.5 format --check src/serena/analytics.py — already formatted, before and after
  • python -m py_compile src/serena/analytics.py — OK before and after

I did not run the full suite: it needs the language servers, which I could not provision here. Nothing in test/ covers analytics.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.md entry CONTRIBUTING.md asks for. No refactoring, no other model identifiers touched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant