You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Keep local main pull-only by automatically cleaning finished agent worktrees (#33)
Stale agent worktrees were piling up in VS Code Source Control, and manual cleanup
required passing hardcoded base arguments. This change makes cleanup default and safer:
`agent:cleanup` now uses base auto-detection, prune can preserve dirty worktrees unless
explicitly forced, and codex-agent triggers post-session prune automatically.
Tests now cover clean-sandbox auto-prune and dirty-sandbox preservation paths so the
workflow stays predictable while reducing branch/worktree clutter.
Constraint: Cleanup must not delete in-progress work by default
Rejected: Always force-delete dirty worktrees after codex exit | risks losing active edits
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: If prune rules change, keep codex-agent post-session behavior and dirty-preservation tests aligned
Tested: npm test (54/54); node --check bin/multiagent-safety.js
Not-tested: End-to-end codex-agent run against real Codex CLI interactive session
Co-authored-by: NagyVikt <nagy.viktordp@gmail.com>
bash scripts/agent-worktree-prune.sh --base dev # manual stale worktree cleanup
273
+
bash scripts/agent-worktree-prune.sh # manual stale worktree cleanup (auto base detection)
274
+
bash scripts/agent-worktree-prune.sh --force-dirty # remove stale dirty worktrees too
274
275
bash scripts/openspec/init-plan-workspace.sh <plan-slug># optional OpenSpec plan scaffold
275
276
```
276
277
@@ -284,6 +285,7 @@ and asks `[y/N]` whether to update immediately (default is `N`).
284
285
- Interactive prompt is strict (`[y/n]`) and waits for explicit answer.
285
286
- Non-interactive setup: skips global installs by default; use `--yes-global-install` to force.
286
287
- In already-initialized repos, `setup` / `install` / `fix` / `doctor` block writes on protected `main` by default; start an agent branch first. Use `--allow-protected-base-write` only for emergency in-place maintenance.
288
+
-`scripts/codex-agent.sh` now auto-runs worktree prune after a Codex session; clean sandbox branches are removed automatically, dirty ones are kept.
0 commit comments