From 1bd29962a5a09d2b24aeb286c969efd223f85c19 Mon Sep 17 00:00:00 2001 From: Xiangzhe Date: Sat, 22 Aug 2026 15:17:04 -0300 Subject: [PATCH] test(context): align non-hyperagent getTokenLimit assert with #8228/#11034 contract (#9985) The 'does not force 1M onto non-hyperagent providers' assertion expected windsurf's per-model 200000 pin for claude-opus-4.7-max. That premise is stale after two intentional base merges, both already on release/v3.8.50: - acc066db3f (#8228) retired windsurf as a built-in provider (replaced by devin-desktop), removing its explicit contextLength pin; - 00dfdadf93 (#11034) added effort-suffix variant resolution in getResolvedModelCapabilities: when no direct source resolves, stripKnownEffortSuffix maps claude-opus-4.7-max to its base model claude-opus-4.7 -> canonical claude-opus-4-7, whose real catalog window is 1M (cursor catalogs the same id as 'Opus 4.7 1M Max'). So the 1M now comes from the shared model catalog via legitimate base-model resolution, not from the forbidden hyperagent-default leak the test guards against. Discrimination evidence: reproduces on the pure tip with zero diff (git log -p origin/release/v3.8.50 on both source and test); the test file itself was untouched since d54a659804 while both source merges landed later. The bluesminds/claude-opus-4-5 -> 200000 assertion is unchanged and still guards the original #8496 intent: a non-hyperagent provider's own pin must win over name heuristics and sibling windows. --- tests/unit/context-manager.test.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/unit/context-manager.test.ts b/tests/unit/context-manager.test.ts index 776a3cdc25..de95d5b6f2 100644 --- a/tests/unit/context-manager.test.ts +++ b/tests/unit/context-manager.test.ts @@ -75,10 +75,15 @@ for (const modelId of HYPERAGENT_FALLBACK_MODEL_IDS) { } test("getTokenLimit: does not force 1M onto non-hyperagent providers serving the same model ids", () => { - // windsurf declares an explicit per-model contextLength of 200000 for this exact id — - // a provider-unscoped substring match on "claude-opus-4" would have clobbered it to 1M. - assert.equal(getTokenLimit("windsurf", "claude-opus-4.7-max"), 200000); - // bluesminds likewise pins its own claude-opus-4-5 entry to 200000. + // windsurf used to pin this exact id at 200000, but its built-in provider entry was + // retired (#8228 — replaced by devin-desktop). With no per-provider source left, + // #11034 resolves the effort-suffixed variant via its BASE model (`claude-opus-4.7-max` + // → `claude-opus-4.7` → canonical `claude-opus-4-7`), whose real catalog window IS 1M. + // This is a legitimate base-model resolution, not the forbidden hyperagent default leak: + // it comes from the shared model catalog, never from the hyperagent registry scope. + assert.equal(getTokenLimit("windsurf", "claude-opus-4.7-max"), 1_000_000); + // bluesminds still pins its own claude-opus-4-5 entry to 200000, and that pin must win + // over both the name heuristic and any 1M window from sibling providers/catalogs. assert.equal(getTokenLimit("bluesminds", "claude-opus-4-5"), 200000); });