type: goal

text: Add harness v2 per-run supervision, durable automatic crash recovery, ownership-safe hung-run termination, and enforced worker resource limits.


type: methodology

text: Implement contract-first in dependency waves; use systemd user units/timers only as short-lived supervisors; persist authority in the append-only journal and atomic run registry; use TDD; fail closed on incomplete identity; commit only each task's declared files.


type: intent

text: Make unattended v2 runs survive coordinator crashes and host reboots, terminate provably owned hangs, and contain worker resource failures without weakening the Phase 1 trust core.


type: direction

verbatim: no monolithic daemon, systemd units/timers + short idempotent scripts, state on disk


verbatim: v1 code bodies are NEVER ported, only behavior re-specced


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-harness-v2-phase2.md Task 1 (Durable Supervision Registry and Journal Projection) for the full contract. Persist atomic run registration, generation/ownership identity, heartbeats, and the durable 30s/2m/8m restart ledger with fail-closed projections. Acceptance: node --test modules/harness/v2/test/supervision.test.js. Commit only: modules/harness/v2/supervision.js, modules/harness/spec/events.schema.json, modules/harness/v2/test/supervision.test.js.


desc: Read docs/plans/2026-07-29-harness-v2-phase2.md Task 2 (Worker Resource Scopes and Ownership Receipts) for the full contract. Enforce memory, CPU, process, and file-size limits in owned transient scopes; fail unattended launch closed; allow only explicit foreground setsid fallback. Acceptance: node --test modules/harness/v2/test/child-resource-limits.test.js. Commit only: modules/harness/v2/child.js, modules/harness/v2/test/child-resource-limits.test.js.


desc: Read docs/plans/2026-07-29-harness-v2-phase2.md Task 3 (Per-Run and Timer systemd Units) for the full contract. Define one unit per run plus persistent one-shot reconcile and watchdog timers without embedding mutable argv or daemon logic. Acceptance: node --test modules/harness/v2/test/systemd-phase2.test.js. Commit only: modules/harness/systemd/harness-run@.service, modules/harness/systemd/harness-reconcile.service, modules/harness/systemd/harness-reconcile.timer, modules/harness/systemd/harness-watchdog.service, modules/harness/systemd/harness-watchdog.timer, modules/harness/v2/test/systemd-phase2.test.js.


desc: Read docs/plans/2026-07-29-harness-v2-phase2.md Task 4 (Automatic Crash Reconciliation) for the full contract. Reconcile registry, journal, and systemd state; adopt only exact identities; resume with durable 30s/2m/8m backoff; refuse restart four; isolate unrelated runs. Acceptance: node --test modules/harness/v2/test/reconcile-runs.test.js. Commit only: modules/harness/v2/bin/reconcile-runs.js, modules/harness/v2/test/reconcile-runs.test.js.


desc: Read docs/plans/2026-07-29-harness-v2-phase2.md Task 5 (Ownership-Safe Hung-Run Watchdog) for the full contract. Detect stale heartbeats, prove PID start-time/process-group/cgroup/generation ownership, terminate the complete owned tree, and hand recovery to reconcile; mismatches survive. Acceptance: node --test modules/harness/v2/test/watchdog.test.js. Commit only: modules/harness/v2/bin/watchdog.js, modules/harness/v2/test/watchdog.test.js.


desc: Read docs/plans/2026-07-29-harness-v2-phase2.md Task 6 (Integrate Supervision into Launcher and Run Lifecycle) for the full contract. Wire registry-token launch, generation heartbeats, durable phase resume, worker ownership/resource evidence, watchdog recovery, and Phase 1 stop-loss preservation without pushing main. Acceptance: node --test modules/harness/v2/test/run-supervision.test.js. Commit only: modules/harness/v2/run.js, modules/harness/v2/bin/runplan.js, modules/harness/v2/test/run-supervision.test.js.


desc: Read docs/plans/2026-07-29-harness-v2-phase2.md Task 7 (Register and Run Full Phase 2 Regression Suite) for the full contract. Register every new Phase 2 suite exactly once and run syntax, focused supervision, full v2, and preset validation gates without warnings or skipped mandatory coverage. Acceptance: node --check modules/harness/v2/supervision.js && node --check modules/harness/v2/bin/reconcile-runs.js && node --check modules/harness/v2/bin/watchdog.js && node --check modules/harness/v2/child.js && node --check modules/harness/v2/run.js && node --check modules/harness/v2/bin/runplan.js && node --test modules/harness/v2/test/supervision.test.js modules/harness/v2/test/child-resource-limits.test.js modules/harness/v2/test/systemd-phase2.test.js modules/harness/v2/test/reconcile-runs.test.js modules/harness/v2/test/watchdog.test.js modules/harness/v2/test/run-supervision.test.js && node modules/harness/v2/test/index.js && node modules/harness/presets/_validate.mjs. Commit only: modules/harness/v2/test/index.js.