fix: default reasoning to high and respect last-used choice#2075
Merged
k11kirky merged 1 commit intoMay 6, 2026
Conversation
Default reasoning level for the claude adapter was "medium". Restore the prior "high" default and persist the user's last-selected reasoning so subsequent task creations respect their choice across adapters and models (validating against the available options for the active model). Generated-By: PostHog Code Task-Id: a03c75c5-ae2f-470b-a9c2-856a62bfa72e
joshsny
approved these changes
May 6, 2026
Contributor
joshsny
left a comment
There was a problem hiding this comment.
looks okay, surprising amount of code to change to change this, but would be very happy to be rid of the medium default 🤔
Contributor
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
apps/code/src/renderer/features/task-detail/hooks/usePreviewConfig.ts:171-190
The fallback string `"high"` is hardcoded twice within the same function — once in the `existingIdx >= 0` branch and once in the `existingIdx === -1` branch. Extracting it to a local constant keeps the fallback value in one place and makes future changes trivial.
```suggestion
const { lastUsedReasoningEffort } = useSettingsStore.getState();
const defaultEffort = "high";
const isValidEffort = (effort: unknown): effort is string =>
typeof effort === "string" &&
!!effortOpts?.some((e) => e.value === effort);
if (effortOpts && existingIdx >= 0) {
const currentEffort = updated[existingIdx].currentValue;
const nextEffort = isValidEffort(currentEffort)
? currentEffort
: isValidEffort(lastUsedReasoningEffort)
? lastUsedReasoningEffort
: defaultEffort;
updated[existingIdx] = {
...updated[existingIdx],
currentValue: nextEffort,
options: effortOpts,
} as SessionConfigOption;
} else if (effortOpts && existingIdx === -1) {
const nextEffort = isValidEffort(lastUsedReasoningEffort)
? lastUsedReasoningEffort
: defaultEffort;
```
Reviews (1): Last reviewed commit: "fix: default reasoning to high and respe..." | Re-trigger Greptile |
Comment on lines
+171
to
+190
| const { lastUsedReasoningEffort } = useSettingsStore.getState(); | ||
| const isValidEffort = (effort: unknown): effort is string => | ||
| typeof effort === "string" && | ||
| !!effortOpts?.some((e) => e.value === effort); | ||
| if (effortOpts && existingIdx >= 0) { | ||
| const currentEffort = updated[existingIdx].currentValue; | ||
| const validEffort = effortOpts.some( | ||
| (e) => e.value === currentEffort, | ||
| ) | ||
| const nextEffort = isValidEffort(currentEffort) | ||
| ? currentEffort | ||
| : defaultEffort; | ||
| : isValidEffort(lastUsedReasoningEffort) | ||
| ? lastUsedReasoningEffort | ||
| : "high"; | ||
| updated[existingIdx] = { | ||
| ...updated[existingIdx], | ||
| currentValue: validEffort, | ||
| currentValue: nextEffort, | ||
| options: effortOpts, | ||
| } as SessionConfigOption; | ||
| } else if (effortOpts && existingIdx === -1) { | ||
| const nextEffort = isValidEffort(lastUsedReasoningEffort) | ||
| ? lastUsedReasoningEffort | ||
| : "high"; |
Contributor
There was a problem hiding this comment.
The fallback string
"high" is hardcoded twice within the same function — once in the existingIdx >= 0 branch and once in the existingIdx === -1 branch. Extracting it to a local constant keeps the fallback value in one place and makes future changes trivial.
Suggested change
| const { lastUsedReasoningEffort } = useSettingsStore.getState(); | |
| const isValidEffort = (effort: unknown): effort is string => | |
| typeof effort === "string" && | |
| !!effortOpts?.some((e) => e.value === effort); | |
| if (effortOpts && existingIdx >= 0) { | |
| const currentEffort = updated[existingIdx].currentValue; | |
| const validEffort = effortOpts.some( | |
| (e) => e.value === currentEffort, | |
| ) | |
| const nextEffort = isValidEffort(currentEffort) | |
| ? currentEffort | |
| : defaultEffort; | |
| : isValidEffort(lastUsedReasoningEffort) | |
| ? lastUsedReasoningEffort | |
| : "high"; | |
| updated[existingIdx] = { | |
| ...updated[existingIdx], | |
| currentValue: validEffort, | |
| currentValue: nextEffort, | |
| options: effortOpts, | |
| } as SessionConfigOption; | |
| } else if (effortOpts && existingIdx === -1) { | |
| const nextEffort = isValidEffort(lastUsedReasoningEffort) | |
| ? lastUsedReasoningEffort | |
| : "high"; | |
| const { lastUsedReasoningEffort } = useSettingsStore.getState(); | |
| const defaultEffort = "high"; | |
| const isValidEffort = (effort: unknown): effort is string => | |
| typeof effort === "string" && | |
| !!effortOpts?.some((e) => e.value === effort); | |
| if (effortOpts && existingIdx >= 0) { | |
| const currentEffort = updated[existingIdx].currentValue; | |
| const nextEffort = isValidEffort(currentEffort) | |
| ? currentEffort | |
| : isValidEffort(lastUsedReasoningEffort) | |
| ? lastUsedReasoningEffort | |
| : defaultEffort; | |
| updated[existingIdx] = { | |
| ...updated[existingIdx], | |
| currentValue: nextEffort, | |
| options: effortOpts, | |
| } as SessionConfigOption; | |
| } else if (effortOpts && existingIdx === -1) { | |
| const nextEffort = isValidEffort(lastUsedReasoningEffort) | |
| ? lastUsedReasoningEffort | |
| : defaultEffort; |
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/task-detail/hooks/usePreviewConfig.ts
Line: 171-190
Comment:
The fallback string `"high"` is hardcoded twice within the same function — once in the `existingIdx >= 0` branch and once in the `existingIdx === -1` branch. Extracting it to a local constant keeps the fallback value in one place and makes future changes trivial.
```suggestion
const { lastUsedReasoningEffort } = useSettingsStore.getState();
const defaultEffort = "high";
const isValidEffort = (effort: unknown): effort is string =>
typeof effort === "string" &&
!!effortOpts?.some((e) => e.value === effort);
if (effortOpts && existingIdx >= 0) {
const currentEffort = updated[existingIdx].currentValue;
const nextEffort = isValidEffort(currentEffort)
? currentEffort
: isValidEffort(lastUsedReasoningEffort)
? lastUsedReasoningEffort
: defaultEffort;
updated[existingIdx] = {
...updated[existingIdx],
currentValue: nextEffort,
options: effortOpts,
} as SessionConfigOption;
} else if (effortOpts && existingIdx === -1) {
const nextEffort = isValidEffort(lastUsedReasoningEffort)
? lastUsedReasoningEffort
: defaultEffort;
```
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
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
The default reasoning effort for the claude adapter had been lowered to "medium". This restores the prior "high" default and persists the user's last-selected reasoning so subsequent task creations respect that choice.
currentValue: "high"for both adapters (apps/code/src/main/services/agent/service.ts).lastUsedReasoningEffortto the settings store and persists it on every reasoning-level change in the task input.usePreviewConfignow readslastUsedReasoningEfforton initial load and on model changes, validating it against the available options for the active model and falling back to "high" when the persisted value isn't supported (e.g. switching from a model that supportsmaxto one that doesn't, or switching adapters).Test plan
pnpm --filter code typecheckpnpm --filter code test(1132 passed)pnpm lintCreated with PostHog Code