#4207 · Claude pooled context and fallback hints
Bug · High priority · Medium effort · providers · provider-claude-code
Issue · 2026-09-23 · Base a8ce7a39a5be2f4eedc52077cfa53cc727ac550b
PARTIALLY REPRODUCED · Root-cause confidence: medium
1. TL;DR
The local context hint returns 200,000 for the plain Opus model found in repository tests and 1,000,000 for its explicit extended variant. This repeats in a second clean checkout. Pooling supplies a custom base URL, but this investigation did not establish how a live Claude Max account changes its actual context limit. The model catalog preserves SDK-discovered extended variants; it does not synthesize variants absent from discovery. No production fix is proposed as verified.
2. Claims vs findings
| Claim | Finding |
|---|---|
| Plain Opus has a 200k local fallback | Verified by executing the exact pure helper and constants from source twice. |
| Pooling supplies a custom endpoint | Verified by source inspection; no live proxy run. |
| Pooling reduces Max account capacity | Unverified: no account-backed CLI session run. |
| Extended variants cannot be offered | Conditional: discovery preserves them when returned by the SDK. Missing variants fail server catalog validation. |
3. Environment
Darwin, Node v22.22.3; both checkouts at the commit above. No server, ports, runtime data, accounts or credentials used. Provider version not measured. Frozen install and Turbo build were attempted in both checkouts but failed before execution because the local pnpm launcher targets a missing pnpm.cjs. No dependencies were added.
4. Minimal reproduction
Save context-hint.mjs, then run against a clean checkout at the recorded commit:
git checkout --detach a8ce7a39a5be2f4eedc52077cfa53cc727ac550b node --disable-warning=ExperimentalWarning context-hint.mjs "$PWD"
This dependency-free diagnostic extracts the exact pure helper and constants, strips TypeScript annotations and evaluates them. It does not run the provider integration. Its assertion encodes the reported entitlement as a hypothesis, not a verified account entitlement.
import { readFileSync } from 'node:fs';
import { stripTypeScriptTypes } from 'node:module';
import { runInNewContext } from 'node:vm';
import assert from 'node:assert/strict';
import { join } from 'node:path';
const source = readFileSync(join(process.argv[2], 'plugins/provider-claude-code/src/sdk-extraction.ts'), 'utf8');
const constants = source.match(/const DEFAULT_CLAUDE_CONTEXT_WINDOW[\s\S]*?\n\]\);/)[0];
const fn = source.match(/export function resolveClaudeModelContextWindowHint\([\s\S]*?\n\}/)[0];
const resolve = runInNewContext(stripTypeScriptTypes(constants + '\n' + fn.replace('export ', '') + '\nresolveClaudeModelContextWindowHint;'));
const tests = readFileSync(join(process.argv[2], 'plugins/provider-claude-code/src/model-list.test.ts'), 'utf8');
const extended = tests.match(/resolvedModel: "(claude-opus-[^"]+\[1m\])"/)[1];
const plain = extended.replace('[1m]', '');
console.log(JSON.stringify({ plain: resolve(plain), extended: resolve(extended), default: resolve('default') }));
assert.equal(resolve(extended), 1000000);
assert.equal(resolve('default'), null);
assert.equal(resolve(plain), 1000000, 'plain Opus hint should equal the extended hint under the reported entitlement');
Actual output in both runs (exit 1):
{"plain":200000,"extended":1000000,"default":null}
AssertionError [ERR_ASSERTION]: plain Opus hint should equal the extended hint under the reported entitlement
+ 200000
- 1000000
5. Root cause
plugins/provider-claude-code/src/sdk-extraction.ts:382-L395 returns the default constant for plain model IDs outside the large-context allowlist. plugins/provider-claude-code/src/delta-translation.ts:1291-L1296 installs that hint in the translation state. This explains the local hint, not the remote prompt rejection.
plugins/account-pool/src/server.ts:284-L304 contributes a custom endpoint and auth token, plus a tool-search setting. The external CLI first-party detection claim was not executed or established here.
plugins/provider-claude-code/src/model-list.ts:83-L112 takes resolved model IDs from SDK discovery; apps/server/src/services/threads/thread-execution-override.ts:52-L68 rejects IDs absent from the catalog.
6. Proposed fix / next experiment
Run isolated direct and pooled sessions using a dedicated test account and the repository-pinned provider, capture discovered model IDs and reported result context capacity, then add a regression around the verified launch or discovery contract. Do not assume a universal 1M entitlement or change endpoint trust semantics based only on the local hint. No PR: the central account-dependent failure remains unverified, and relevant suites cannot run with the broken package-manager launcher.
7. Related issues
No linked open PR was returned by the issue timeline or open-PR search for 4207. Related issue claims were not used as proof.
8. Verification
The same agent created a second clean detached worktree at the recorded commit in a new temporary directory and reran the identical diagnostic against it. Both produced the same values and assertion failure. The second checkout remained clean. No ports or data directory were needed. The report is deliberately limited to partial reproduction; it does not claim independent verification or a reproduced live capacity reduction.
9. Appendix
First run · Second run. Setup commands: git fetch origin main; git checkout --detach origin/main; git worktree add --detach <temporary-checkout> a8ce7a39a5be2f4eedc52077cfa53cc727ac550b; pnpm install --frozen-lockfile --prefer-offline; pnpm exec turbo run build. The last two failed with MODULE_NOT_FOUND for the local pnpm launcher in both checkouts.
Issue content was treated as untrusted claims. No issue scripts, external links, suggested patches, credentials or live user data were used.