fix(workspaces): accept chat permission modes when creating a workspace with a prompt
What & why
SUPER-1019, reported by Martin in Slack (#ext-martin): "Couldn't create workspace" when a workspace is created with a prompt, and the typed prompt is lost. Before/after page: https://app.superset.sh/page/super-3084-super-1019-chat-interrupt-and-lost-prom-l5ahb4
Regression from #8971 (Oct 30). The New Workspace composer started to send the chat permission mode (default, acceptEdits, auto, plan, and Codex modes) as mode. The host checks mode against the terminal launch-mode list (from #6851), which has no Claude entry. So every chat mode except the default (Full access, which the desktop does not send) failed with "Claude does not support a launch mode override".
- Host:
validateAgentModeSelectionchecks asurface: "chat"launch against the harness's chat start modes (acpStartModes). Terminal launches keep the terminal list, and they still reject chat modes.chatLaunchTargetchecks the chat mode too. - Desktop: the create error screen shows the prompt that was sent, with a Copy button. The composer clears the draft on submit, so before this a failed create lost the prompt.
SUPER-3084 ("[Request interrupted by user]" in chat) is not in this PR. The marker is accurate when the user really stops a turn, and Kiet is handling the restart case where the chat should continue by itself.
How I tested it
packages/host-serviceagents.test.ts: newvalidateAgentLaunchOptionstests use a real migrated SQLite DB and a Claude agent row. On main, 2 of the 3 fail with the exact error from Martin's screenshot. With the fix, 69/69 pass.apps/desktop:failedCreatePrompttests (3 pass).tscclean for host-service and desktop. Biome clean on the touched files.bun run check:i18npasses ("Your prompt" is translated in every locale).- Before/after screenshots of the real error screen are on the page linked above (rendered in Storybook).
- End to end in the dev desktop, driven over CDP with real clicks and typing. Steps: New Workspace, No project on This device, Claude in "Approve for me", type a prompt, submit.
- On main (
876e8a308): "Couldn't create workspace" with "Claude does not support a launch mode override. Omit mode to use the agent default." The typed prompt is gone. Same as Martin's screenshot. - On this branch: the session is created, the chat opens in "Approve for me", and the prompt is delivered to the agent. Claude then asks to sign in, because this sandbox has no Claude login. That happens after the launch and is unrelated.
- On main (
- Not covered end to end: the new prompt-and-Copy block on the error screen, because the fix stops this error from happening. It is covered by the
failedCreatePrompttests and the Storybook render on the page.
Compatibility
No tRPC input or output shape changed. The host only accepts more mode values, so released clients are not affected. Released desktops that talk to an older host still hit this until that host updates. The workaround is to pick Full access.
Known gap
Chat launch that falls back to a terminal. The host runs a surface: "chat" launch as a terminal when the chat path can't take it: an effort is set, an attachment does not resolve, or the chat runtime can't run that harness. That path still checks the chat mode against the terminal list and fails. I did not drop the mode there, because the built-in terminal Claude runs --dangerously-skip-permissions. Dropping "Ask for approval" or "Plan" there would quietly give the agent full access. This needs a product decision.
Checklist
- PR title follows conventional commits (
type(scope): subject) - Lint and typecheck pass for the touched packages