Add ucode claude --model to pin a custom Databricks model - #306
Merged
Conversation
`ucode claude --model <uc-id>` used to fall through to Claude Code's own
--model flag, which validates the name client-side against the models it lists
and rejects a raw Databricks id ("may not exist ... run /model to pick a
different model"). Codex works because its --model goes straight to the
gateway.
Add a real --model option to `ucode claude` that pins the id via
ANTHROPIC_MODEL (route_root_model) — the same path smart routing and managed
configs already use — so the gateway resolves any UC model id. An explicit
--model outranks the managed default and smart-routing pick, and can't be
combined with --provider (which routes by header and pins no model).
Co-authored-by: Isaac
The first cut pinned --model as ANTHROPIC_MODEL, which didn't fix the bug: Claude Code validates ANTHROPIC_MODEL client-side (on ucode's apiKeyHelper auth path) and rejects a raw Databricks id with the same "may not exist ... run /model" error. Verified against the live gateway that the id resolves fine — the rejection is purely Claude Code's client-side check. The family-alias env vars (ANTHROPIC_DEFAULT_OPUS/SONNET/HAIKU_MODEL) are passed through unchecked, so route --model there instead. A raw id carries no signal of its family, so pin it into all three aliases — the model then takes effect whichever slot Claude Code resolves (root session, tier switch, or subagent). Threaded as a new `custom_model` arg through configure_tool → write_tool_config → render_overlay, distinct from ANTHROPIC_MODEL (which stays unset). Co-authored-by: Isaac
Claude Code's enterprise managed-settings scope (e.g. an Isaac/dbexec-installed /etc/claude-code/managed-settings.json) pins the Claude model and outranks both the --settings file ucode writes and --setting-sources exclusion. So `--model` is silently ignored on such machines and the launch runs the pinned model — which looks like a ucode bug. Warn at launch when --model is passed for claude and the enterprise settings pin a model, naming the file and telling the user to edit/remove it. The prior managed-settings warning only fired under a workspace managed config; a plain `ucode claude --model` launch got nothing. Co-authored-by: Isaac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ucode claude --model <uc-id>used to fall through to Claude Code's own--modelflag, which validatesthe name client-side and rejects a raw Databricks id ("It may not exist or you may not have access to it.
Run /model to pick a different model"). Codex works because its
--modelpasses straight to thegateway.
Adds a real
--modeloption toucode claude. The id is pinned into the family-alias env vars(
ANTHROPIC_DEFAULT_OPUS/SONNET/HAIKU_MODEL), notANTHROPIC_MODEL— Claude Code validates the latterclient-side (on ucode's
apiKeyHelperauth path) and rejects a raw id, but passes the aliases throughunchecked to the gateway. A raw id carries no signal of its family, so it's pinned into all three slots,
guaranteeing it takes effect whichever slot Claude Code resolves (root session, tier switch, or
subagent). Threaded as a new
custom_modelarg throughconfigure_tool→write_tool_config→render_overlay.--modeloutranks the managed default and smart-routing pick, and is mutually exclusive with--provider(which routes by header and pins no model).Also warns when Claude Code's enterprise managed-settings scope (e.g. an Isaac/dbexec-installed
/etc/claude-code/managed-settings.json) pins the Claude model — that scope outranks the--settingsfile ucode writes and can't be excluded, so it silently overrides
--model. The warning names the fileand explains why the requested model didn't take effect.
Verified end-to-end against a live workspace: with the aliases set,
claudelaunches on the custommodel; and the enterprise-settings case is what surfaced the need for the warning.