feat(automations): "Same workspace" option and simpler session chip
Merged
KI
24d ago+851+851+012345678901234567890123456789-389-389-012345678901234567890123456789
Replaces #9347, which GitHub closed when its base branch (#9377) was deleted on merge. The review there is still the reference.
Summary
- The automation editor sentence now reads "using workspace and session mode":
- Workspace: "New workspace" (each run makes its own), "Same workspace" (the first run makes one, later runs reuse it), or a workspace picked by hand.
- Session mode: "Start fresh" (a new agent conversation each run) or "Continue" (the agent picks up where the last run left off). It only shows when runs share a workspace.
- "Same workspace" works with both session modes and keeps reading "Same workspace" after the first run. The menu shows "Reusing name" once a run has made the workspace.
Why / Context
Before, continuing a session needed a workspace picked by hand. The old wording was also confusing: "using New workspace … running continuing the last session" reads as a contradiction, and it doesn't say that anything is kept.
How It Works
- API: new optional
reuseWorkspaceonautomation.createandautomation.update, and on the detail output. planTarget:- Picking a different workspace turns reuse off. A client sending back the workspace a run kept (older desktops send the whole draft) leaves reuse on.
- Asking to continue with no pin, without saying anything about reuse, is read as reuse, so the CLI's
--continue-sessionwithout--workspaceworks. - Continue is dropped when there is neither a pin nor reuse, which is the old behaviour.
- Dispatch: when
reuseWorkspaceis on, the workspace a run creates becomes the pin (pinCreatedWorkspace), unless someone pinned one in the meantime. This covers both local and cloud runs, and runs that replace a deleted pinned workspace.replacePinno longer turns continue off. - Desktop:
WorkspacePickerandCloudWorkspacePickershare a newRunWorkspaceItemscomponent for the "New / Same" options and their hints.SessionModePickernow reads "Start fresh / Continue", joined to the workspace chip by "and". - CLI: removed the client-side
--session+--continue-sessionrefusal; help text andcli-reference.mdxupdated.
Compatibility
- Input and output fields are only added.
- Older desktops don't send
reuseWorkspace. Their saves keep the existing value, and they show a kept workspace by name. - Released CLIs still refuse
--session --continue-sessionlocally, which is harmless.
Manual QA Checklist
Not yet done in a running app:
- Local, "Same workspace" + "Continue": run 1 makes a workspace, and run 2 continues its session in that workspace. The chip still reads "Same workspace", and the menu says "Reusing name".
- Local, "Same workspace" + "Start fresh": run 2 reuses the workspace with a new agent conversation.
- Cloud, both modes: same as above.
- "New workspace": the session chip is hidden, and every run makes its own workspace.
- Pick a workspace by hand: "Same workspace" turns off, and the session chip stays.
- Delete the kept workspace: the next run makes a new one and keeps that.
- Project-less automation: the options read "New session" / "Same session".
Review follow-ups (from #9347)
- The auto-pin now records the run's host with a local workspace, so an automation with no fixed device goes back to the device that has it.
- The editor sends a pin only when the user changed it, so saving a draft loaded before a run kept a workspace no longer unpins it.
- MCP tool descriptions no longer say continuing needs a pinned workspace.
- Not changed: for pull request triggers with "Same workspace", later PRs run in the first PR's checkout. That follows from the option; use "New workspace" for PR automations.
Testing
bun test src/router/automationinpackages/trpc: 49 pass. NewplanTargettests cover reuse with and without continue, sending the kept pin back, picking another workspace, and changing device. I checked that the "picking another workspace" test fails when that rule is removed.bun teston the desktop automations routes: 192 pass.bun run typecheckpasses inpackages/trpcandpackages/cli. Inapps/desktop, the only errors are TS1149 file-casing errors from this worktree's path, none in changed files.bun run check:i18npasses. I translated the 8 new strings into all 17 locales.biome checkpasses on the changed files.pinCreatedWorkspacehas no unit test:packages/trpchas no database harness.
Summary by CodeRabbit
- New Features
- Automations can now reuse the workspace created by their first run, even when no workspace is preselected.
- Choose whether runs start a fresh agent conversation or continue the previous one. Workspace and session choices are available for both local and cloud runs.
- CLI automation commands support continuing sessions without requiring a pinned workspace.
- Improvements
- Workspace and session settings are clearer, with updated labels and descriptions.
- Updated translations for the revised automation options across supported languages.
Summary by cubic
Gives automations a "Same workspace" option so runs can continue an agent session without pinning a workspace by hand.
- The editor now offers "New workspace" or "Same workspace" (the first run creates one, later runs reuse it) and "Start fresh"/"Continue" session modes.
reuseWorkspaceis a new optional field on create/update; when set, the first run's workspace becomes the pin.- Picking a different workspace turns reuse off; continue no longer clears when the host or project changes.
- Older clients that don't send
reuseWorkspacekeep the existing value; the CLI no longer refuses--sessionwith--continue-sessionand its help and docs updated.