fix(agents): resolve context window for proxy models with slash in ID#92709
fix(agents): resolve context window for proxy models with slash in ID#92709samson910022 wants to merge 1 commit into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 13, 2026, 10:54 AM ET / 14:54 UTC. Summary PR surface: Source +2. Total +2 across 1 file. Reproducibility: yes. at source level: current main skips provider-qualified lookup whenever the resolved model segment contains Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land the scoped resolver fix only after adding focused regression coverage for explicit proxy-provider slash IDs and redacted real Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main skips provider-qualified lookup whenever the resolved model segment contains Is this the best way to solve the issue? Mostly yes for the explicit-provider cache-miss root cause: the shared resolver is the right owner for status and session persistence. The PR still needs focused coverage and real behavior proof, and any missing-provider Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against eb1b640854bb. Label changesLabel justifications:
Evidence reviewedPR surface: Source +2. Total +2 across 1 file. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
… OpenRouter proxy models)
Remove the `!ref.model.includes("/")` guard in `resolveContextTokensForModel()` which blocked qualified cache key lookup for models like `anthropic/claude-sonnet-4` accessed through proxy providers.
Two call sites fixed:
1. Explicit provider path (params.provider && ref) -- safe because provider is explicitly given
2. Last resort implicit provider path (!params.provider && ref) -- bare key already failed, trying qualified key has no downside
Fixes: max context showing DEFAULT_CONTEXT_TOKENS (200K) instead of actual model's context window for proxy models
9b624af to
b79687d
Compare
|
Superseded by #92772 from the comprehensive branch \ix/comprehensive-context-window-resolution\ which includes all 7 layers of fixes. |
…t window resolution When a session entry has model="openrouter/anthropic/claude-sonnet-4" but entry.modelProvider is empty, buildStatusMessage() previously set contextLookupProvider = undefined, causing resolveContextTokensForModel() to skip the provider-qualified cache key lookup. Now extract the embedded provider (first slash segment) and pass it to the resolution chain so the correct context window is found. Combined with PR openclaw#92424's resolveFreshModel() fix and PR openclaw#92709's slash-guard removal in resolveContextTokensForModel(), this gives comprehensive coverage for proxy model context window resolution. Refs: openclaw#39857, openclaw#90889, openclaw#92424, openclaw#92709
Problem
/statusshows max context = 200K (DEFAULT_CONTEXT_TOKENS) for models accessed through proxy providers like OpenRouter, regardless of the actual model's context window.Root Cause
Two guards in
resolveContextTokensForModel()(src/agents/context.ts) blocked qualified cache key lookup when the model ID contained a slash:OpenRouter and similar proxy providers always have slashes in their model IDs (e.g.
anthropic/claude-sonnet-4), makingref.model="anthropic/claude-sonnet-4"which contains "/". The qualified cache key was never constructed, causing a cache miss and fallback to 200K.Fix
Removed the
!ref.model.includes("/")guard from both call sites:Related
Scope
Only
src/agents/context.ts. No test changes needed (existing tests already cover cache hit/miss paths).