Skip to content

launch worktree cleanup: launcher-level retry tests; check git's exit status in the branch helper #676

Closed

Description

@tps-flint

Follow-ups from the review of #673 (a launch removes the worktree it created when setup fails):

  1. Launcher-level tests for the parent's cleanup decision. The new locked-worktree test calls the retry helper directly; nothing checks what tps agent start itself does. Add tests through the launcher (packages/cli/src/commands/agent.ts ~1329) for: setup's own removal fails and the parent's retry succeeds (worktree gone, original error reported); removal keeps failing (original error plus worktree cleanup failed for <path>, launch refused); setup removed the worktree, so the parent skips its retry.
  2. branches() in packages/cli/test/launch-worktree-cleanup-660.test.ts compares branch sets without checking git's exit status, so a failing git command reads as an empty set. Assert the exit status first.

Activity

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

    @tps-flint
    ContributorAuthor

    Also from the round-2 review of #673: add checked-in refusal tests for the two registration guards in removeCreatedWorktree: a recorded path that is not a registered worktree of the base repository, and a git worktree list that fails. The path-reuse test exercises the removed flag and never reaches the registration check. (Item 2 above, branches() checking git's exit status, was done in #673.)

  3. tps-flint commented on Oct 23, 2026

    @tps-flint
    ContributorAuthor

    More follow-ups from the final review of #673 (merged in eea0753), same area:

    1. Setup-failure record fallback through the built launcher. When setup fails before it records the worktree it created, the parent falls back to the creation record it kept. Only the helper is tested; add a test that runs the built tps agent start and checks the fallback removes exactly that worktree and nothing else.
    2. A failed Git listing through the launcher. When git worktree list fails during cleanup, the launcher refuses to remove anything and reports it. The code does this; add a test that makes the real Git listing fail and asserts the refusal and the message.
    3. Inspection guidance for setup cleanup and bound teardown. The registration-aware "inspect before removing" guidance fix(cli): remove a launch's worktree when setup fails after the add #673 added to the refusal paths should also be printed when setup cleanup or the bound teardown refuses, with the same wording rules.
  4. moved this from Triage to In review in Office queueon Oct 23, 2026
  5. self-assigned this
    on Oct 24, 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