Skip to content

fix(app): agent switch should not reset thinking level#17470

Merged
nexxeln merged 2 commits intoanomalyco:devfrom
bugulo:fix/agent-switch-resets-variant
Mar 16, 2026
Merged

fix(app): agent switch should not reset thinking level#17470
nexxeln merged 2 commits intoanomalyco:devfrom
bugulo:fix/agent-switch-resets-variant

Conversation

@bugulo
Copy link
Contributor

@bugulo bugulo commented Mar 14, 2026

Issue for this PR

Closes #17469

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

agent.set() in local.tsx overwrites the entire per-session state when switching modes (Build/Plan/Docs). Since most agents don't configure a model or variant, the user's thinking level selection gets replaced with undefined, resetting it to default.

The fix merges with the existing scope() state using ?? so user selections are preserved when the agent doesn't explicitly override them.

How did you verify your code works?

  1. Selected Claude Sonnet with "Max thinking"
  2. Switched from Build to Plan and back
  3. Variant stays on "Max thinking" throughout

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Before

thinking_reset.mp4

After

thinking_fix_after.mp4

@bugulo bugulo requested a review from adamdotdevin as a code owner March 14, 2026 10:20
@nexxeln nexxeln merged commit 15b27e0 into anomalyco:dev Mar 16, 2026
10 checks passed
ConanXu-math pushed a commit to ConanXu-math/opencode that referenced this pull request Mar 17, 2026
AvatarGanymede pushed a commit to AvatarGanymede/opencode-dev that referenced this pull request Mar 19, 2026
demostanis pushed a commit to demostanis/opencode that referenced this pull request Mar 19, 2026
demostanis pushed a commit to demostanis/opencode that referenced this pull request Mar 20, 2026
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.

[BUG] Agent mode switch resets thinking level to default

2 participants