← Back to PRs

#10831: fix(agents): set Opus 4.6 context window to 1M in forward-compat fallback

by slawt open 2026-02-07 02:32 View on GitHub →
agents stale
## Problem The `resolveAnthropicOpus46ForwardCompatModel` function (added in #10720 / commit 0daf416) clones Opus 4.5's model definition as a forward-compat fallback for Opus 4.6. However, it inherits Opus 4.5's 200K context window. Opus 4.6 supports a **1M token context window** and **128K max output tokens**. Users relying on the forward-compat path (when pi-ai's built-in catalog hasn't been updated yet) silently get 200K instead of 1M. ## Fix - Add `ANTHROPIC_OPUS_46_CONTEXT_WINDOW` (1,000,000) and `ANTHROPIC_OPUS_46_MAX_TOKENS` (128,000) constants - Override the cloned template's `contextWindow` and `maxTokens` in the forward-compat fallback path - Update existing test to verify correct context window and max tokens values - Add test for dot notation variant (`claude-opus-4.6`) ## Notes - Does **not** change `DEFAULT_CONTEXT_TOKENS` (200K) since that's a cross-provider fallback - Scoped only to the Opus 4.6 forward-compat path - Matches Anthropic's published specs for Opus 4.6 <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> - Updates the Anthropic Opus 4.6 forward-compat model resolver to override cloned Opus 4.5 limits with Opus 4.6’s published `contextWindow` (1,000,000) and `maxTokens` (128,000). - Adds constants for Opus 4.6 limits and applies them when cloning a 4.5 template in `resolveAnthropicOpus46ForwardCompatModel`. - Extends unit tests to assert the new limits and covers both dash (`claude-opus-4-6`) and dot (`claude-opus-4.6`) notation IDs. - Change is localized to the pi-embedded-runner model resolution path; other provider fallbacks remain unchanged. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with minimal risk. - The change is a small, targeted override of two numeric fields in a narrow forward-compat code path, and tests were updated/added to validate both ID variants and the new limits. No other model resolution behavior is modified. - No files require special attention <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs