Skip to content

fix: default reasoning to high and respect last-used choice#2075

Merged
k11kirky merged 1 commit into
mainfrom
posthog-code/default-reasoning-high-respect-last-used
May 6, 2026
Merged

fix: default reasoning to high and respect last-used choice#2075
k11kirky merged 1 commit into
mainfrom
posthog-code/default-reasoning-high-respect-last-used

Conversation

@k11kirky
Copy link
Copy Markdown
Contributor

@k11kirky k11kirky commented May 6, 2026

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.

  • Server-side preview config now returns currentValue: "high" for both adapters (apps/code/src/main/services/agent/service.ts).
  • Adds lastUsedReasoningEffort to the settings store and persists it on every reasoning-level change in the task input.
  • usePreviewConfig now reads lastUsedReasoningEffort on 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 supports max to one that doesn't, or switching adapters).

Test plan

  • pnpm --filter code typecheck
  • pnpm --filter code test (1132 passed)
  • pnpm lint
  • Manual: open task input, verify default reasoning is "High"
  • Manual: change reasoning to "Low", create task, return to task input — should still show "Low"
  • Manual: switch from claude (with effort = "max") to codex — should fall back to "high" since "max" isn't a codex option
  • Manual: switch model within claude to one that doesn't support effort — selector should disappear cleanly

Created with PostHog Code

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
Copy link
Copy Markdown
Contributor

@joshsny joshsny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks okay, surprising amount of code to change to change this, but would be very happy to be rid of the medium default 🤔

@k11kirky k11kirky marked this pull request as ready for review May 6, 2026 19:56
@k11kirky k11kirky merged commit 0b0f266 into main May 6, 2026
15 checks passed
@k11kirky k11kirky deleted the posthog-code/default-reasoning-high-respect-last-used branch May 6, 2026 19:56
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 6, 2026

Prompt To Fix All With AI
Fix 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";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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!

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.

2 participants