Skip to content

Add ucode run: recommend-model-driven session startup#228

Open
lilly-luo wants to merge 7 commits into
mainfrom
lilly/ucode-run-recommend-model
Open

Add ucode run: recommend-model-driven session startup#228
lilly-luo wants to merge 7 commits into
mainfrom
lilly/ucode-run-recommend-model

Conversation

@lilly-luo

@lilly-luo lilly-luo commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

New top-level ucode run command that queries the AI Gateway's recommendModel endpoint for the caller's usage tier, then launches the matching harness pinned to the chosen model:

  • Discover all workspace models, POST them to /api/ai-gateway/v2/coding-agent-configs:recommendModel.
  • 1 model -> auto-launch (no prompt); 2+ -> interactive picker; empty -> guidance to use ucode <harness>; error -> exit non-zero.
  • Map model family -> harness: claude->claude, gpt->codex, kimi/glm->codex, gemini->gemini.
  • Extend codex to route OSS models (kimi/glm) via the MLflow chat-completions gateway (wire_api="chat") instead of the Responses route; GPT models unchanged.

Adds recommend_coding_agent_models, is_oss_model, build_oss_base_url (databricks.py) and harness_for_model (agents/init.py), with unit tests for the endpoint, the harness map, codex OSS routing, and CLI routing.

Co-authored-by: Isaac

https://www.loom.com/share/bcd48dcbd1ba46968a9ad05dcf82ab74

prd: https://docs.google.com/document/d/1oYG1MidFTmvNa5Je2wf-iVDxzCxBuo4_8ve4ZdoTuBo/edit?tab=t.auf5j86b6558#bookmark=id.hx4w8nr9p91q
impl plan: https://docs.google.com/document/d/1xdcwvg1oGITsbYRmzPn9lE5vrdD8AhFqgbHNeYR09ZY/edit?tab=t.0

New top-level `ucode run` command that queries the AI Gateway's
recommendModel endpoint for the caller's usage tier, then launches the
matching harness pinned to the chosen model:

- Discover all workspace models, POST them to
  /api/ai-gateway/v2/coding-agent-configs:recommendModel.
- 1 model -> auto-launch (no prompt); 2+ -> interactive picker;
  empty -> guidance to use `ucode <harness>`; error -> exit non-zero.
- Map model family -> harness: claude->claude, gpt->codex,
  kimi/glm->codex, gemini->gemini.
- Extend codex to route OSS models (kimi/glm) via the MLflow
  chat-completions gateway (wire_api="chat") instead of the Responses
  route; GPT models unchanged.

Adds recommend_coding_agent_models, is_oss_model, build_oss_base_url
(databricks.py) and harness_for_model (agents/__init__.py), with unit
tests for the endpoint, the harness map, codex OSS routing, and CLI
routing.

Co-authored-by: Isaac
When only one model is recommended, launch it silently instead of
printing a note — the Model/Harness banner already shows what launched.
Record the auto-launch in the debug log (UCODE_DEBUG=1) instead.

Co-authored-by: Isaac
@lilly-luo
lilly-luo force-pushed the lilly/ucode-run-recommend-model branch from 12d5b25 to d337c31 Compare July 21, 2026 16:45
Codex CLI dropped support for `wire_api = "chat"` (openai/codex
discussion 7782), so the OSS chat-completions route added for kimi/glm
now fails to load with "`wire_api = "chat"` is no longer supported".
Route every codex-harness model — including OSS families — through the
Responses gateway, matching what all other codex models already use.

Co-authored-by: Isaac
@lilly-luo
lilly-luo force-pushed the lilly/ucode-run-recommend-model branch from d337c31 to ce764db Compare July 21, 2026 16:46
@lilly-luo
lilly-luo requested a review from rohita5l July 21, 2026 17:58
@rohita5l
rohita5l requested a review from AarushiShah-db July 21, 2026 18:12
`ucode run` owns model selection via the recommendation flow, so a
caller-supplied `--model` is rejected up front with actionable guidance.
For the claude harness — which deliberately doesn't pin a model in its
settings — prepend `--model <resolved_model>` to the launch argv so the
session starts on the model the user picked instead of Claude Code's default.

Co-authored-by: Isaac
…o constant

`build_oss_base_url` lost its only shared caller when codex OSS routing was
reverted, leaving a single-use indirection; inline it back into
build_opencode_base_urls. Extract the recommendModel API path into a module
constant.

Co-authored-by: Isaac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant