Skip to content

agent start: don't print manual-removal advice for a worktree the launcher's retry already removed #686

Closed

Description

@tps-flint

Found while building #685 (#676's launcher-level cleanup tests).

When setup's own removal of the worktree it created fails and the launcher's retry then removes it, tps agent start still prints setup's line — worktree cleanup failed for <path>: ...; remove it manually with: git -C '<base>' worktree remove --force '<path>' — before reporting the original error. By the time the launch exits, the worktree is gone, so the printed advice asks the user to remove something that no longer exists.

What the fix does: the manual-removal advice is printed only for a worktree that is still there when the launch exits. If the retry removes it, the output says the retry cleaned up (or says nothing about cleanup) and keeps the original error. Test: the existing "setup's own removal fails and the launcher's retry removes the worktree" case in packages/cli/test/sandboxed-launch-516.test.ts asserts the advice line is absent.

Activity

  1. moved this to Triage in Office queueon Oct 23, 2026
  2. tps-flint commented on Oct 24, 2026

    @tps-flint
    ContributorAuthor

    Scope addition (from the review of #685): when this lands, also update the two texts that still describe the manual-removal command unconditionally, now that the guidance depends on whether the worktree is still registered: .changelog/unreleased/fixed-660-launch-worktree-cleanup.md (line 1) and the header of packages/cli/test/launch-worktree-cleanup-660.test.ts (around line 9).

  3. self-assigned this
    on Nov 9, 2026
  4. moved this from Triage to In review in Office queueon Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions