fix(web): allow switching away from Ultrathink without manual prompt editing#1307
fix(web): allow switching away from Ultrathink without manual prompt editing#1307Marve10s wants to merge 3 commits intopingdotgg:mainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
…prompt editing When Ultrathink was active, the effort dropdown was fully disabled, requiring the user to manually remove the "Ultrathink:" prefix from the prompt. Now selecting a different effort level automatically strips the prefix and applies the new effort.
2fd7aff to
8a2887b
Compare
|
screenshot/video w/ before/after pls also, i considered this but the ultrathink can be anywhere in the prompt and i didn't wanna do a eager find-replace and mutate the users prompt, but aybe i was wrong |
|
@juliusmarminge here you go: Before : zen_Bfbs8zBqAN.mp4After : zen_Nrpw8JqT6F.mp4 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| return; | ||
| } | ||
| if (ultrathinkPromptControlled) { | ||
| const stripped = prompt.replace(/\bultrathink\b:?\s*/i, ""); |
There was a problem hiding this comment.
Strip regex doesn't fully clear detection, causing state inconsistency
Low Severity
The stripping regex /\bultrathink\b:?\s*/i only removes the first occurrence of "ultrathink" (no g flag), but isClaudeUltrathinkPrompt detects it anywhere via /\bultrathink\b/i. If a prompt contains "ultrathink" more than once — e.g. the UI-added Ultrathink: prefix plus a natural occurrence in the body text — stripping removes only the prefix while the remaining occurrence keeps ultrathinkPromptControlled true on the next render. The radio group then still displays "Ultrathink" as selected, but setProviderModelOptions already changed the stored effort, creating an inconsistent UI/state.
There was a problem hiding this comment.
The g flag deletes all instances of "ultrathink" from the user prompt.
Example
Input prompt: "Ultrathink: please ultrathink about this problem"
Without g flag
When switching away from ultrathink:
- Strip result:
"please ultrathink about this problem" isClaudeUltrathinkPromptstill detects"ultrathink"→ UI stays on "Ultrathink" (Bugbot's inconsistency)- User's natural text is preserved
With g flag
Same prompt: "Ultrathink: please ultrathink about this problem"
When switching away from ultrathink:
- Strip result:
"please about this problem" isClaudeUltrathinkPromptreturnsfalse→ UI correctly switches- User's sentence is now mangled
I still think current version is better, we only targeting ultrathink that t3 code provides in the prompt, not written by user manually.


Summary
Ultrathink:prefix from the prompt and applies the new effort.Test plan
Ultrathink:prefixUltrathink:prefix is removed, effort switchesNote
Allow switching away from Ultrathink effort without manual prompt editing
ultrathinkprefix from the prompt (case-insensitive, word-boundary regex) and applies the new effort setting viaonPromptChange.handleEffortChangecallback inClaudeTraitsPicker.tsxno longer early-returns whenultrathinkPromptControlledis true, so prompt mutation now happens automatically on effort switch.Macroscope summarized aa6cd57.
Note
Low Risk
Low risk: small UI/UX behavior change limited to Claude effort selection; main risk is incorrect prompt stripping via regex leading to unexpected prompt edits.
Overview
Improves Claude Effort switching when
Ultrathink:is present in the prompt. The Effort menu is no longer disabled or showing the “remove Ultrathink…” message; instead it remains interactive, highlightsUltrathinkas the active radio value when prompt-controlled, and strips theultrathinkprefix from the prompt when the user selects a non-ultrathinkeffort.Updates browser tests for both
ClaudeTraitsPickerandCompactComposerControlsMenuto reflect the new selectable behavior and removal of the prior messaging.Written by Cursor Bugbot for commit 2a3c003. This will update automatically on new commits. Configure here.