This repository was archived by the owner on May 15, 2026. It is now read-only.
Commit 6b186b4
committed
fix: preserve selected model during AI-initiated mode switches
When the AI agent uses the switch_mode tool, the user's selected model
should not change. Previously, handleModeSwitch would load mode-specific
API configurations even for AI-initiated switches, unexpectedly changing
the model mid-task.
This adds a preserveApiConfig option to handleModeSwitch and passes it
from SwitchModeTool so the current API config is preserved. User-initiated
mode switches from the UI continue to load per-mode configs as before.
Closes #122371 parent ad25634 commit 6b186b4
3 files changed
Lines changed: 30 additions & 5 deletions
File tree
- src/core
- tools
- webview
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1391 | 1391 | | |
1392 | 1392 | | |
1393 | 1393 | | |
1394 | | - | |
| 1394 | + | |
1395 | 1395 | | |
1396 | 1396 | | |
1397 | 1397 | | |
| |||
1426 | 1426 | | |
1427 | 1427 | | |
1428 | 1428 | | |
1429 | | - | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
1430 | 1432 | | |
1431 | | - | |
| 1433 | + | |
1432 | 1434 | | |
1433 | 1435 | | |
1434 | 1436 | | |
| |||
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
345 | 367 | | |
346 | 368 | | |
347 | 369 | | |
| |||
0 commit comments