type: meta

slug: worktree-provisioning

base_branch: origin/main

gate0_mode: strict

preset: codex

land_mode: merge-to-main


type: goal

text: Provision every v2 task worktree before any coder, reviewer, fixer, or gate enters it, and classify terminal provisioning failure as blocked infrastructure.


type: methodology

text: Implement contract-first in dependency waves; use TDD; resolve provisioning deterministically; persist success as an atomic receipt; fail closed at every seat and gate boundary; keep infrastructure failures outside agent retry, fallback, and gate-fix ladders; commit only each task's declared files.


type: intent

text: Eliminate bare-checkout gate failures and prevent harness infrastructure defects from consuming agent retries or being misattributed to task code.


type: direction

verbatim: v2's own land step pushes main directly and the repo guard rejects it — the run's work stays on plan/harness-v2-phase2--integration and is landed via ship.sh afterwards; tasks must NOT try to push main.


type: task

seat: coder

tier: medium

desc: Read docs/plans/2026-07-29-worktree-provisioning.md Task 1 (Provisioning Core and Receipt) for the full contract. Resolve and execute bounded provisioning with one retry, atomic receipt state, and typed infrastructure failure. Acceptance: node --test modules/harness/v2/test/scratch-provisioning.test.js. Commit only: modules/harness/v2/scratch.js, modules/harness/v2/test/scratch-provisioning.test.js.


desc: Read docs/plans/2026-07-29-worktree-provisioning.md Task 2 (Dispatch Receipt Admission) for the full contract. Reject direct dispatch before binding resolution or child launch unless the worktree carries the provisioning receipt. Acceptance: node --test modules/harness/v2/test/dispatch-provisioning.test.js. Commit only: modules/harness/v2/dispatch.js, modules/harness/v2/test/dispatch-provisioning.test.js.


desc: Read docs/plans/2026-07-29-worktree-provisioning.md Task 3 (Provisioning Lifecycle and Infrastructure Failure) for the full contract. Provision or re-provision before every seat and gate, then journal and block terminal failures outside agent ladders with fresh retry-blocked worktrees. Acceptance: node --test modules/harness/v2/test/worktree-provisioning.integration.test.js. Commit only: modules/harness/v2/run.js, modules/harness/spec/events.schema.json, modules/harness/v2/test/worktree-provisioning.integration.test.js.


desc: Read docs/plans/2026-07-29-worktree-provisioning.md Task 4 (Register and Run Full v2 Regression Suite) for the full contract. Register every provisioning suite exactly once and run syntax, focused, and full v2 gates without warnings or skipped mandatory coverage. Acceptance: node --check modules/harness/v2/scratch.js && node --check modules/harness/v2/dispatch.js && node --check modules/harness/v2/run.js && node --test modules/harness/v2/test/scratch-provisioning.test.js modules/harness/v2/test/dispatch-provisioning.test.js modules/harness/v2/test/worktree-provisioning.integration.test.js && node modules/harness/v2/test/index.js. Commit only: modules/harness/v2/test/index.js.