Repository navigation
refactor: retire merged checkouts directly, without the review ceremony (#16016) - #16040
Merged
Merged
Conversation
…ny (#16016) Branch reconciliation, the Schedule view's single-step Retire checkout, pending-merge receipts, release candidates and agent completion audits now share one direct rule. A checkout whose PR merged at its exact head is removed with its branch, uncommitted and untracked files included. Merged commits on the default branch, or inside a later merged PR head, retire a clean checkout. Unmerged work stays in place and visible in the inventory. - No REVIEW_RETIREMENT agent dispatch, review digest, content and Git administration snapshots, supersession preservation or proof-object fetches remain. Live owners, locks, human handoffs and unreadable policy still hold; a merged review-then-merge obligation no longer does. - Deleted heldCheckoutReview.js, branchReconcileRetirement.js, checkoutDeliveryContinuation.js, resumedCheckoutDelivery.js and lib/testCacheRetirementProof.js. The merged-PR forge reads other services still use moved to the slimmer mergedPrEvidence.js. - branchCompletionPolicy.js drops its retirement-review policy engine. - An agent's merged-PR checkout that still holds unmerged work files a plain repository-cleanup recovery instead of a retirement review. - Consolidated the held-checkout suites into one real-Git test file. Closes #16016
Git for Windows leaves directory junctions behind when it removes a worktree. Just before removal the retirement service now unlinks each untracked or ignored link to a directory, never following it or touching its target, and recreates those links if Git refuses the removal.
# Conflicts: # server/services/agentRepoStateVerification.test.js # server/services/heldCheckoutRecovery.js # server/services/heldCheckoutRecovery.test.js
atomantic
enabled auto-merge
November 14, 2026 06:45
Closed
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Second and final slice of #16016 (slice 1 was #16033). Every held-checkout retirement path now uses one direct rule, and the digest-bound review machinery is gone:
The same rule now drives branch-reconcile's automatic pass, the Schedule view's single-step Retire checkout, pending-merge receipts (which also bind the receipt's own PR and exact head), release-candidate locks and agent completion audits.
Changes
heldCheckoutReview.js,branchReconcileRetirement.js,checkoutDeliveryContinuation.js,resumedCheckoutDelivery.js,server/lib/testCacheRetirementProof.js(plus barrel/catalog rows).heldCheckoutRecovery.js(1,522 → ~480 lines): direct retirement only. Removed content/administration snapshots and byte budgets, Vitest cache-schema recognition, supersession kinds and preservation, proof-object fetches and the review policy. AddedreadForgeDelivery(exact / contained / none / unreadable),readMergedDelivery, and the automatic passretireCompletedCheckouts. Also hostsassertAutomaticRetirementAllowed.mergedPrEvidence.js: the forge reads other services still need (findMergedPullRequest, slimmedreadMergedPrDelivery, exact or ancestor delivery only).branchCompletionPolicy.js: dropped the retirement-review policy engine (reviewedRetirementPolicy,mergedReceiptRetirementPolicy,reviewedDeliveryHandoffValid).REVIEW_RETIREMENTdispatch, reservation, digest signature orreconcileRetirementsmetadata.agentRepoStateVerification.js, small hunks only, to stay clear of Retire post-absence checkout-incarnation and historical claim lineage cleanup machinery #16011): merged delivery retires directly; a merged-PR checkout that still holds unmerged work files a plain repository-cleanup recovery instead of a retirement review; an unreadable delivery holds asdelivery-evidence-unavailable.docs/features/branch-reconciliation.md,docs/features/chief-of-staff.mdand the services catalog describe the direct model.heldCheckoutRecovery.test.js) plusmergedPrEvidence.test.js.Net (before the main merge): 49 files, about +1,300 / −7,300 lines.
Decisions
AGENTS.md("An unmerged checkout keeps uncommitted and untracked work in place") and slice 1's review (no auto-accepted supersession) both rule that out, so unmerged checkouts stay held until their work is delivered.supersededSourceEvidence(preserved prototype bytes from the removed mode) is left untouched in schedule state. It is no longer written or read, and is not stripped, since it may hold the only copy of operator-accepted bytes.reconcileRetirements/retirementReviewcompletion checks (compatibility with persisted tasks).Test plan
npm run pregate: lint, structural guards (import growth, dead exports, barrel, catalog) and selected server/client suites pass.BranchReconcileOutcometest.readMergedDeliverytri-state; directory links never followed and restored on refusal. Key cases were mutation-checked (each fails when its behavior is removed).Local review
The configured required reviewer (
codex, modelgpt-6.1-terra, effort high,~max=2) ran 2 rounds, both with complete coverage (49/49 files). Its round budget is spent, so the local phase is recorded aspartial.c8f306acc9): two findings.0df0931386: links are unlinked just before removal without being followed, and restored if Git refuses. Tests added.0df0931386): repeated only the incarnation finding, which stays rejected for the same reason.mainwas merged in to resolve conflicts with refactor: settle handed-off cleanup runs by direct absence (#16011) #16036 (Retire post-absence checkout-incarnation and historical claim lineage cleanup machinery #16011). This PR now also dropsinspectAbsentCheckoutfrom the service, as upstream did. That conflict resolution was not reviewed locally because the budget was spent; pregate and the 139 related suites (6,185 tests) pass on the merged head.Why the incarnation finding is rejected. No code writes
checkoutIncarnationonto inventory rows any more, so the old recheck already did nothing for current rows. In the direct model, every safety property is re-proven against the live checkout at the final removal gate: merged head, clean (or exact-head-merged) content, no live or claim owner, and unchanged path, HEAD, branch, lock and checkout-pointer identity. A checkout whose Git administration was recreated therefore cannot carry unmerged work past that gate. The recheck only mattered when a content digest taken at preview time had to stay bound to one generation.AGENTS.mdalso rejects durability findings on ephemeral worktree state, and #16011 is removing this dev/ino incarnation tracking.Related
agentRepoStateVerification.js/completedCheckoutEvidence.jstouched only at their forge-read and recovery-task hunks).Closes #16016