fix(core): recover review head drift cleanly (BRIX-1768)#112
fix(core): recover review head drift cleanly (BRIX-1768)#112quay-worker[bot] wants to merge 9 commits into
Conversation
fix(core): reconcile review head before spawn (BRIX-1770)
…ay/BRIX-1769 # Conflicts: # packages/cli/src/adapters/git.ts
fix(core): classify review context drift separately (BRIX-1769)
fix(core): revive parked synthetic review tasks (BRIX-1771)
There was a problem hiding this comment.
Review Findings
Blocking
🔴 [1] enterReview can still schedule a reviewer for a stale PR head
enterReview now takes the attempt SHA from prView at pr_review.ts:239, but it later classifies CI from a separate prSnapshotByNumber read at pr_review.ts:305 and then writes/schedules the original headSha at pr_review.ts:510-L515. If the PR is force-pushed after prView returns SHA A but before prSnapshotByNumber returns SHA B with green checks, classifyCi sees a self-consistent snapshot for B and returns pass, while Quay inserts a review attempt for A. The spawn path will usually retarget before launch, but if that guard is missed or races again, the finalization path records the posted review against task.head_sha; synthetic review approvals and requested-changes outcomes are not protected by the Quay-owned approved-review CI guard. This reintroduces the head/worktree drift class this PR is trying to eliminate. Treat a snapshot whose headSha does not equal the selected review headSha as stale or re-read prView after the CI snapshot and only schedule when both reads agree.
Review scheduling must bind the selected commit and CI evidence to the same live PR head before creating an attempt, because independent GitHub reads can cross a force-push boundary.
Non-blocking
None.
Quay Umbrella Final PR
Umbrella external ref: BRIX-1768
Umbrella title: Quay: make PR review tasks recover cleanly from head/worktree drift
Linear ticket: BRIX-1768
Source branch: quay/umbrella/BRIX-1768
Target branch: dev
Quay opened this PR after all expected umbrella subtasks were accounted for.
Expected Subtasks
Review update
prViewandprSnapshotByNumber.Deployment Steps
✅ No manual deployment steps needed, will be fully operational after automated CI deployment.
Test Plan
Pre-merge checklist
bun run typecheck:clibun test packages/cli/tests/review/pr_review_entry.test.tsbun run test:cliPost-deployment verification