Skip to content

wu:repair

← Back to CLI Commands

Repair WU state issues

pnpm wu:repair

A wu:done stopped after it committed the done record on the lane branch but before landing leaves the lane branch saying done while the integration target still says in_progress. That lane holds unlanded work: wu:repair reports it as INTERRUPTED_DONE (never ORPHAN_WORKTREE_DONE), never auto-repairs it, and no orphan cleanup deletes a lane branch whose commits are not on the integration target. Every refusal of this state prints its one exit:

pnpm wu:release --id WU-XXXX --keep-branch --reason "<why>"
pnpm wu:claim --id WU-XXXX --lane "<lane>"
pnpm wu:rebase --id WU-XXXX

then wu:prep and wu:done. The release backs the lane tip up to backup/<wu-id>-interrupted-done-<sha>, removes only the unlanded done commit (what wu:done itself rolls back when a landing fails) and replays every later commit, so the reclaim continues ordinary retained work. Without --keep-branch the release refuses.

If the claim-auto brief checkpoint that wu:claim records is ever left staged, wu:repair --claim (--check and repair alike) tolerates exactly that row, and the claim’s own claim rows, for the WU being repaired when the ledger is the only staged path. Any other staged path, another WU’s row or an altered row still refuses with “dirty state outside one exact staged WU document”.

Options:

FlagDescriptionRequired
--split-path &lt;path...&gt;With —split-commit: a path the split commit changed that moves to its own trailing commit (repeatable)No
--split-commit &lt;sha&gt;With —repin-lane: split this lane commit in two first, the commit without the —split-path paths followed by those paths alone; later lane commits are recreated on top with the same contentNo
--repin-laneLane re-pin mode (needs —id and —reason; run by the claim holder from the claim’s worktree): re-pin the claim to a rewritten lane whose tree is byte-identical to the reviewed lane, for example after a published commit was split. Refused when the trees differ, when the rewrite drops a commit the delivery branch already holds or the claim record commit, or when the published lane is neither the reviewed lane nor the new tip. Publishes the lane, the claim marker and a create-only audit record in one atomic push. With —check, proves the re-pin and changes nothingNo
--reason &lt;text&gt;Audit reason recorded for —refresh-policy or —repin-laneNo
--outcome &lt;outcome&gt;Settled outcome the record must prove: released, cancelled or done (with —claim-settlement-backfill only)No
--generation &lt;generation&gt;Claim generation to seal (with —claim-settlement-backfill only)No
--claim-settlement-backfillSettlement backfill mode (needs —id, —generation and —outcome): seal a branch-PR claim that was released, cancelled or done BEFORE settlement seals existed (a legacy genesis) or whose seal was lost. Requires the claim marker to be gone, the ORIGINAL claim independently verified from canonical history, and a FRESH settlement proof at the advertised lane commit. It never invents a generation and never overwrites a seal. outcome=done is NOT a code-landing proof. Mutually exclusive with —claim, —admin and every other modeNo
--refresh-policyWith —integration-target: pin the live trusted policy when its content changed after the claim. A legacy claim is upgraded pinned to it; an already-bound claim is refreshed (a successor generation, audited by a claim_policy_refresh ledger event) on the SAME policy authority (POLICY_AUTHORITY_CHANGED otherwise). Refused (POLICY_REFRESH_SELECTOR_CONFLICT) unless the live policy selects the proven original delivery pair. The worktree’s pending-spec journal is reconciled to the successor generation in the same run, and re-running the command resumes an interrupted refresh. A claim whose marker is missing from the remote is restored by the same command, from its surviving claim-history genesis, for the holder only. A marker that is a provably stale earlier generation of the same claim is replaced in place by the current generation. The claim’s own lifecycle dirt, the unstaged generated skip-gates audit append and its own native mem:checkpoint rows in the tracked ledger, is held out of the tree through the lane-clean proof, the publication and the lane sync and restored byte-exactly once (the same custody wu:rebase uses); any other change refuses before anything is published, naming the path and the remedy. With —check, the same dirty-lane proof runs read-only and reports the paths it would hold, or the refusal. Requires —reasonNo
--integration-targetLegacy claims only (worktree and worktree-pr; branch-only and branch-pr are refused). Prove the claim’s ORIGINAL destination, metadata authority and trusted policy from canonical and remote Git evidence, mint a claim generation, and publish the complete claimed_integration_target binding and its claim source. Same repository only (split topology is refused). It never retargets and never reads a changed default as evidence. Run as the claim holder (own SDK session, Git email = assigned_to). Order of effects: (1) UNWIND: a lane that carries a done commit proven NOT on the freshly fetched integration target (an interrupted or refused wu:done, with or without later lane commits such as a retained-branch reclaim) has exactly that commit removed behind a backup/<wu-id>-interrupted-done-<sha> branch and every later commit replayed, so the claim documents and ledgers agree again; (2) PUBLISH: only then does it publish the claim lane, including work in progress, to the delivery remote (—check prints how many local commits that is and changes nothing). It publishes only a lane whose ledger no longer records the WU as done ahead of the integration target: if the done commit cannot be proven unlanded (target unreachable) or a completion cannot be located to remove, it refuses UNLANDED_DONE_UNPROVEN and leaves the lane unchanged and unpublishedNo
--applyApply repairs (duplicate-ids mode; default is dry-run)No
--path &lt;path&gt;Path to state file to repair (state mode only)No
--initiative &lt;ref&gt;New initiative reference (admin mode only)No
--notes &lt;text&gt;Add/update notes (admin mode only)No
--status &lt;status&gt;New status value (admin mode only)No
--lane &lt;lane&gt;New lane assignment (admin mode only)No
--base-dir &lt;path&gt;Resolve canonical claim authority from this exact canonical-main realpath (claim mode only; defaults to the Git-proven main checkout when run from a lane worktree)No
--worktree &lt;path&gt;Require this exact registered worktree realpath (claim mode only; never overrides authority)No
--allCheck/repair all WUs (consistency mode only)No
--checkAudit only, no changes (exits 1 if issues found)No
--id &lt;wuId&gt;WU ID to check/repairNo
--sessionsSession repair mode: clear orphaned .lumenflow/sessions/ cache entriesNo
--duplicate-idsDuplicate ID repair mode: detect and fix WU ID collisionsNo
--repair-stateState repair mode: fix corrupted wu-events.jsonlNo
--adminAdmin repair mode: fix done WUs (lane, status, notes, initiative)No
--claimClaim repair: absent-only worktree branch binding backfill; with —integration-target, same-target legacy upgrade. Never revives lifecycle stateNo

← Back to CLI Commands