Skip to content

[Feat] Add reasoning-effort quick switcher to the chat input - #2634

Draft
zoomote[bot] wants to merge 2 commits into
mainfrom
feature/chat-reasoning-effort-switcher-1fkdx1ktfqkq8
Draft

zoomote[bot] wants to merge 2 commits into
mainfrom
feature/chat-reasoning-effort-switcher-1fkdx1ktfqkq8

Conversation

@zoomote

@zoomote zoomote Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

​Opened on behalf of Toray Altas. Follow up by mentioning @roomote, in the web UI, or in Discord.

Related GitHub Issue

Closes: # (no issue exists yet for this request; it came from a Discord community question. A maintainer can link the approved issue here.)

Related PRs

Description

A community member asked for a way to switch the reasoning effort of a model in the editor without editing settings or creating new profiles. This PR adds a reasoning-effort quick switcher to the chat input footer, next to the mode selector.

Key implementation details:

  • The selector uses the existing useSelectedModel capability data. It renders only when the active model exposes supportsReasoningEffort. The menu offers Default plus exactly the efforts the model supports, so unsupported values are never selectable.
  • The selection persists as a new optional per-profile setting, reasoningEffortOverride (added to baseProviderSettingsShape, so every provider carries it). It never rewrites the profile's saved reasoningEffort or enableReasoningEffort values.
  • buildApiHandler folds the override into the effective settings through a new withReasoningEffortOverride helper. This single point covers streaming, non-streaming, and SSE-fallback request paths for all providers, including the OpenAI-compatible and native OpenAI handlers. The OpenAI-compatible handler now prefers the override over the custom model info effort; without an override, request shapes stay byte-identical to before.
  • Switching to another model clears the override inside the existing updateProfileModel mutation, so a new model never inherits an effort it may not support.
  • The override change flows through the existing profile mutation queue, persistProviderProfile, and updateTaskApiHandlerIfNeeded machinery, so it applies to the next request of the current task and survives restarts.
  • A new gallery story (chat-text-area-reasoning-effort) covers the rendered control.

Anything reviewers must check with care:

  • The visual snapshot baselines for the new gallery story are not committed yet. Docker cannot run in the authoring sandbox, so the baselines will be generated with the pinned visual-regression.yml container after this PR opens, per the fallback in webview-ui/AGENTS.md.

Test Procedure

  • pnpm test (full turbo suite), pnpm check-types, and pnpm lint pass. Note: the two extension.spec.ts focus-tracker tests failed once under full turbo parallelism, but they pass consistently in isolation and in the standalone src suite run; the failure signature is unrelated to this diff.
  • New request-shape tests prove the override reaches the wire: src/api/providers/__tests__/openai.spec.ts (override honored on streaming and non-streaming, override beats custom model info, "disable" omits reasoning, out-of-capability override falls back to the model default, no reasoning for models without support) and src/api/providers/__tests__/openai-native.spec.ts (override honored, capability fallback, required-model default, unchanged shapes without support).
  • Host-side tests cover the mutation path: ClineProvider.apiHandlerRebuild.spec.ts (override stored without rewriting the configured effort, clear on null, invalid value rejected, provider mismatch rejected, task handler rebuilt, override cleared on model change) and webviewMessageHandler.spec.ts (message validation).
  • Webview tests cover the control: ReasoningEffortSelector.spec.tsx (hidden without capability or profile, active-effort label, exact menu contents, override indicator, message payloads, "Off" labeling, unsupported override ignored).
  • Manual check: open a chat with a reasoning-capable profile, pick an effort, and see the next request carry it; pick Default to clear.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (no issue exists yet; created from a Discord community request).
  • Listing Discussion (new provider or MCP server only): I opened a GitHub Discussion for this listing and linked it in the PR description.
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I reviewed my own code with care.
  • Writing Style: The PR title and description use Simplified Technical English (ASD-STE100): short sentences, plain words, active voice, one idea per sentence, no contractions.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Test Helpers (test changes only): Shared test helpers (src/test-utils/, @/utils/test-utils) are used only for mechanical duplication; test intent and scenario-specific mocks remain visible.
  • Visual Snapshot (UI changes only): If a user would notice this change at a glance (layout, theme tokens, brand elements, empty/error states), I added or updated a *.visual.tsx snapshot in webview-ui/. See webview-ui/AGENTS.md → "When a UI change needs a snapshot".
  • Documentation Impact: I checked if my changes need documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I read and agree to the Contributor Guidelines.

Visual Snapshots

ChatTextArea.visual.tsx gains a chat-text-area-reasoning-effort gallery test with resting and open-menu snapshots per theme. The committed container baselines follow via the visual-regression.yml fallback (see Description). Review-aid captures of the shipped control (footer trigger, open menu, override indicator) are in the paired docs PR.

Videos (interaction / animation only)

Not needed. The interaction is a standard pop-up menu; the open-menu snapshots cover the end state.

Documentation Updates

Additional Notes

Providers and models without reasoning-effort capability are unaffected: the control stays hidden and the request shapes are unchanged. For models whose capability array includes disable (for example some Z.ai models), the menu shows an Off entry that turns reasoning off, mirroring the settings page semantics.

Get in Touch

@roomote (working on behalf of Toray Altas)

@zoomote zoomote Bot assigned taltas Nov 21, 2026
@coderabbitai

coderabbitai Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one): 1

  • coderabbit-review-active

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Review status

This PR was opened by an automated account. A human maintainer must verify the change intent, provenance, and validation before merging.

Current step: Mark the PR ready. Required CI must pass before CodeRabbit starts.

Review-state labels are managed by this workflow; do not edit them manually. community-approved is managed the same way — do not add or remove it manually. It signals a fresh community code approval for the current head as an advisory priority only; maintainer review is still required.

@codecov

codecov Bot commented Nov 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.35802% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ui/src/components/chat/ReasoningEffortSelector.tsx 84.78% 1 Missing and 6 partials ⚠️

📢 Thoughts on this report? Let us know!

This branch has not been deployed

No deployments
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