Skip to content

fix(models): default thinking level to high when no effort is set#2766

Merged
charlesvien merged 1 commit into
mainfrom
fix/default-thinking-level-high
Jun 18, 2026
Merged

fix(models): default thinking level to high when no effort is set#2766
charlesvien merged 1 commit into
mainfrom
fix/default-thinking-level-high

Conversation

@charlesvien

Copy link
Copy Markdown
Member

Problem

Users who pick claude-fable-5 hit hard failures whenever a generation runs without a configured effort/thinking level (8 users and 142 failed generations on 06-11 alone, invisible to error monitoring since $ai_http_status=None).

fable-5 only supports adaptive thinking and rejects the SDK's default thinking: { type: "disabled" } with invalid_request_error: "thinking.type.disabled" is not supported for this model. The effort level only reaches the SDK when present, so a fable-5 session with no effort set lets the SDK default to disabled thinking, which fable-5 rejects outright.

Same issue as #2618. This PR takes a different approach: instead of scoping a medium default to fable-5 behind a requiresAdaptiveThinking flag, it makes high the default thinking level for every effort-capable model. That keeps thinking enabled by default and removes the disabled-thinking request shape that fable-5 rejects.

Changes

  • Add DEFAULT_EFFORT ("high") and a resolveEffortForModel helper in session/models.ts. The helper honors an explicit effort, falls back to high for effort-capable models, and leaves models without effort support (e.g. haiku) unset so they keep disabled thinking.
  • In claude-agent.ts createSession, after the gateway modelId is resolved, apply the default effort via applyFlagSettings when the user has not chosen one. Gating on the resolved id (not the raw setting) means the default also applies to the default model and aliases, not just explicit fable-5 picks.
  • Fix the mid-session model-switch path (rebuildEffortConfigOption): when switching to an effort-capable model with no explicit effort, apply the default to the live query instead of only updating the display. This closes the same fable-5 failure when the model is changed from the picker, which fix(models): default fable-5 to adaptive thinking when no effort is set #2618 left open.
  • Default the effort config display and the buildConfigOptions fallback to high so the UI matches the request shape.

How did you test this?

  • Added parameterized unit tests in models.test.ts: resolveEffortForModel (effort-capable models default to high; haiku/opus-4-6 stay unset; explicit effort is honored, including max on fable-5) and DEFAULT_EFFORT === "high".
  • Updated the claude-agent.resume-model.test.ts query mock to include applyFlagSettings (the real SDK query exposes it; the mock did not).
  • Ran pnpm --filter @posthog/agent exec vitest run src/adapters/claude src/server — 486 tests pass.
  • pnpm --filter @posthog/agent typecheck passes; biome check clean on changed files; node scripts/check-host-boundaries.mjs shows no new violations.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 7251bfc.

@charlesvien charlesvien force-pushed the fix/default-thinking-level-high branch from fd8bcfc to 7251bfc Compare June 18, 2026 23:41
@greptile-apps

greptile-apps Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "default thinking level to high for effor..." | Re-trigger Greptile

@charlesvien charlesvien added the Stamphog This will request an autostamp by stamphog on small changes label Jun 18, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Well-motivated fix with clear comments, consistent constant usage, and new tests covering the new function. No showstoppers — purely an internal agent behavior default change within a single package.

@charlesvien charlesvien merged commit 860de03 into main Jun 18, 2026
26 checks passed
@charlesvien charlesvien deleted the fix/default-thinking-level-high branch June 18, 2026 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Stamphog This will request an autostamp by stamphog on small changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant