feat(settings): let OpenAI-compatible profiles declare supported reasoning effort levels (DTE F7) - #1366
Open
easonLiangWorldedtech wants to merge 68 commits into
Conversation
…nd adaptive effort envelope DTE series 2/5 (part of Zoo-Code-Org#1329). - ApiHandlerCreateMessageMetadata.reasoningEffort: per-request override channel - resolveEffectiveReasoningEffort: single shared resolution point (override > settings > model default) - AnthropicHandler: adaptive output_config.effort envelope in both requestParams branches (in-range only) - Task: setRuntimeThinkingEffort/getRuntimeThinkingEffort with in-memory apiConfiguration merge/restore, per-request metadata at all four createMessage sites, dispose() reset; never persisted
DTE series 2/5 — addresses the CodeRabbit review finding on Zoo-Code-Org#1338: when a task-local thinking-effort override is active, updateApiConfiguration() now re-captures the incoming profile's reasoningEffort as the restore value and re-applies the override on top of the new in-memory copy, so clearing the override restores the NEW profile value instead of the stale one. Additive: activation and clearing semantics are otherwise unchanged. Adds two regression tests (override active + profile switch restores new value; inactive updateApiConfiguration unchanged behavior).
DTE series 2/5 — addresses the CodeRabbit docstring-coverage warning on Zoo-Code-Org#1338 (33.33% < 80% across the functions touched by the diff): - AnthropicHandler.createMessage: documents the shared effective-effort resolution and the adaptive output_config.effort envelope (in-range only). - Task.dispose: documents centralized teardown incl. the transient task-local override reset. - Task.updateApiConfiguration: documents the override-preservation behavior (re-captured restore value + re-applied override on the new in-memory copy). Comment-only change: 30/30 patch lines and 10/10 branches unchanged; 317/317 tests and tsc --noEmit re-verified green.
…/dte-3-native-tool
Add the set_thinking_effort native tool (DTE series 3/5): the model adjusts its own per-turn thinking effort mid-task with no approval gate. - Guardrails: one-line chat notification (success or refusal), escalation cap (max 3 upward changes per task), A->B->A oscillation refusal, hard clamp to the model capability array (ties toward the lower level). - Gating: dynamicThinkingEffort experiment + model supportsReasoningEffort (non-empty array or true), evaluated at task start so the tool list stays stable within a task (prompt-cache safety). - Display: webview ChatRow one-line row (applied / oscillation / escalation refusal), i18n keys in all 17 locales; partial streaming updates the same line. - Tests: executor (clamp/cap/oscillation/no-op/no-approval/display), parser (partial + complete), dispatch, gating matrix, schema wiring, ChatRow display. Stacked on DTE PR-1 (experiment flag) and PR-2 (task-local runtime effort state). Closes Zoo-Code-Org#1330.
Address PR review feedback on set_thinking_effort (DTE series 3/5): - Executor: seed the per-task guard history with the task's effective baseline so returning from a changed value to the original baseline is refused as oscillation (A -> B -> A); existing no-op behavior preserved. - Parser: only build nativeArgs when effort AND reason are strings; a non-string payload now fails at parse time and cannot reach the executor. - Gating: a supportsReasoningEffort array that only lists 'disable' no longer exposes the tool (it could apply no level). - i18n: translate the new thinkingEffort chat strings into all 17 non-English webview locales (placeholders preserved). - Tests: regression tests for each change plus branch-coverage for the previously partial lines (non-string args, 'disable'-only capability, baseline oscillation, partial streaming without params, description fallback, capability robustness). All touched patch lines are now fully branch-covered (codecov patch partials resolved). CodeRabbit: Zoo-Code-Org#1354
… post-mode-switch revalidation, ask prefill normalization)
…e, in-chat display
…tadata in say-rejection test
Contributor
Author
|
@coderabbitai review |
Contributor
✅ Action performedReview finished.
|
7 tasks
7 tasks
The new supportedReasoningEfforts hint in the nl locale said "OpenAI-compatibiele"; the correct spelling is "OpenAI-compatibele". (CodeRabbit on trial PR 1379)
…a think param getOllamaThinkParam() only read this.options.reasoningEffort, so a task-local per-request override (metadata.reasoningEffort) was ignored by the native Ollama provider while every other provider resolves it via the shared override-first order. Thread the override through buildChatRequestOptions() into getOllamaThinkParam() (override ?? settings fallback); completePrompt keeps the settings-derived value since it has no per-request metadata. Two new provider request tests cover the override-beats-settings and override-without-settings paths. (CodeRabbit on trial PR 1379)
Contributor
Review processThanks for contributing. This comment tracks the review sequence and the next action.
Current step: Required CI passed. Wait for CodeRabbit to approve the latest commit. |
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.
Closes #1376
What & why
Self-hosted / OpenAI-compatible models (custom OpenAI endpoint, LM Studio, Ollama, and similar) do not advertise
supportsReasoningEffortin the model registry, so the dynamic thinking effort (DTE) features —set_thinking_efforttool, composer ThinkingEffortToggle, TaskHeader chip,new_taskthinking_effort param — were silently disabled for them even when the underlying model supports effort levels (e.g. Qwen3 via LM Studio).F7 lets the user declare the effort levels their model supports, per API profile, via a new provider setting.
Design (conservative, additive)
New provider setting (
packages/types/src/provider-settings/common.ts):supportedReasoningEfforts: z.array(reasoningEffortExtendedSchema).optional()onbaseProviderSettingsShape— a per-profile declaration of canonical effort levels (canonical enum only; the UI-level"disable"sentinel cannot be declared).Single resolution semantic, applied on both sides: when the resolved
ModelInfodoes NOT havesupportsReasoningEffort(undefined) AND the profile declares a non-emptysupportedReasoningEfforts, the model is treated as supporting exactly that array. Registry values are NEVER overridden (fill-in-the-gap only), so registry models (deepseek, openrouter, gemini, friendli catalogs, etc.) are untouched.Extension side: small shared helper
withDeclaredReasoningEffort(modelInfo, settings)insrc/api/model-capabilities.ts, applied at the construction sites where OpenAI-compatible ModelInfo reaches consumers viagetModel():BaseOpenAiCompatibleProvider.getModel()(covers friendli/fireworks/baseten/sambanova/zai)FriendliHandler.getModel()(custom override)OpenAiHandler.getModel()(custom OpenAI endpoint, incl. DeepSeek/Kimi/Moonshot/Mimo subclasses)LmStudioHandler.getModel()NativeOllamaHandler.getModel()RouterProvider.getModel()(covers LiteLLM, kenari, nanogpt, opencode-go, vercel-ai-gateway, zoo-gateway)All downstream DTE consumers (
task.api.getModel().infoinSetThinkingEffortTool,NewTaskTool,filter-tools-for-mode,webviewMessageHandler.setTaskThinkingEffort, request transform capability gates inshared/api.ts/api/transform/reasoning.ts) pick the capability up automatically — no request transforms changed; the existing capability gate already controls thereasoning_effort/ OpenRouter reasoning envelope emit once capability is present.Webview side: mirror helper
resolveReasoningEffortCapability(model, apiConfiguration)inwebview-ui/src/utils/thinkingEffort.ts, applied insidecomputeThinkingEffortDisplayso the composer toggle and TaskHeader chip render for declared models (both surfaces read the webview state ModelInfo, which has no extension-side info).Experiments-screen hint (
ExperimentalSettings.tsx): a small info line under the Dynamic thinking effort row noting that OpenAI-compatible profiles can declare supported effort levels per profile; the declared effort is sent per request but the local server may ignore the parameter.i18n: new key
settings:experimental.DYNAMIC_THINKING_EFFORT.hintadded to all 18 locales (tab-indented JSON, CRLF preserved,node scripts/find-missing-translations.jspasses).Tests (all passing)
provider-settings.test.ts): schema accepts canonical declarations across provider branches, rejects non-canonical values ("turbo") and the"disable"sentinel, accepts empty/omitted. Full types suite: 382 passed.src/api/__tests__/model-capabilities.spec.ts): registry-wins (array + boolean), fill-in, empty/undefined declaration = no-op, no shared mutation.src/api/providers/__tests__/f7-declared-reasoning-effort.spec.ts): fill-in visible atgetModel()for OpenAiHandler (sane defaults + custom model info), LmStudio, NativeOllama (via publicfetchModel()), BaseOpenAiCompatibleProvider subclasses, and RouterProvider fallback (LiteLLM); registry-wins and no-declaration no-ops.webview-ui/src/utils/__tests__/thinkingEffort.spec.ts): undefined capability +supportedReasoningEfforts: ['low','high','max']resolves with those levels; registry value wins over declaration; no declaration = null; disable-sentinel exclusion preserved.pnpm --filter @roo-code/vscode-webview exec tscand rootpnpm check-types(turbo) both exit 0; eslint clean on changed files;src/eslint-suppressions.jsonunchanged.Branch note (addendum pattern)
Per the established DTE addendum-PR pattern (same as
feat/dte-5-e2e/feat/dte-3-e2e), this branch is cut from the composed DTE head9b6c8bc9f(feat/dte-trial-all), so the diff vs upstreammainincludes the whole 7-PR DTE series. The new F7 delta vs9b6c8bc9fis 32 files: +621/−39 lines.Related
Checklist
supportedReasoningEfforts) round-trips: types schema → extension → webview statesrc/eslint-suppressions.jsonunchangedDocumentation impact
No user-facing docs required: the feature is gated behind the
DYNAMIC_THINKING_EFFORTexperiment, and an in-app hint under the DTE row of the experimental settings documents the new provider setting (localized, 18 locales).Summary by CodeRabbit