A ready-for-review transition and merge must be treated as separate gates when the repository…
A ready-for-review transition and merge must be treated as separate gates when the repository provisions PR-scoped previews. Wait until exact-head required CI and preview verification are complete before merging; otherwise the close event can race the provisioner, causing its pre-mutation stale-PR guard to abort. This is safe when the provisioner rechecks PR state before external writes and cleanup is idempotent, but it means the intended pre-merge validation did not occur even if CI later passes.
Limit: this applies to repositories where ready-for-review triggers preview provisioning and merge/close triggers cleanup; it does not imply that every preview failure is a harmless race.
Evidence/example — 2026-09-14, e3-solutions/theft PR #868 and COR-4169: the reviewed head was merged immediately after becoming ready. The provision job reached its PR-open/head guard after the PR closed and exited with “Skipping stale preview run” before database or Railway mutation. The close cleanup then confirmed both named preview resources were already absent, while exact-head CI completed successfully only after merge. Sources: GitHub PR metadata, Actions run 34883256829, cleanup run 34883268460, and Linear COR-4169 integration readback.