fix(desktop): repair terminal preset launches

Merged
SS
5mo ago
+594-117

Description

Fixes regressions in desktop terminal presets that were discussed with Kiet before opening this PR.

Scope:

  • Preserves the preset Directory/cwd when launching terminal commands.
  • Keeps sequential as a valid execution mode instead of normalizing it away.
  • Adds the grouped sequential launch option as All in current tab.
  • Runs grouped sequential presets in one terminal without split panes.
  • Runs applyOnNewTab presets when creating a new terminal tab, including the new-tab hotkey path.
  • Keeps preset terminal labels visible for reused/default terminals without renaming an already labeled terminal.

Related Issues

No GitHub issue. Discussed with Kiet in Slack; he confirmed this was a regression and said a PR would be welcome.

Type of Change

Bug fix.

Testing

  • bun test apps/desktop/src/renderer/stores/tabs/preset-launch.test.ts apps/desktop/src/lib/trpc/routers/settings/preset-execution-mode.test.ts apps/desktop/src/renderer/lib/terminal/launch-command.test.ts 'apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/TerminalPane/components/TerminalSessionDropdown/TerminalSessionDropdown.utils.test.ts'
  • bun run typecheck --filter=@superset/desktop --filter=@superset/api --filter=@superset/auth
  • bun run lint

Demo

https://github.com/user-attachments/assets/703608de-9a1d-407c-a17f-249ba491327a

Reviewer Notes

  • This PR is scoped to terminal preset behavior only.

Open in Stage

Summary by cubic

Fixes terminal preset launches in desktop: preserves preset cwd, restores sequential execution, auto-applies presets on new tabs, and keeps preset/user titles visible when reusing terminals.

  • Bug Fixes
    • Respect preset Directory/cwd for all launches; sequential runs prepend cd when reusing a terminal.
    • Keep sequential as a valid mode and run grouped sequential presets in one terminal (no split panes); reuse the active terminal when available, else open one new tab.
    • Auto-run applyOnNewTab presets when creating a new terminal tab (UI and hotkey); project-targeted presets take priority over global.
    • Preserve preset labels on reused/default terminals and prefer explicit pane titles over runtime/session titles in the session dropdown.
    • Update UI to show “All in current tab” for sequential multi-command presets.

Summary by CodeRabbit

  • New Features

    • Added "Sequential" execution mode for terminal presets — run all preset commands in the current terminal tab.
  • Improvements

    • UI now shows more consistent terminal titles and improved preset mode labels.
    • Preset execution respects working directory and can inject focused commands into existing terminals.
    • Hotkey and "add terminal" flows now respect preset-driven tab creation.
  • Tests

    • Expanded test coverage for the new mode and title/command behaviors.

Review Change Stack