Skip to content

Recover task and surface error when worktree prep fails (#629)#661

Merged
h0x91b merged 1 commit into
mainfrom
fix/dev3-worktree-prep-failure
Jun 15, 2026
Merged

Recover task and surface error when worktree prep fails (#629)#661
h0x91b merged 1 commit into
mainfrom
fix/dev3-worktree-prep-failure

Conversation

@h0x91b

@h0x91b h0x91b commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #629. When background worktree/PTY preparation failed (empty repo with no commits, or a configured base branch that doesn't exist), the task was left stranded in in-progress with no worktree and no PTY. The terminal showed a misleading dim "[session ended]", the state survived app restarts, and no error reached the user.

  • prepareTaskInBackground now reverts the task to todo via revertPreparingTaskToTodo on a genuine prep failure (cleaning up any half-created worktree and releasing ports) instead of only clearing the preparing spinner.
  • New taskPreparationFailed push message → the renderer surfaces the real error as a toast.error (mirrors the existing columnAgentFailed pattern); i18n added for en/ru/es.
  • git.createWorktree now distinguishes an empty repository (no commits) from a missing base branch and returns a clearer "no commits yet — create an initial commit" message.
  • The drag-drop launch path (moveTask) was already safe (renderer reverts the optimistic update on throw); this change targets the fire-and-forget background prep path used by Launch Variants / Add Attempts.

Reproduce-first: updated the empty-repo test in git-worktree.test.ts and rewrote the four prep-failure tests in rpc-handlers.test.ts to assert revert-to-todo + the new push event. bun run lint and bun run test are green.

Reported by @sworgkh.

Decision record: decisions/069-worktree-prep-failure-revert.md.

Failed background worktree/PTY preparation (empty repo, missing base
branch) left the task stranded in-progress with a misleading
"[session ended]" terminal that survived restarts and showed no error.

Revert the task to todo via revertPreparingTaskToTodo on prep failure
and push a new taskPreparationFailed message that the renderer shows as
a toast. createWorktree now distinguishes an empty repository from a
missing base branch and returns a clearer "no commits yet" message.

Fixes #629
@h0x91b h0x91b enabled auto-merge (squash) June 15, 2026 10:40
@h0x91b h0x91b merged commit 85b9421 into main Jun 15, 2026
4 checks passed
@h0x91b h0x91b deleted the fix/dev3-worktree-prep-failure branch June 15, 2026 10:41
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.

Failed worktree prep shows misleading "[session ended]" and strands task in in-progress

1 participant