fix: don't set session mode for standalone Claude CLI

When launching Claude Code CLI with --dangerously-skip-permissions,
don't set the terminal mode to 'session' since we're not attaching
to an existing session. Keep it in 'mixed' mode instead.

The "Invalid session" error occurred because:
1. We launched claude --dangerously-skip-permissions without a session
2. Then set mode to 'session' which expects a valid session attachment
3. The CLI or backend rejected this as invalid

Fix: Remove the setMode call when using claude-cli terminal type.
Let the CLI create and manage its own session internally.

Resolves: "Invalid session" error when selecting Claude Code CLI

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
uroma
2026-01-19 18:26:34 +00:00
Unverified
parent 9e289cb0a1
commit 3fac4efce3

View File

@@ -224,8 +224,8 @@ class TerminalManager {
// Wait a moment for terminal to be ready
await new Promise(resolve => setTimeout(resolve, 500));
// Launch Claude CLI with skip permissions flag
// Note: Keep mode as 'mixed' since we're not attaching to a session
await this.launchCommand(terminalId, 'claude --dangerously-skip-permissions\n');
await this.setMode(terminalId, 'session');
if (!silent) {
showToast('Claude Code CLI terminal created', 'success');