Roo-Code/apps
Chris Estreich aa49871a5d
fix(cli): resolve race condition causing provider switch during mode changes (#11205)
When using slash commands with `mode:` frontmatter (e.g., `/cli-release`
with `mode: code`), the CLI would fail with "Could not resolve
authentication method" from the Anthropic SDK, even when using a
non-Anthropic provider like `--provider roo`.

Root cause: In `markWebviewReady()`, the `webviewDidLaunch` message was
sent before `updateSettings`, creating a race condition. The
`webviewDidLaunch` handler's "first-time init" sync would read
`getState()` before CLI-provided settings were applied to the context
proxy. Since `getState()` defaults `apiProvider` to "anthropic" when
unset, this default was saved to the provider profile. When a slash
command triggered `handleModeSwitch()`, it found this corrupted profile
with `apiProvider: "anthropic"` (but no API key) and activated it,
overwriting the CLI's working roo provider configuration.

Fix:
1. Reorder `markWebviewReady()` to send `updateSettings` before
   `webviewDidLaunch`, ensuring the context proxy has CLI-provided
   values when the initialization handler runs.
2. Guard the first-time init sync with `checkExistKey(apiConfiguration)`
   to prevent saving a profile with only the default "anthropic"
   fallback and no actual API keys configured.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 18:26:41 -08:00
..
cli fix(cli): resolve race condition causing provider switch during mode changes (#11205) 2026-02-04 18:26:41 -08:00
vscode-e2e refactor(read_file): Codex-inspired read_file refactor EXT-617 (#10981) 2026-01-29 15:16:32 -07:00
vscode-nightly Revert experiments with nightly marketplace config (#6472) 2025-07-30 23:37:42 -04:00
web-evals Update next.js (#11108) 2026-01-30 02:08:45 -08:00
web-roo-code feat(web): Replace bespoke navigation menu with shadcn navigation menu (#11117) 2026-01-30 09:38:46 -08:00