Skip to content

Prevent gx doctor sandbox branches from lingering after merge#388

Merged
NagyVikt merged 1 commit intomainfrom
agent/codex/fix-doctor-sandbox-cleanup-2026-04-23-17-49
Apr 23, 2026
Merged

Prevent gx doctor sandbox branches from lingering after merge#388
NagyVikt merged 1 commit intomainfrom
agent/codex/fix-doctor-sandbox-cleanup-2026-04-23-17-49

Conversation

@NagyVikt
Copy link
Copy Markdown
Collaborator

Summary

  • run the doctor sandbox finish flow without repo-wide cleanup side effects
  • explicitly verify and prune the doctor sandbox local worktree/branch plus the remote ref after merge
  • add regression coverage that proves protected-main doctor auto-finish removes the sandbox worktree path

Verification

  • node --test test/doctor.test.js
  • openspec validate --specs

Doctor previously ran agent-branch-finish from inside the sandbox worktree, so merge cleanup could not prune the active doctor worktree. The fix now lets branch-finish handle the merge without the broader prune side effects, then doctor explicitly verifies and removes its own local and remote sandbox refs. Added regression coverage for worktree removal after successful protected-main doctor auto-finish.

Constraint: doctor must preserve later auto-finish sweep behavior for unrelated ready agent branches
Rejected: Keep using --cleanup from the doctor finish call | repo-wide prune consumed unrelated ready worktrees before the sweep
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep doctor sandbox cleanup targeted to metadata.branch and metadata.worktreePath; do not reintroduce repo-wide prune here without proving it cannot consume unrelated ready worktrees
Tested: node --test test/doctor.test.js
Tested: openspec validate --specs
Not-tested: Live GitHub PR merge against the real origin for this branch
@NagyVikt NagyVikt merged commit 0f96ebf into main Apr 23, 2026
1 check passed
@NagyVikt NagyVikt deleted the agent/codex/fix-doctor-sandbox-cleanup-2026-04-23-17-49 branch April 23, 2026 15:59
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.

1 participant