T-AQR9-task-work-cutover-stop-mirror-writes
Status: closed/done · Impact: high · Complexity: large
Stage 5 of D-S30G-task-state-plane-split — the cutover. From
this task on, in-progress is never written to frontmatter and a
task’s file changes on main exactly twice after creation: at
promotion and at closure.
| Location | Role today |
|---|---|
apps/sdlc/skills/task-work/start_task.ts | Commits status: in-progress + last_reviewed + the ## Post-mortem stub to main, then transitions the lease claimed → working. |
apps/sdlc/skills/task-work/append_pr_url.ts | Commits the PR URL to prs[] on the SHARED main checkout (the one non-worktree writer), then the lease moves to awaiting-review. |
apps/sdlc/lib/model/entities/task/ops/close-commit.ts | The closure commit (status, completion_note, prs append); no post-mortem stub handling. |
apps/sdlc/skills/task-work/SKILL.md | Steps 5b/10 narrate the start-commit and PR-record flows. |
Proposed
Section titled “Proposed”start_task.ts keeps only the lease transition (claimed → working) and the feature-branch fetch/reset — no main commit.
append_pr_url.ts is deleted; the PR is recorded via lease task transition awaiting-review --pr-number only (this also removes
the last shared-checkout writer). close-commit appends the
## Post-mortem stub when absent, sharing start_task’s
line-anchored H2 detector from a common home. task-work SKILL.md,
its prose-contract overlays, and orchestrate’s marker regexes are
updated in the same PR. Runs dispatched pre-cutover still write
in-progress harmlessly — readers keep the fallback until
stage 7.
Approach
Section titled “Approach”- Strip the
commitToMainViaWorktreecall + stub append fromstart_task.ts; keep lease transition and branch reset; adjust its marker output. - Delete
append_pr_url.tsand its call site; record the PR number on the lease transition in Step 10. - Move the post-mortem H2 detector to a shared module; append
the stub idempotently in
close-commit.ts. - Rewrite task-work SKILL.md Steps 5b/10 (and Step 2/8 mentions) plus prose-contract overlays and orchestrate marker regexes.
- Land between orchestrator ticks; verify a pre-cutover- dispatched run still closes cleanly.
Files to touch
Section titled “Files to touch”| Location | Kind | Change |
|---|---|---|
apps/sdlc/skills/task-work/start_task.ts | modify | Lease-only start; no main commit. |
apps/sdlc/skills/task-work/append_pr_url.ts | delete | PR binding lives on the lease. |
apps/sdlc/lib/model/entities/task/ops/close-commit.ts | modify | Idempotent post-mortem stub append. |
apps/sdlc/skills/task-work/SKILL.md | modify | Steps 5b/10 rewired; markers updated. |
apps/sdlc/skills/orchestrate/SKILL.md | modify | Marker regexes for the new start/PR flow. |
Acceptance criteria
Section titled “Acceptance criteria”- AC-1: A full task-work run lands zero commits on main between promotion and closure.
- AC-2:
in-progressis never written to any task file by the new flow. - AC-3: The PR number is readable from the lease
(
lease inspect) after Step 10. - AC-4: A run started under the old flow (frontmatter
in-progress, stub already present) closes cleanly with no duplicate stub.
Out of scope
Section titled “Out of scope”- Schema v6, migrate sweep, lint narrowing, legacy-arm removal — stage 7 (T-11QZ-task-schema-v6-contract-sweep).
Dependencies
Section titled “Dependencies”- T-2T0R-probe-state-inflight-lease-aware, T-YQY2-task-next-lease-exclusion, T-S27R-ensure-ready-plane-rework — all three read/write paths must be lease-aware before the mirror writes stop.
Discovery context
Section titled “Discovery context”- Scaffolded from D-S30G-task-state-plane-split (migration stage 5 of 7).
Depends on
Section titled “Depends on”T-2T0R-probe-state-inflight-lease-aware, T-YQY2-task-next-lease-exclusion, T-S27R-ensure-ready-plane-rework