Repository navigation
feat(chat): per-conversation reasoning-effort selector in the composer (#641) - #2564
Merged
Merged
Conversation
HKUDS#641) Carry the HKUDS#958 service-layer reasoning_effort override through the whole turn contract: the core TurnRequest LLMSelection accepts the field (validated against VALID_REASONING_EFFORTS, old two-ID payloads unchanged), the generated web contracts are regenerated, and ChatStateAdapter's asLLMSelection restores a legal override instead of dropping it. The composer gains a selector beside the model picker, offering only the levels the selected model supports (live supported_reasoning_efforts or the provider/model tables) narrowed to the wire vocabulary, hidden when the model has none. The choice persists on the conversation's llm_selection, so the next send uses it without a backend restart and other conversations are unaffected; switching models resets the override. Precedence stays conversation override -> profile/model default -> provider default, and the context-budget readout reports the effective effort beside the model when one was used.
…UDS#641) A persisted override the selected model no longer supports (e.g. a saved xhigh after the catalog restricts the model to low/high) could reach the provider: the selector re-listed the stale value, and the send path forwarded the restored llm_selection.reasoning_effort unchecked. - lib/reasoning-effort.ts: supportedReasoningEffortValues() returns the model's supported wire values (catalog list, else provider/model tables honouring declared_reasoning) without ever re-adding the stored value; effectiveReasoningEffort() resolves an override to null when the model does not support it; dropUnvalidatedReasoningEffort() strips it from an outgoing llm_selection — including when the option is unresolved, where the override is omitted (falls back to the configured default) rather than forwarded unvalidated. - ReasoningEffortSelector: computeReasoningOptions uses the helper; a stale value is not offered and Auto renders as selected instead. - ChatComposer: once the model options are loaded, a detected-unsupported persisted override is reset through the selector's onChange persist path; nothing is cleared while the option is still unresolved. - ChatStateAdapter: outgoing llm_selection (live send and failed-turn resend) is sanitized via the last-known option catalog, which listLLMOptions now records (readLastKnownLLMOptions, synchronous). - tests: helper/selector/restore-path coverage in reasoning-effort.test.ts, reasoning-effort-selector.spec.tsx and the new reasoning-effort-restore.spec.ts.
15 of 21 tasks
2 tasks done
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.
Summary
Adds a per-conversation reasoning-effort selector next to the model picker in the chat composer.
LLMSelectiongains an optional, validatedreasoning_effort(same vocabulary/normalization as the service layer). Old two-ID payloads stay valid; generated contracts were regenerated with the existing scripts.supported_reasoning_efforts, else the provider/model tables), hides the control when nothing is selectable, and persists the choice on the conversation'sllm_selection.llm_selectionpaths, so a stale value never reaches the provider.Tests
tests/core/test_turn_request_llm_selection.py, plus updates to WS turn runtime and context-budget tests.reasoning-effort.test.ts,reasoning-effort-selector.spec.tsx, newreasoning-effort-restore.spec.ts(restore after supported levels change).test:node1354/1354,test:unit1221/1221; focused pytest and ruff pass.Fixes #641