Skip to content

feat(serve): list pickable models, set the session model and thinking level - #967

Merged
ajianaz merged 1 commit into
developfrom
feat/serve-model-effort
Nov 19, 2026
Merged

ajianaz merged 1 commit into
developfrom
feat/serve-model-effort

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What

Three routes behind the existing auth: GET /models, POST /sessions/{id}/model {"model"} and POST /sessions/{id}/effort {"effort": level|null}. Closes #574 (part of #523).

Why

A graphical client has no model picker or thinking selector over tole serve. Choosing a model also chooses what the token holder spends, and it is a durable register, so the server (the owner) must decide which models can be picked.

Changes

  • New serve/models.rs; serve.rs only gets the route arms, one State field and the module line.
  • The writers are the TUI's own (session_settings::write_model / set_effort), so the fact/model and fact/reasoning_effort registers are exactly what /model and /thinking write; tole resume reads them as before (session_model_e2e / session_effort_e2e cover that read).
  • Refusals: 404 unknown session, 409 while a turn runs (busy flag, then try_lock on the turn lock, via the existing with_idle_session), 400 for a bad value, 401 without the token (routes added to no_route_answers_without_a_valid_credential).
  • Design decision (the issue left it open, safer option chosen): the pickable list is the configured default model plus the owner's TOLE_MODELS (the variable of the ACP picker), read at start-up. With no TOLE_MODELS only the default can be picked. The provider's /models is NOT consulted, because it would let the token holder pick anything the key reaches. A request carries a model id only; it cannot name a provider URL or key, and an id outside the list (exact match) is a 400. null or "unset" clears the effort, an invalid level is a 400, never coerced.
  • docs/mobile-control.md route table and CHANGELOG.md (Added, Behavior Change) updated.

Testing

  • cargo test -p tole-cli: 1606 passed, 0 failed.
  • New unit tests: success, 404, 409 (busy flag and held lock), 400 (bad bodies, model outside the list, URL as model, bad levels), registers read back through session_model / session_effort, default-only list.
  • cargo fmt --all; cargo clippy -p tole-cli --all-targets -- -D warnings clean in default, --no-default-features, and --no-default-features --features shell-tools.

… level (#574)

GET /models, POST /sessions/{id}/model and POST /sessions/{id}/effort
write the fact/model and fact/reasoning_effort registers the TUI writes.
The pickable list is the owner's (default model plus TOLE_MODELS); a
request cannot name a provider URL or key.
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit 053edbd into develop Nov 19, 2026
23 checks passed
@ajianaz
ajianaz deleted the feat/serve-model-effort branch November 20, 2026 08:37
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.

feat(serve): list the models a client may pick, set the session model and the thinking level

1 participant