Skip to content

feat(catalog): advertise each route's reasoning-effort ladder and enforce pins against it - #130

Merged
lg2m merged 1 commit into
feat/tui-session-reasoning-effortfrom
feat/per-model-reasoning-efforts
Sep 22, 2026
Merged

lg2m merged 1 commit into
feat/tui-session-reasoning-effortfrom
feat/per-model-reasoning-efforts

Conversation

@lg2m

@lg2m lg2m commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

What changes for users

Before: /effort offered every level (none … xhigh) to every model. What happened next depended on the adapter:

  • OpenAI-shaped route, listed level → accepted
  • OpenAI-shaped route, unlisted level → provider 400 mid-turn
  • Anthropic-shaped route, any level → qq rejects with unsupported_reasoning_effort

After:

  • /effort shows default, none, and the levels the focused model's catalog entry advertises. If the catalog is silent it still shows every level, and the hint says so.
  • A pin outside an advertised ladder fails at plan time with the accepted values named:
    model route "openai/gpt-5.4-mini" does not advertise reasoning_effort xhigh; it accepts minimal, low, medium, high
  • An empty ladder is "not advertised", not "unsupported" — nothing is checked, so custom/discovered routes behave exactly as before.

Why / design

ModelMetadata.reasoning_efforts already existed (Jev routing reads it) but the bundled catalog never populated it, so it was always empty. This wires the existing field end-to-end:

  • Catalog (qq-config/models.rs): model! gains an optional efforts:. OpenAI API, OpenAI Codex, and Bedrock Mantle openai.* routes advertise minimal..xhigh; xAI advertises low/high. Anthropic-shaped routes stay empty on purpose — their adapters never transmit effort, so a ladder would be a lie.
  • Protocol (additive in 27): ModelDescriptor.reasoning_efforts, skip_serializing_if = Vec::is_empty. No golden changes — every current fixture has an empty ladder. ModelOption mirrors it; model_reasoning_efforts() helper.
  • Runtime: RuntimeBuildError::ReasoningEffortNotAdvertised { model, effort, advertised } right after the existing adapter-support check. Same failure kind (Configuration), so headless exit codes don't change.
  • TUI: open_effort builds rows from focused_model_efforts(); picker hint distinguishes the four cases.

On ultra: not added. No catalog entry documents it, and this PR is exactly the mechanism that lets a level be added for one route without advertising it to all of them. If Astra genuinely accepts ultra, it's one enum variant plus one efforts: edit on that route, and the picker/enforcement do the right thing automatically.

Linear: ENG-
Slice: follow-up to #122

How verified

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo test --workspace — 176 + 697 + 311 + … all green
  • cargo test -p qq-provider --no-default-features --features test-support — qq-provider not changed
  • Manual check: n/a (TUI picker covered by the shaping test below)

New tests:

  • qq-config: effort_ladders_follow_the_wire_adapter_not_the_reasoning_flag (Astra advertises xhigh; Claude Sonnet 5 reasons but advertises nothing; Mantle openai.* vs anthropic.*)
  • qq: reasoning_effort_outside_the_advertised_ladder_is_a_plan_error (inside passes; outside names the set; empty ladder passes any pin)
  • qq: model_options_carry_the_advertised_effort_ladder
  • qq-tui: effort_picker_is_shaped_by_the_focused_models_advertised_ladder (advertised / silent / unfocused)

Impact

  • Performance: none on hot paths. One Vec<ReasoningEffort> clone per catalog entry when building the model list (already clones name/selection); one slice lookup at plan time.
  • Compatibility: PROTOCOL 27 unchanged (additive field, omitted when empty, zero fixture diffs). DESCRIPTOR unchanged. Store schema unchanged.
  • Docs: docs/guide/tui.md (picker table row), docs/design/protocol.md (v27 additive note), docs/design/architecture.md (ladder + plan-time check).

…orce pins against it

The `/effort` picker offered every level to every model, and the outcome depended on the adapter: accepted (OpenAI), rejected by the provider mid-turn (OpenAI, unlisted level), or rejected by qq (Anthropic-shaped). `ModelMetadata.reasoning_efforts` already existed for Jev routing but the bundled catalog never populated it.

Catalog: `model!` gains an optional `efforts:` field. OpenAI API, OpenAI Codex, and Bedrock Mantle `openai.*` routes advertise minimal..xhigh; xAI advertises low/high. Anthropic-shaped routes stay empty because their adapters never transmit effort.

Protocol (additive in 27, no fixture changes): `ModelDescriptor.reasoning_efforts`, omitted when empty. `ModelOption` mirrors it; `model_reasoning_efforts()` helper.

Runtime: a pin outside a non-empty ladder is `RuntimeBuildError::ReasoningEffortNotAdvertised { model, effort, advertised }` at plan time, naming the accepted values. An empty ladder is unknown, not unsupported, and is not checked.

TUI: `/effort` shows `default`, `none`, and the focused model's ladder when known; every level otherwise. The hint says which.

Not added: `ultra`. No catalog entry documents it; adding the variant without a route that advertises it would surface it everywhere.

Tests: catalog ladders follow the wire adapter; plan-time rejection names the set and empty ladders pass; model options carry the ladder; picker shaping for advertised / silent / unfocused.

Verification: cargo test --workspace, fmt --check, clippy -D warnings.
@lg2m
lg2m added this pull request to stack #131 September 22, 2026 21:06
@lg2m
lg2m merged commit 0b0aede into main Sep 22, 2026
4 checks passed
@lg2m
lg2m deleted the feat/per-model-reasoning-efforts branch September 22, 2026 21:06
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