fix(desktop): stop forwarding Chat modes to terminal fallback launches

HA
3h ago
+202-14

Fixes #9313

Problem

createNewAgentSession tries to open a Chat pane first. If openAgentChat returns null (the Chat setting is off, the cloud userSettings.get request failed, or the agent has no ACP harness), it fell back to a terminal launch via agents.run and forwarded modeId as the terminal mode. modeId is a Chat (ACP) permission mode such as auto. Terminal launch modes are a separate namespace (AGENT_MODE_SUPPORT only lists omp), so for Claude the host always rejected it with "Claude does not support a launch mode override".

#9246 fixed the workspace-create path on the host. This PR fixes the remaining renderer fallback.

Change

  • New pure util useAgentSessionLauncher/utils/terminalFallbackLaunch builds the terminal fallback input. It never includes mode.
  • If the request carries a Chat mode (and isn't a fork), Chat was the intent, so the hook shows a clear "Couldn't open chat" toast and doesn't launch a terminal or show the confusing host error.
  • Translations for both new strings added to every locale.

Today only the pending chat handoff (useRunPendingChatHandoff) passes a modeId. Other callers have no mode and behave as before.

Validation

  • bun test for the new util (2 tests): a Chat-mode request maps to chat-unavailable, and a terminal launch never carries mode.
  • apps/desktop: bun run typecheck and the full bun test run (9543 pass, 0 fail).
  • bun run check:i18n and the packages/i18n tests pass. Biome is clean.
  • Not tested by hand in the running app.

Summary by cubic

Fixes the remaining renderer path that forwarded Chat permission modes to terminal launches, which Claude rejected with "Claude does not support a launch mode override" when Chat couldn't open.

The terminal fallback now builds launch input through the new terminalFallbackLaunch util, which never includes mode. When a request carries a Chat mode and isn't a fork, Chat was the intent, so the hook shows a clear "Couldn't open chat" toast instead of launching a terminal or surfacing the host error. Both new strings are translated in every locale; other callers without a mode behave as before.

Summary by CodeRabbit

  • Bug Fixes
    • When a chat can’t be opened, the app now explains possible causes and suggests checking chat settings and connectivity.
    • Requests that can’t launch as a chat can fall back to a terminal session, while preserving supported launch details.
    • Added translated error messages in supported languages.