Skip to content

Auto-clean finished agent worktrees and enforce safer prune defaults#32

Closed
NagyVikt wants to merge 1 commit intomainfrom
agent/codex/20260411-191332-info-recodee-com-guardex-cleanup-finished-branches
Closed

Auto-clean finished agent worktrees and enforce safer prune defaults#32
NagyVikt wants to merge 1 commit intomainfrom
agent/codex/20260411-191332-info-recodee-com-guardex-cleanup-finished-branches

Conversation

@NagyVikt
Copy link
Copy Markdown
Collaborator

Summary\n- auto-run worktree cleanup when exits\n- make infer base branch automatically and preserve dirty worktrees by default\n- add for explicit destructive cleanup\n- update setup script wiring, README docs, and install tests\n\n## Why\nAgent branches/worktrees were lingering in VS Code Source Control even after sessions ended, especially when users kept their local checkout on . This keeps the preferred local branch clean while still using isolated agent branches.\n\n## Verification\n- npm test\n- node --check bin/multiagent-safety.js\n

…ent worktrees

Codex sessions now return to repo root and run worktree cleanup on exit, so finished clean agent branches disappear automatically instead of piling up in VS Code Source Control.\n\nPrune now infers base branch when omitted, preserves dirty worktrees by default, and adds a force flag for explicit cleanup. Documentation and tests were updated to match the GuardeX workflow and protect against regressions.

Constraint: Users keep their local checkout on main/dev while Codex works in isolated agent/* branches\nRejected: Force-delete every agent worktree on exit | risks data loss for dirty/unmerged work\nConfidence: high\nScope-risk: moderate\nReversibility: clean\nDirective: Keep dirty-worktree preservation as default safety behavior; only remove with --force-dirty\nTested: npm test\nTested: node --check bin/multiagent-safety.js\nNot-tested: Manual VS Code Source Control screenshot validation after a full PR merge loop
@NagyVikt NagyVikt force-pushed the agent/codex/20260411-191332-info-recodee-com-guardex-cleanup-finished-branches branch from c86e707 to cd2f84e Compare April 11, 2026 17:16
@NagyVikt NagyVikt closed this Apr 11, 2026
@NagyVikt NagyVikt deleted the agent/codex/20260411-191332-info-recodee-com-guardex-cleanup-finished-branches branch April 11, 2026 17:28
@NagyVikt
Copy link
Copy Markdown
Collaborator Author

Superseded by #33 (merged on April 11, 2026), which carries the finalized auto-prune + protected-main workflow updates. Closing this duplicate path.

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