Bug: Custom OpenAI-compatible providers (Lemonade): 256k context window ignored — discovery doesn't read Lemonade's /v1/models fields, and the desktop custom-provider form has no way to set a model's context limit
Author: IotaslairCreated Sep 13, 2026Updated Sep 28, 2026
Describe the bug
Using a custom OpenAI-compatible provider served by Lemonade (lemonade-server.ai) in the desktop app, the effective context window is 128k even though the model supports 256k, causing premature context compaction. Two gaps combine:
- API discovery ignores Lemonade's declared window. The OpenAI-compatible provider does probe /v1/models, but fetch_n_ctx_from_api / parse_n_ctx_from_models (crates/goose-providers/src/openai.rs) only reads llama.cpp's meta.n_ctx. Lemonade emits context_length (loaded context) and max_context_window (static capability) instead, so discovery returns None and the resolver falls back to DEFAULT_CONTEXT_LIMIT = 128_000 (crates/goose-provider-types/src/model.rs:11).
- No UI affordance for the documented config escape hatch. Custom providers support per-model context_limit in ~/.config/goose/custom_providers/.json (models[].context_limit, which takes precedence over discovery), but the desktop custom-provider form only accepts comma-separated model names — so a user cannot set a context window from the UI, and re-saving the provider via the form rewrites the file from the form payload (names only), discarding any manually added context_limit values.
To Reproduce
- In the desktop app, add a custom provider pointing at a Lemonade server.
- List a model with 256k context; the form offers no context-window field.
- Run a session on that model and see that the max context is 128k
Expected behavior
- Discovery reads the server's declared context window: meta.n_ctx > context_length > max_context_window (runtime allocation before static capability).
- The desktop custom-provider form exposes a per-model context window field (and preserves it on edit), so users can override what the server reports.
Screenshots N/A
Please provide the following information
- OS & Arch: Linux Mint 22.3 x86_64
- Interface: UI (Desktop)
- Version: v1.50.0
- Extensions enabled: None
- Provider & Model: Lemonade (lemonade-server.ai, custom OpenAI-compatible provider)
Additional context
- Workaround today: hand-edit ~/.config/goose/custom_providers/.json and set "context_limit": 262144 on the model; restart the app. Re-saving via the UI form discards the value.
Source: aaif-goose/goose