fix: retire context-1m-2025-08-07 beta header for Sonnet 4.0 and 4.5 - #51
Open
Ken Chau (kenotron-ms) wants to merge 2 commits into
Open
fix: retire context-1m-2025-08-07 beta header for Sonnet 4.0 and 4.5#51Ken Chau (kenotron-ms) wants to merge 2 commits into
Ken Chau (kenotron-ms) wants to merge 2 commits into
Conversation
Retiring the `context-1m-2025-08-07` beta header for Sonnet 4.0 and 4.5: - Header was deprecated by Anthropic on 2026-04-30 - Those models now hard-cap at 200k context regardless - Updated `_should_add_context_1m_beta` to only send header for Sonnet 4.6+ and unknown versions (forward-compat) - Removed `claude-3-haiku-20240307` from `_DEPRECATED_MODELS` dict (retired 2026-04-19, no longer needs a warning) - Added clarifying comment confirming interleaved-thinking guard correctly prevents deprecated header on Opus 4.6+ adaptive - Updated 6 tests in test_opus_47.py and test_fallback.py to reflect new behavior - All 410 tests pass Fixes #42 Generated with Amplifier Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
- Added enable_1m_context startup check in __init__ that fires for Sonnet/Opus <4.6 whose 1M beta was retired 2026-04-30. Warns user sessions are capped at 200k and suggests migration to 4.6+ - Moved Haiku 3 tombstone comment out of dict literal body to standalone comment above _DEPRECATED_MODELS for clarity - Added 8 new tests in TestEnable1mContextRetirementWarning covering: - warning fires for Sonnet 4.5 and Opus 4.5 - no warning for Sonnet/Opus 4.6+ - warning suppressed when enable_1m_context=False - no false positives for unknown versions Fixes microsoft-amplifier/amplifier-shared#42 Generated with Amplifier Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
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.
Summary
Closes / related to: microsoft-amplifier/amplifier-shared#42
Anthropic retired the
context-1m-2025-08-07beta header for Sonnet 4.0 (claude-sonnet-4-20250514) and Sonnet 4.5 on 2026-04-30. The header now has no effect on those models; any context exceeding the 200k standard limit returns a400 INVALID_ARGUMENT. Previously, the provider was sending this retired header for all Sonnet ≥ 4.0.Changes
amplifier_module_provider_anthropic/__init__.py_should_add_context_1m_beta: Scoped the Sonnet branch from>= (4, 0)→>= (4, 6). Header now only sent for Sonnet 4.6+ (where 1M is GA) and unknown versions (forward-compat). Opus gate was already correctly at 4.6+._DEPRECATED_MODELS: Removedclaude-3-haiku-20240307(retirement date2026-04-19is past; the model is fully retired)._should_add_interleaved_beta: Added clarifying comment confirming Opus 4.6+ adaptive thinking already prevents theinterleaved-thinking-2025-05-14header from being sent (no logic change needed).Tests (
test_opus_47.py,test_fallback.py)test_sonnet_45_gets_1m_header→test_sonnet_45_no_1m_headerand flipped assertion toFalsetest_sonnet_40_no_1m_headerforclaude-sonnet-4-20250514claude-sonnet-4-20250514(Haiku 3 removed from dict)test_sonnet_45_still_adds_context_beta_header_when_enabled→test_sonnet_45_no_longer_gets_context_beta_headerTest evidence
issue-42-validation):_should_add_context_1m_beta("claude-sonnet-4-5-20250929", ...)→False✅_should_add_context_1m_beta("claude-sonnet-4-20250514", ...)→False✅_should_add_context_1m_beta("claude-sonnet-4-6-...", ...)→True✅_DEPRECATED_MODELSno longer containsclaude-3-haiku-20240307✅Check-in note
No dependent repo changes required.
amplifier-bundle-routing-matrixshould be reviewed separately to update any routing that sends long-context workloads to Sonnet 4.5 (tracked in microsoft-amplifier/amplifier-shared#42).