A preview is not started, or not left, for a pull request that has closed (#111) - #192
Merged
Conversation
…osed (#111) Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
10 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
Closes #111. A preview that comes up
after its pull request has closed stays until someone removes it by hand: the cleanup
(
preview-cleanup.yml) runs onclosed, and if the CI run's preview job is still on its wayit runs before there is anything to remove. Two such orphans fill the two-preview cap and block
every later pull request. Found 09.09.2026 —
pr-77up for eight hours after its merge.The preview job now asks GitHub whether its pull request is still open twice:
why.
the cleanup has already been and gone. Closing after this point is safe: the cleanup then runs
after the preview exists.
Every interleaving of a close with the start is covered by the second read, including a cleanup
that removed part of a preview mid-start:
preview-down.shis safe to run for anything, andtwice.
What had changed since the issue was filed
The gate on
main(#61, 12.09.2026) makes a merge wait fore2e-full, which starts with thepreview job and runs about four minutes to its forty seconds — so a merge had in practice
stopped winning this race. What had not: closing a pull request without merging (no checks
needed), a slow start (the database copy since #113) outlasting the tests, and a re-run of the
preview job on a closed pull request.
Also from review
always(), not!cancelled()). By the health wait at the end ofpreview-up.shthe container is alreadyrunning and the script's trap does not remove it — the same orphan. A run cancelled by a newer
push reads
openand does nothing.open, so previews keep working when the API hiccups — but after the start that is exactly where
a missed orphan would hide, so it says so, with the command to remove it by hand.
its own commit. The comment says so rather than claiming otherwise.
The rest of #111
The issue's comments found a second kind of orphan: rows in dev's database naming prefixes of
previews that no longer exist. #113 ended that class — a preview now has its own database, and
its rows go with it. What stays behind is the objects under
pr-<n>/in the bucket, which belongto #34 with a warning that must not be lost
when this issue closes: 735 of dev's rows still name objects under dead preview prefixes, so
that sweep has to delete by row, not by prefix.
docs/dev-environment.mdpointed at #111 forthat; it now points at #34, and the warning goes onto #34 itself.
Still possible, all narrow and older than this change
the ssh client does not stop it until its next write — can create the container after the
second read has already removed everything. Closing that needs a lock on the instance around
start and teardown.
docker runlanding in the sub-second gap between the cleanup's
docker rmand its database drop.scpof the preview scripts rewriting a file another pull request's script is executing.Test plan
permissionsgained onlypull-requests: read(under
-eo pipefail, stricter than thebash -eActions uses for these steps) with stand-inghandssh:before the start — open → start, closed → skip with a notice, API failing → start;
after the start — open → nothing, closed →
preview-down.shfor this pull request,API failing → a warning, the step still green
previewjob changed (deploy-devhas the same step names; every edit was scoped)ci.yml,tasks/plan.md,docs/dev-environment.mdprettier-clean;pnpm checkpr-192running and healthyon the instance, and the job emitted no annotation — both reads said open and did nothing
🤖 Generated with Claude Code