feat(claude-code): drive 1M context suffix from model contextWindow (#……17196)### What this PR doesBefore this PR: Claude Code's `[1m]` context suffix (which raises itslocal context budget to 1M before stripping the suffix from the outgoingcall) was gated on a hardcoded `api.deepseek.com` host check plus a`deepseek-v[4-9]` name regex, so only a narrow set of DeepSeek model idsever got it.After this PR: the suffix is driven by the model's declared`contextWindow` — any Anthropic-compatible model advertising `>=1,000,000` context now gets `[1m]` (covering`deepseek-chat`/`deepseek-reasoner`/`deepseek-v4-*` and customAnthropic-compatible proxies), so Claude Code budgets the real windowinstead of defaulting to 200K. The first-party Anthropic endpoint isskipped because Claude Code manages first-party model capabilitiesitself; "first-party" is decided by the **resolved host**(`api.anthropic.com`, or an unset base URL that the SDK defaults there),not by preset origin. `deepseekContext.ts` is renamed to`contextWindowSuffix.ts` with unit tests, plus routing-level tests in`agentSessionWarmup.test.ts`.Fixes #### Why we need it and why it was done in this wayThe host+regex gate was DeepSeek-specific and missed the actual 1MDeepSeek models (`deepseek-chat`/`deepseek-reasoner`), while notgeneralizing to other Anthropic-compatible backends. Keying on`contextWindow` is the model's own declaration of capacity, so thebudget follows the model.The following tradeoffs were made: the threshold is `>=` 1,000,000 (notstrictly greater) because official DeepSeek models declare exactly1,000,000; a strict `>` would exclude them.The following alternatives were considered: keeping a per-host allowlist(too narrow, needs constant maintenance); a pure `contextWindow` rulewith no first-party check (unsafe — it would force `[1m]` ontofirst-party Anthropic, second-guessing the capabilities Claude Codealready manages); and detecting first-party by preset origin(`presetProviderId === 'anthropic'`), which is wrong because it survivesa Base-URL change to a custom proxy and would wrongly exclude exactlythe 1M proxies this PR targets — hence the resolved-host check.Links to places where the discussion took place: N/A### Breaking changesNone. Behavior only broadens on the Claude Code `direct`(Anthropic-messages) branch: DeepSeek `chat`/`reasoner`/`flash` andcustom Anthropic-compatible backends with a `>= 1M` model now get 1Mbudgeting (previously only `deepseek-v4-pro`-style ids on the DeepSeekhost did). The first-party Anthropic path is unchanged.### Special notes for your reviewerFirst-party detection is host-based (`isAnthropicOfficialHost`), so anAnthropic-preset provider whose Base URL was repointed at a custom 1Mproxy is correctly treated as non-first-party and gets the suffix(covered by a new routing test). The dropped `flash` exclusion isintentional per the contextWindow-only rule — `deepseek-v4-flash`(1,048,576) now gets `[1m]`. Gateway and external-cli branches areuntouched (the suffix only ever applied on `direct`).### Checklist- [x] Branch: This PR targets the correct branch — `main` for activedevelopment, `v1` for v1 maintenance fixes- [x] PR: The PR description is expressive enough and will help futurecontributors- [x] Code: [Write code that humans canunderstand](https://en.wikiquote.org/wiki/Martin_Fowler#code-for-humans)and [Keep it simple](https://en.wikipedia.org/wiki/KISS_principle)- [x] Refactor: You have [left the code cleaner than you found it (BoyScoutRule)](https://learning.oreilly.com/library/view/97-things-every/9780596809515/ch08.html)- [x] Upgrade: Impact of this change on upgrade flows was considered andaddressed if required- [ ] Documentation: A [user-guide update](https://docs.cherry-ai.com)was considered and is present (link) or not required. Check this onlywhen the PR introduces or changes a user-facing feature or behavior.- [x] Self-review: I have reviewed my own code (e.g., via[`/gh-pr-review`](/.claude/skills/gh-pr-review/SKILL.md), `gh pr diff`,or GitHub UI) before requesting review from others### Release note```release-noteClaude Code agents now budget 1M context for any Anthropic-compatible model (including custom proxies) that declares a >= 1M context window (e.g. DeepSeek's official chat/reasoner), instead of only a fixed list of DeepSeek model ids.```---------Signed-off-by: suyao Co-authored-by: Claude Opus 4.8 (1M context)