From 836823826927af076eee911f852eee54e3683bde Mon Sep 17 00:00:00 2001 From: anandgupta42 Date: Fri, 20 Nov 2026 21:32:33 -0800 Subject: [PATCH 01/76] fix: reject unavailable explicit models --- docs/docs/configure/config.md | 2 + docs/docs/configure/models.md | 2 +- .../src/altimate/learn/project-config.ts | 2 +- .../src/altimate/provider/model-hint.ts | 3 + packages/opencode/src/cli/cmd/run.ts | 73 ++++++++++++------- packages/opencode/src/cli/error.ts | 4 +- packages/opencode/src/config/paths.ts | 7 +- packages/opencode/src/provider/provider.ts | 8 +- packages/opencode/src/session/prompt.ts | 25 ++++--- .../test/cli/run/explicit-model.test.ts | 41 +++++++++++ packages/opencode/test/config/config.test.ts | 12 +++ .../opencode/test/provider/provider.test.ts | 19 +++++ packages/tui/src/component/prompt/index.tsx | 4 + packages/tui/src/context/local.tsx | 58 ++++++++++----- .../explicit-model-authoritative.test.tsx | 67 +++++++++++++++-- 15 files changed, 257 insertions(+), 70 deletions(-) create mode 100644 packages/opencode/test/cli/run/explicit-model.test.ts diff --git a/docs/docs/configure/config.md b/docs/docs/configure/config.md index 737d0e03ef..9262087ef1 100644 --- a/docs/docs/configure/config.md +++ b/docs/docs/configure/config.md @@ -24,6 +24,8 @@ Configuration is loaded from multiple sources, with later sources overriding ear !!! tip For most projects, create a `altimate-code.json` in your project root or use the `.altimate-code/` directory for a cleaner setup. +At each project level, Altimate Code loads `altimate-code.json` and `altimate-code.jsonc` alongside the legacy `opencode.json` and `opencode.jsonc` names. The nearest directory takes precedence. Within the same directory, the branded files override legacy files, and JSONC overrides JSON for the same name. Files in the config directories are loaded in the later directory-config layer. + ## Minimal Example ```json diff --git a/docs/docs/configure/models.md b/docs/docs/configure/models.md index baebe3cb19..4a156e3dcb 100644 --- a/docs/docs/configure/models.md +++ b/docs/docs/configure/models.md @@ -16,7 +16,7 @@ altimate supports models from all configured providers. Use the `model` and `sma } ``` -The model format is `provider/model-name`. +The model format is `provider/model-name`. In `run` and the TUI, an unavailable model selected by `--model`, the `model` field, or an agent configuration produces an error. Correct the provider and model in your config, or choose an available model. Automatic model selection applies when no explicit model was requested. `small_model` handles the small background requests that are not part of the conversation, such as the session title and prompt enhancement. When it is not set, Altimate Code picks a cheap model from the same provider (Claude Haiku, Gemini Flash or GPT-5 nano when the provider lists one) and otherwise uses the chat model. A `small_model` the provider cannot serve, or does not list, fails only those requests: chat keeps working, while new sessions keep their `New session -