Patch 4: Increase OpenRouter promptWindowLimit fallback via AGENT_CONTEXT_WINDOW_FALLBACK

Both static and instance fallbacks increased from 4096 to 2,000,000 tokens.
When model isn't in models.json cache (e.g. Grok), it was falling back to
4096 tokens causing severe truncation of file reads.
Reuses AGENT_CONTEXT_WINDOW_FALLBACK env var from Patch 2.
This commit is contained in:
PQ32 Developer 2026-05-10 15:21:45 -07:00
parent 5009ddbb3a
commit 5bcef7d604

View File

@ -168,7 +168,7 @@ class OpenRouterLLM {
{} {}
) )
: {}; : {};
return availableModels[modelName]?.maxLength || 4096; return availableModels[modelName]?.maxLength || Number(process.env.AGENT_CONTEXT_WINDOW_FALLBACK) || 2_000_000;
} }
promptWindowLimit() { promptWindowLimit() {