Skip to content

Show setup script progress and output - #227

Merged
nthomsencph merged 10 commits into
mainfrom
feat/201-setup-progress
Nov 9, 2026
Merged

nthomsencph merged 10 commits into
mainfrom
feat/201-setup-progress

Conversation

@nthomsencph

@nthomsencph nthomsencph commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #229; merge after it.

What was missing

Setup scripts ran through execAsync with no visible output. While one ran, the task looked stuck. A failure showed only a toast with a clipped stderr line, and there was no way to read the log or run setup again.

What changed

  • Main: setup runs through a streaming spawn. Command resolution, cwd, env and the 10-minute timeout are unchanged. The last ~1 MB of stdout and stderr is kept in memory per worktree (src/main/services/setupRuns.ts). State and batched output go to the renderer on worktree:setupChanged and worktree:setupOutput. worktree:setupRerun runs a task's setup again; it refuses while one is running or when the worktree folder is gone.
  • Process cleanup:
    • The command runs in its own process group (taskkill /T /F on Windows).
    • A timeout closes the pipes, sends SIGTERM, escalates to SIGKILL and settles once on exit or close. When a stopped run settles, the rest of its group is killed.
    • Archiving or deleting the task kills the run without a toast and sends worktree:setupForgotten.
    • Quit kills every run first, with SIGKILL.
  • Renderer: setupStore follows the runs. A failure toast has a View output action.
  • UI:
    • A running setup shows "Setting up…" with a spinner on the task's sidebar row and in the task header. A failed run shows "Setup failed" until the next run.
    • The task's drawer terminal gets a Setup tab for any task with a setup run this session. It is not a saved drawer tab and has no PTY: it renders main's log in a read-only xterm, so colours survive, and the log stays live while the script runs. Its header has Run setup again.
    • The toast, row badge, header badge and the menu's Setup output all select the task, expand the drawer and open the tab. If the drawer sits in a collapsed inspector, the inspector opens too.
    • The menu also has Run setup again.

Verification

  • pnpm type-check passes.
  • pnpm lint: 0 errors.
  • pnpm test passes.
  • New tests cover:
    • the capped log and the failure message
    • the runner, with a real shell: both streams, exit code, timeout kill, a SIGTERM-ignoring command and grandchild, forget, quit
    • the store and the log feed, through getState() and the IPC mock

Still needs a manual check in a dev instance:

  • the Setup tab appearing, its live xterm output and colours
  • switching between it and the shell tabs (the PTY tab re-attaches)
  • opening it from the toast, row, header and menu, with the drawer collapsed and in both drawer positions
  • the spinner and failed states
  • rerun from the tab and the menu

Fixes #201

🤖 Generated with Claude Code

Setup scripts ran through execAsync with no output. They now run through
a streaming spawn (same command resolution, cwd, env and 10-minute
timeout, killing the whole process group), with the last ~1 MB of
stdout and stderr kept in memory per worktree. Run state and batched
output go to the renderer over worktree:setupChanged/setupOutput, and
worktree:setupRerun runs a task's setup again.

Claude goes brr.. via Dash
setupStore follows main's setup runs, keeps the open view's log live,
and toasts a failure with a View output action.

Claude goes brr.. via Dash
A task whose worktree setup is running shows "Setting up…" on its
sidebar row and in the task header; a failed run shows "Setup failed"
until the next one. Either opens the setup output, which follows the
log live and has "Run setup again". The task menu gains Setup output
and Run setup again.

Fixes #201

Claude goes brr.. via Dash
Forgetting a run (task archived or deleted) now kills its process tree
and ends it quietly, and tells the renderer to drop it. Quit kills every
run, since they run detached. A timeout cuts the pipes, escalates to
SIGKILL after a grace period and settles on exit, so a command that
ignores SIGTERM or leaves a child holding stdout can't stay running.
Windows kills the tree with taskkill /T /F. Rerun refuses a missing
worktree folder. The modal's close button is an IconButton and the
small status icons use stroke 2.

Claude goes brr.. via Dash
Quit now kills setup runs before any other cleanup, with SIGKILL at
once, so a hung step or a script that ignores SIGTERM can't outlive
Dash. The SIGKILL escalation no longer waits on the leader's exit,
which may already have fired while a grandchild holds the pipes: when
a stopped run settles, the rest of its group is killed and the timer
cleared.

Claude goes brr.. via Dash
The setup output moves from a modal to a Setup tab in the drawer
terminal, shown for a task that has had a setup run this session. It is
not a drawer_tabs row and spawns nothing: a read-only xterm renders
main's log with its colours, live while the script runs, with Run setup
again in its header. The toast, the row and header badges and the menu
select the task, expand the drawer (and the inspector when the drawer
lives there) and open the tab. A forgotten run takes its tab with it.

Claude goes brr.. via Dash
The Setup tab's xterm now follows the theme, terminal theme and font
settings live, the same values App feeds the session registry. Picking
a Setup tab selects the task through a shared projectsStore.selectTask,
so it clears a rotation exclusion like any selection. A request opens a
collapsed inspector once, and one for a path no task owns is dropped.
Any switch of the active drawer tab leaves the Setup tab. Small icons
use stroke 1.8 like their neighbours.

Claude goes brr.. via Dash
Clearing a request reset its seq, so every later request was seq 1 and
App's once-per-request guard ignored it. The seq now comes from a
counter that never resets.

Claude goes brr.. via Dash
TaskService's killTaskTerminals, which archive and delete both run,
now also ends the task's setup run, instead of archive and
removeWorktree each doing it. The xterm font metrics and the glass
background move to terminal/terminalOptions.ts, used by the task
terminals and the Setup log alike.

Claude goes brr.. via Dash
setupRuns sends through main's broadcast helper, the setup listeners in
preload use listen<T>, and the renderer finds tasks with selectTaskById
and selectTaskByPath instead of its own loops.

Claude goes brr.. via Dash
@nthomsencph
nthomsencph force-pushed the feat/201-setup-progress branch from 2f088aa to 167c9cc Compare November 8, 2026 23:42
@nthomsencph
nthomsencph changed the base branch from main to refactor/shared-plumbing November 8, 2026 23:42
@nthomsencph
nthomsencph changed the base branch from refactor/shared-plumbing to main November 8, 2026 23:58
@nthomsencph
nthomsencph changed the base branch from main to refactor/shared-plumbing November 9, 2026 00:01
@nthomsencph
nthomsencph changed the base branch from refactor/shared-plumbing to main November 9, 2026 00:02
@nthomsencph
nthomsencph merged commit 490e650 into main Nov 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show setup script progress and output

1 participant