fix(ultraplan-local): CRITICAL — worktree isolation for parallel sessions

Phase 2.6 previously launched parallel claude -p sessions in the same
working directory, causing git race conditions and repository corruption.

Changes:
- Add Phase 2.55 (pre-flight safety checks): clean tree, plan file
  tracking, scope fence overlap validation, stale worktree cleanup
- Rewrite Phase 2.6 with git worktree isolation: each parallel session
  gets its own worktree and branch, merged back sequentially
- Add merge conflict detection and abort (no silent data loss)
- Add unconditional worktree cleanup (even on failure)
- Add hard rules 11-13 (worktree mandatory, cleanup, sequential merge)
- Session-scoped progress file naming for --session mode
- Update headless launch template with worktree support and cleanup trap
- Bump version to 1.5.0

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-04-07 22:12:53 +02:00
commit 5dd7e8447c
4 changed files with 356 additions and 29 deletions

View file

@ -4,6 +4,37 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
## [1.5.0] - 2026-04-07
### Fixed
- **CRITICAL: Parallel session data loss** — Phase 2.6 ran parallel `claude -p` sessions
in the same working directory, causing git race conditions and repository corruption.
Each parallel session now runs in its own git worktree with isolated branch, index,
and working files. Branches are merged back sequentially after each wave completes.
### Added
- **Phase 2.55 (Pre-flight safety checks)** — validates clean working tree, committed
plan file, no scope fence overlaps between parallel sessions, and no stale worktrees
before launching parallel execution.
- **Git worktree isolation** for all parallel sessions — one branch per session
(`ultraplan/{slug}/session-{N}`), merged with `--no-ff` after wave completion.
- **Merge conflict detection** — if merging a session branch produces conflicts, the merge
is aborted and conflicting files are reported. No silent data loss.
- **Unconditional worktree cleanup** — worktrees and session branches are always removed,
even on failure. Manual cleanup commands are reported if automated cleanup fails.
- **Hard rules 11-13** — worktree isolation mandatory, cleanup unconditional, merge
sequentially with conflict abort.
- **Session-scoped progress file naming**`--session N` uses
`.ultraexecute-progress-{slug}-session-{N}.json` to prevent merge conflicts.
### Changed
- Headless launch template uses git worktrees with `cleanup_worktrees` trap on EXIT,
clean-tree pre-flight check, and sequential merge after each wave.
- Phase 2.6 rewritten with 5-step worktree lifecycle: create → launch → wait → merge → cleanup.
## [1.4.0] - 2026-04-06
### Renamed