feat(desktop): close the Workspace Setup tab when setup succeeds
What & why
The "Workspace Setup" tab ends at a shell prompt whether setup succeeded or failed, so you have to close it by hand after every good run. This PR adds an opt-in setting that closes the tab when setup exits 0 and leaves it open when setup fails, so failures stay visible.
- Setting: "Close Workspace Setup tab when setup succeeds" under Settings → Experimental, next to "Wait for workspace setup before starting agents". It is off by default. It is stored in local-db (migration
0060) and is in the CLI settings registry ascloseSetupOnSuccess. - Report the result: the desktop sends
closeSetupOnSuccesswithworkspaces.create. The new input field is optional, so older hosts ignore it. When it is on, the host appends a private OSC 777 marker to the setup command with&&:setup && printf '\033]777;superset-setup-succeeded\007'. This is the same shape as the existing777;superset-shell-readymarker. The echoed command line contains the literal text\033, not an ESC byte, so the echo cannot match. - Close the tab: the host scans only that terminal's output for the marker (
setup-succeeded-marker.ts). On a match, it closes the setup pane through the existing pane-layout bridge, the same path assuperset panes close. That path also kills the session, so the desktop does not adopt the live shell into a new tab later. A fast setup can finish before the desktop writes the tab, so a missing pane is retried (30 × 1 s,close-setup-pane.ts). - Left alone:
- setup fails: no marker is printed, so the tab stays open with the error;
- an agent is chained into the setup terminal (wait-for-setup): the agent's tab must stay open;
- no desktop app is attached to the host: no marker is appended.
Kept out of scope, as agreed on the issue: a failed badge in the sidebar and a config.json key.
Closes #8038
How I tested it
I ran the dev desktop app from this branch with CDP (RENDERER_REMOTE_DEBUG_PORT), signed in as the local dev admin. I used a test repo whose .superset/config.json setup echoes, sleeps, and fails when a flag file exists. I created each workspace through the new-workspace composer with "No agent".
- Setting off (baseline): setup succeeds and the Workspace Setup tab stays open at a prompt.
- Turned the setting on in Settings → Experimental:
settings.getCloseSetupOnSuccessreturnstrue. - Setup succeeds: the tab closes.
terminal.listfor the workspace is empty and "Background processes" shows "Nothing running". - Setup fails (flag file present): the tab stays open with the error, and the marker is not printed.
- Navigated to another workspace while setup ran (the workspace is not mounted): during setup the workspace had 1 terminal and 1 tab, afterwards 0 and 0. When I went back, the tab was not re-adopted.
The wait-for-setup + agent case is covered by a unit test only, not end to end.
Screenshots: to be added.
bun run lint: clean.bun run typecheck: 40/40.bun run check:i18n: passes, with translations for every locale.- Tests: the full host-service suite (2681 pass), the CLI settings tests, the i18n tests, and the related desktop tests. New tests cover the marker scanner (including a marker split across chunks and the echoed command line), the setup command builder (including the chained-agent case), and the close retry.
Checklist
- PR title follows conventional commits (
type(scope): subject) -
bun run lintandbun run typecheckpass (CI fails on lint warnings too) - "Allow edits from maintainers" is checked on fork PRs
- I have signed the CLA (the bot asks on your first PR)
Summary by cubic
Adds an opt-in Experimental setting, "Close Workspace Setup tab when setup succeeds", so a successful workspace setup no longer leaves the tab sitting at a shell prompt. When setup fails or the setting is off, behavior is unchanged and the tab stays open.
How it works
- The setting lives under Settings → Experimental, defaults to off, and is stored in local-db via migration
0060. - The desktop sends
closeSetupOnSuccesswithworkspaces.create; older hosts ignore the optional field. - When enabled, the host appends a marker command to the setup with
&&, so the marker only prints on exit 0, and the host closes the pane when it sees it. Multi-line commands and commands with#comments are wrapped in a shell group so the marker isn't swallowed; newline commands are staged as a script so they aren't submitted line by line. - The close intent is stored on the terminal session row (host migration
0039), restored after a host restart, and the pane closer is registered once at host start. - Closing the pane also ends the session; the close is retried for 30 seconds because a fast setup can finish before the desktop writes the tab.
- The close is skipped when an agent is chained into the setup terminal or when no desktop app is attached.
Summary by CodeRabbit
- New Features
- Added an experimental setting to automatically close the Workspace Setup tab after setup succeeds. The tab stays open if setup fails, so errors remain visible.
- The setting is off by default and can be changed in Experimental Settings. It applies when creating workspaces and is available through settings search.
- The preference is also available in the CLI settings registry, and the setting’s label and description are translated into supported languages.