Skip to content

Implement review-fix-loop local locking, isolated attempts, and recovery #97

Description

@shaug

Outcome

Implement the local execution substrate for review-fix-loop: common-directory locking, isolated attempts, durable checkpoints, recovery, and clean canonical promotion.

Parent epic: #95
Design: design/review-fix-loop.md

Scope

  • Acquire stable local-ref locks, plus the remote-target lock required by update_pr, in deterministic order.
  • Create and clean isolated attempt worktrees without mutating user-specified reference branches.
  • Persist enough state to resume or safely report interruption.
  • Promote a converged candidate only after verifying the canonical worktree is clean and the expected old state still matches.
  • Preserve recoverable commits and report their identifiers when promotion cannot complete.

Non-goals

  • A distributed lease, ownership, fencing, or coordinator service.
  • Review orchestration or finding selection.
  • Remote publication.

Acceptance criteria

  • Conflicting local invocations cannot both own the same target.
  • Lock ordering avoids self-induced deadlocks for multi-target update_pr work.
  • Attempts occur outside the canonical worktree and leave it unchanged until promotion.
  • Interrupted attempts can be recovered or reported without losing commits.
  • Dirty or advanced canonical state fails closed and preserves the candidate.
  • Cleanup never deletes user-owned work or reference branches.

Validation

  • Deterministic tests for contention, interruption, stale state, dirty worktrees, promotion races, and cleanup.
  • Repository just format, just lint, and just test.

Dependencies

Blocked by the contract leaf.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions