fix(hyperagent): default 1M context for fable/opus/sonnet - #8496
diegosouzapw merged 2 commits into
Conversation
HyperAgent Claude-family models (fable, opus, sonnet) were falling through
getTokenLimit to the generic 128k default. Agentic tool-loop prompts with
large catalogs then failed with context_length_exceeded (~137k tokens).
- defaultContextLength + per-model contextLength = 1_000_000 on hyperagent registry
- DEFAULT_LIMITS.hyperagent / ha = 1M
- Resolve hyperagent/ha (and fable/opus wire ids) before models.dev DB fallback
Verified: getTokenLimit('hyperagent','fable-latest') === 1000000; context-manager tests 30/30.
|
Thanks for chasing this down — One thing we need adjusted before merge: the new block added at the top of We tested and confirmed that the registry-only part of your change (hyperagent/index.ts + hyperagentModels.ts) is actually sufficient on its own to fix |
…ped model-name match
The step-1b branch in resolveTokenLimit() matched fable/opus/sonnet model
name substrings for ANY provider, before the models.dev DB lookup. That
collided with anthropic/claude, kiro, windsurf and bluesminds registries,
which serve the same Claude model ids (e.g. claude-opus-4.7-max,
claude-sonnet-5) with their own accurate per-model contextLength — those
were being clobbered to 1M instead of their real (often 200k) limit.
The registry-level defaultContextLength added on the hyperagent provider
entry already fixes the reported bug (getTokenLimit('hyperagent', ...) ===
1_000_000) on its own, scoped correctly by provider. Remove the redundant,
unscoped substring branch and add regression coverage for every hyperagent
fallback model id plus the cross-provider collision.
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
|
Thanks @artickc — merged into |
…pw#8496) * fix(hyperagent): default 1M context for fable/opus/sonnet HyperAgent Claude-family models (fable, opus, sonnet) were falling through getTokenLimit to the generic 128k default. Agentic tool-loop prompts with large catalogs then failed with context_length_exceeded (~137k tokens). - defaultContextLength + per-model contextLength = 1_000_000 on hyperagent registry - DEFAULT_LIMITS.hyperagent / ha = 1M - Resolve hyperagent/ha (and fable/opus wire ids) before models.dev DB fallback Verified: getTokenLimit('hyperagent','fable-latest') === 1000000; context-manager tests 30/30. * fix(sse): scope hyperagent 1M context fix to the registry, drop unscoped model-name match The step-1b branch in resolveTokenLimit() matched fable/opus/sonnet model name substrings for ANY provider, before the models.dev DB lookup. That collided with anthropic/claude, kiro, windsurf and bluesminds registries, which serve the same Claude model ids (e.g. claude-opus-4.7-max, claude-sonnet-5) with their own accurate per-model contextLength — those were being clobbered to 1M instead of their real (often 200k) limit. The registry-level defaultContextLength added on the hyperagent provider entry already fixes the reported bug (getTokenLimit('hyperagent', ...) === 1_000_000) on its own, scoped correctly by provider. Remove the redundant, unscoped substring branch and add regression coverage for every hyperagent fallback model id plus the cross-provider collision. Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> --------- Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
…pw#8496) * fix(hyperagent): default 1M context for fable/opus/sonnet HyperAgent Claude-family models (fable, opus, sonnet) were falling through getTokenLimit to the generic 128k default. Agentic tool-loop prompts with large catalogs then failed with context_length_exceeded (~137k tokens). - defaultContextLength + per-model contextLength = 1_000_000 on hyperagent registry - DEFAULT_LIMITS.hyperagent / ha = 1M - Resolve hyperagent/ha (and fable/opus wire ids) before models.dev DB fallback Verified: getTokenLimit('hyperagent','fable-latest') === 1000000; context-manager tests 30/30. * fix(sse): scope hyperagent 1M context fix to the registry, drop unscoped model-name match The step-1b branch in resolveTokenLimit() matched fable/opus/sonnet model name substrings for ANY provider, before the models.dev DB lookup. That collided with anthropic/claude, kiro, windsurf and bluesminds registries, which serve the same Claude model ids (e.g. claude-opus-4.7-max, claude-sonnet-5) with their own accurate per-model contextLength — those were being clobbered to 1M instead of their real (often 200k) limit. The registry-level defaultContextLength added on the hyperagent provider entry already fixes the reported bug (getTokenLimit('hyperagent', ...) === 1_000_000) on its own, scoped correctly by provider. Remove the redundant, unscoped substring branch and add regression coverage for every hyperagent fallback model id plus the cross-provider collision. Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> --------- Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
Summary
Follow-up related to HyperAgent (#7994 / sticky tool-loop work).
getTokenLimit('hyperagent', 'fable-latest')was falling through to the generic 128k default. Real agentic tool-loop prompts (catalog + history) easily exceed that and fail with:Claude-family agents on HyperAgent (Fable / Opus / Sonnet) should use a 1M context window by default.
Changes
hyperagentregistry:defaultContextLength: 1_000_000+ per-modelcontextLengthhyperagentModels.ts:HYPERAGENT_DEFAULT_CONTEXT_LENGTH = 1_000_000on catalog modelscontextManager.ts: resolvehyperagent/ha(and fable/opus wire ids) to 1M before models.dev DB / generic defaultTests
Risk
Low — only raises the pre-flight token budget for HyperAgent; does not change chat protocol. Env override
CONTEXT_LENGTH_HYPERAGENTstill wins if set.