Repository navigation
feat(catalog): advertise each route's reasoning-effort ladder and enforce pins against it - #130
Merged
lg2m merged 1 commit intoSep 22, 2026
Conversation
…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.
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.
What changes for users
Before:
/effortoffered every level (none…xhigh) to every model. What happened next depended on the adapter:unsupported_reasoning_effortAfter:
/effortshowsdefault,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.model route "openai/gpt-5.4-mini" does not advertise reasoning_effort xhigh; it accepts minimal, low, medium, highWhy / design
ModelMetadata.reasoning_effortsalready 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:qq-config/models.rs):model!gains an optionalefforts:. OpenAI API, OpenAI Codex, and Bedrock Mantleopenai.*routes advertiseminimal..xhigh; xAI advertiseslow/high. Anthropic-shaped routes stay empty on purpose — their adapters never transmit effort, so a ladder would be a lie.ModelDescriptor.reasoning_efforts,skip_serializing_if = Vec::is_empty. No golden changes — every current fixture has an empty ladder.ModelOptionmirrors it;model_reasoning_efforts()helper.RuntimeBuildError::ReasoningEffortNotAdvertised { model, effort, advertised }right after the existing adapter-support check. Same failure kind (Configuration), so headless exit codes don't change.open_effortbuilds rows fromfocused_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 acceptsultra, it's one enum variant plus oneefforts: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 -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo test --workspace— 176 + 697 + 311 + … all greencargo test -p qq-provider --no-default-features --features test-support—qq-providernot changedNew tests:
qq-config:effort_ladders_follow_the_wire_adapter_not_the_reasoning_flag(Astra advertisesxhigh; Claude Sonnet 5 reasons but advertises nothing; Mantleopenai.*vsanthropic.*)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_ladderqq-tui:effort_picker_is_shaped_by_the_focused_models_advertised_ladder(advertised / silent / unfocused)Impact
Vec<ReasoningEffort>clone per catalog entry when building the model list (already clones name/selection); one slice lookup at plan time.docs/guide/tui.md(picker table row),docs/design/protocol.md(v27 additive note),docs/design/architecture.md(ladder + plan-time check).