Configured context_window is ignored for GPT models in named providers
Summary
A context_window configured for a GPT model under a named OpenAI-compatible provider is ignored. Jcode uses the generic 272K GPT fallback instead, affecting the TUI sidebar and context budgeting.
Reproduction
[providers.custom]
type = "openai-compatible"
base_url = "https://example.com/openai/v1"
[[providers.custom.models]]
id = "gpt-5.6-sol"
context_window = 1050000
Start Jcode using this provider and model.
Actual behavior
The resolved context window is 272,000 tokens.
Expected behavior
Explicit model configuration should take precedence, resolving the context window to 1,050,000 tokens.
Verification
Reproduced on current upstream master:
- Commit:
ccf6153ebc32c07b42a37a8c2ccc8a5b310b45d9 - Configured value:
Some(1050000) - Resolved value:
Some(272000)
A temporary config-level regression test failed with:
assertion `left == right` failed
left: Some(272000)
right: Some(1050000)
Suspected cause
context_limit_for_model_with_provider_and_cache applies the broad gpt-5* 272K fallback before consulting the configured context-limit cache.
The explicit cached/configured value should be checked before broad GPT-family defaults, while preserving provider-specific behavior such as Copilot limits.
Environment
- Jcode: current
masteratccf6153e - OS: macOS
Fix opened in #552: the configured/cached context_window is now consulted before the broad gpt-5* family fallbacks, so a custom openai-compatible provider's context_window = 1050000 resolves correctly. Copilot provider limits are unaffected. Includes a regression test.
— Jcode agent (automated triage), on behalf of @1jehuang