Tasks: Implement lane-allocation integrity

Mission: implement-lane-recut-and-planning-commit-integrity-01M3CM55 Spec: spec.md · Plan: plan.md Issues: #4889 (P0), #4905 (P1)

Overview

Three work packages. WP01 (#4889) and WP02 (#4905) are write-scope-disjoint and run in parallel; WP03 is the cross-cutting integration regression and depends on both.

WP01 (#4889 fail-closed detector)  ─┐
                                     ├─→ WP03 (e2e integration regression)
WP02 (#4905 coord-staging partition)─┘
   WP01 ∥ WP02   →   WP03 depends on {WP01, WP02}

Subtask Index

IDDescriptionWPParallel
T001Red-first repro: destroyed lane (worktree+branch gone) via CLI implement re-cuts empty laneWP01
T002Red-first repro: same via orchestrator agent action implement / _resolve_start_workspaceWP01[P]
T003Add fail-closed destroyed-lane pre-flight inside allocate_lane_worktree (before FRESH routes)WP01
T004Key detector on WorkspaceContext + non-terminal status + refs-gone + tip-not-ancestor-of-targetWP01
T005Typed diagnostic (missing branch + recovery ref); leave WorkspaceContext untouchedWP01
T006FR-009 resilience assertion in _merge_recorded_planning_commitWP01[P]
T007Preserve control arms (REUSE / CRASH_RECOVERY / fresh / reachable-tip) — regression pinsWP01
T010Red-first repro: coord agent action implement WP01 stages tasks/WP01-*.md on coord branchWP02
T011Red-first repro: WP02 claim fails with PlanningCommitMergeConflictErrorWP02[P]
T012Partition staged paths by artifact kind at _commit_via_coordination_transaction sinkWP02
T013Route PRIMARY-kind (WORK_PACKAGE_TASK) paths to primary target via commit_to_primary_targetWP02
T014Cover all three staging sites (claim/resume-refresh/review-claim) by construction at the sinkWP02
T015Regression: coord tree has zero tasks/WP*.md after claim AND after review-claim; lanes controlWP02
T020e2e regression on a real coord mission: #4889 fail-closed across REUSE/CRASH_RECOVERY/FRESH + both callersWP03
T021e2e regression: #4905 WP01→WP02 both start, no conflict, coord clean after review-claimWP03
T022Interaction proof: #4905 fix + #4889 fresh path coexist (fixing one does not reopen the other)WP03[P]
T023Confirm repros transition from RED (pre-fix) to GREEN (post-fix); demote transitional reprosWP03

Work Packages

WP01 — #4889 fail-closed destroyed-lane detector

Goal: allocate_lane_worktree must distinguish a never-allocated lane from a destroyed one and fail closed rather than silently re-cut an empty lane. Prompt: tasks/WP01-destroyed-lane-fail-closed.md Priority: P0 (US1) · Est.: ~420 lines · 7 subtasks (T001–T007) Independent test: destroyed-lane scenario refuses via both CLI and orchestrator; control arms resume. Dependencies: none.

WP02 — #4905 coord-staging partition

Goal: keep PRIMARY-partition tasks/WP*.md off the coordination branch at the shared commit sink, covering all three lifecycle staging sites. Prompt: tasks/WP02-coord-staging-partition.md Priority: P1 (US2) · Est.: ~360 lines · 6 subtasks (T010–T015) Independent test: coord tree carries no WP file after claim + review-claim; WP02 starts with no conflict. Dependencies: none.

WP03 — cross-cutting integration regression

Goal: prove both defects are dead together on a real coord mission across every route/caller. Prompt: tasks/WP03-integration-regression.md Priority: P1 · Est.: ~300 lines · 4 subtasks (T020–T023) Independent test: the e2e suite is RED pre-fix and GREEN with WP01+WP02 present. Dependencies: WP01, WP02.

MVP scope

WP01 (#4889 P0) is the release-critical slice; WP02 is the P1 folded sibling; WP03 is the integration safety net.