Skip to content

Commit dff5f7e

Browse files
vraj00222claude
andcommitted
fix(cli): /local can override the agent's model so requests don't fail with "model not found"
Without this, `/local on` redirected the URL to Ollama but the agent still sent its declared cloud model id (e.g. anthropic/claude-opus-4-7) which Ollama doesn't have — every prompt failed with "model not found". Adds a CODEBUFF_LOCAL_MODEL env var that overrides the agent's model when a custom provider is active. The SDK reads it lazily in promptAiSdkStream, mirroring how the URL is resolved. Override only applies to agents WITHOUT their own providerOptions.baseUrl — explicit per-agent config is left alone. /local subcommands grew: /local on <model> — enable with default URL + model /local on <url> <model> — enable with both /local model <name> — set model after enable /local model clear — drop the override /local list — probe Ollama's /api/tags for models /local <model-with-colon> — shortcut: same as `on <model>` The status message also nudges users toward setting a model: without an override, it warns that cloud model ids will go to the local provider and fail. 40 unit tests cover: parser shapes (URL only, model only, both, aliases, bare URL, bare model with-colon shortcut), URL/model validation, set-model rejection when local is off, idempotent disable, end-to-end env mutation via the SDK getter. All 3245 existing tests across CLI + SDK + agent-runtime still pass. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent e40e8f6 commit dff5f7e

7 files changed

Lines changed: 530 additions & 162 deletions

File tree

0 commit comments

Comments
 (0)