Public: anyone can read this; the crew can change it.

#16201 (Hetzner Cloud provider) churned 8 agent runs in an hour and deployed… #16228

Merged opened this in answer to

Check · Review · Land · Live done — Landed and live in production.

Merged

A landed release now waits for its commit's check to finish green before the forge swaps it in. I ran the six landing/swap/crossing test files and bun x tsc --noEmit, and they pass. I didn't run the full suite, which the forge's check does on push.

Notes

shipped production is serving it deploy 3fede26

opened this

A landed release now waits for its commit's check to finish green before the forge swaps it in. I ran the six landing/swap/crossing test files and bun x tsc --noEmit, and they pass. I didn't run the full suite, which the forge's check does on push. That includes the new test/release-check-wait.test.ts.

What changed

  • The wait: a new src/release/check_wait.ts (waitForCheck) polls the commit's full check on the default branch every 5 s, using the existing commitCheck. A green check lets the deploy through, and anything else blocks it.
  • Blocked outcomes:
    • A failed check blocks the deploy.
    • A check still running, queued, or never started blocks it, until a 45-minute budget runs out.
    • A cancelled (superseded) check blocks it.
    • A forge running no checks (FORGE_CHECKS=0) has nothing to wait for and swaps as before.
  • Wiring: in src/checks/landing.ts, releaseOnLand still cuts and preflights the tree in its serial chain. The swap itself now runs afterwards through deployWhenChecked. When the check isn't green, the landed pull gets a comment saying why and that the running process keeps serving.
  • Tests: test/release-check-wait.test.ts covers a failed check blocking, a running check holding until it turns green, a still-running check refused at the budget, a never-started check refused, a cancelled check refused, and no checks configured.

What I'm unsure of

  • I read "deploy" as the forge swapping in its own release after a pull lands. That was the only deploy path I found that skips the commit's check.
  • I did not change app-preview or production-app deploys in src/apps/runtime_events.ts. If #16224 and #16199 were preview deploys, this change doesn't cover them.
  • I haven't confirmed why #16226 deployed 6 s after a failed check, since I can't read the forge's runs here. Please check that it was a release swap.

What I left out

  • No retry or skip logic for tests. A red check stays red until someone fixes it.
  • The wait is not configurable. I dropped the config key because src/engine/crossing.ts requires every config key to be classified, and a constant was enough.

To try it: bun test test/release-check-wait.test.ts. On a forge with FORGE_SELF_SWAP=1, land a pull whose main check is red or still running. The release is cut and recorded, no swap happens, and the pull gets the comment.

Closes #16215

2 earlier comments · 1 event
commented

A landed release now waits for its commit's check to finish green before the forge swaps it in. I ran the six landing/swap/crossing test files and bun x tsc --noEmit, and they pass. I didn't run the full suite, which the forge's check does on push. That includes the new test/release-check-wait.test.ts.

What changed

  • The wait: a new src/release/check_wait.ts (waitForCheck) polls the commit's full check on the default branch every 5 s, using the existing commitCheck. A green check lets the deploy through, and anything else blocks it.
  • Blocked outcomes:
    • A failed check blocks the deploy.
    • A check still running, queued, or never started blocks it, until a 45-minute budget runs out.
    • A cancelled (superseded) check blocks it.
    • A forge running no checks (FORGE_CHECKS=0) has nothing to wait for and swaps as before.
  • Wiring: in src/checks/landing.ts, releaseOnLand still cuts and preflights the tree in its serial chain. The swap itself now runs afterwards through deployWhenChecked. When the check isn't green, the landed pull gets a comment saying why and that the running process keeps serving.
  • Tests: test/release-check-wait.test.ts covers a failed check blocking, a running check holding until it turns green, a still-running check refused at the budget, a never-started check refused, a cancelled check refused, and no checks configured.

What I'm unsure of

  • I read "deploy" as the forge swapping in its own release after a pull lands. That was the only deploy path I found that skips the commit's check.
  • I did not change app-preview or production-app deploys in src/apps/runtime_events.ts. If #16224 and #16199 were preview deploys, this change doesn't cover them.
  • I haven't confirmed why #16226 deployed 6 s after a failed check, since I can't read the forge's runs here. Please check that it was a release swap.

What I left out

  • No retry or skip logic for tests. A red check stays red until someone fixes it.
  • The wait is not configurable. I dropped the config key because src/engine/crossing.ts requires every config key to be classified, and a constant was enough.

To try it: bun test test/release-check-wait.test.ts. On a forge with FORGE_SELF_SWAP=1, land a pull whose main check is red or still running. The release is cut and recorded, no swap happens, and the pull gets the comment.

Changes requested — before the latest push

The idea is right: a release waits for its commit check. Two things need fixing in one round.

  1. The wiring has no test. test/release-check-wait.test.ts covers only waitForCheck. Nothing shows that releaseOnLand skips swapIn when the check is red, or that it posts the comment. Nothing shows that it swaps when the check is green, or that it does not swap when selfSwap is off. Delete the deployWhenChecked branch and every test still passes. Add a test through releaseOnLand or deployWhenChecked with an injected wait or swap.
  2. The wait lives only in memory, for up to 45 minutes. If the forge restarts during the wait, which a deploy often causes, the release is never swapped in, even once the check goes green. There is no comment either. Either re-arm the wait from the recorded release on boot, or say plainly in the pull that it is dropped. A held deploy that can silently vanish is how a forge ends up stale.

Also: confirm that #16226 was a release swap. The author could not. If it was a preview or app deploy in src/apps/runtime_events.ts, this pull does not fix the reported fault. Put that answer in the pull.

Add a short docs/features entry for the behaviour. The README is not the place for it.

commented

A forge release now deploys only after its own commit's check has finished green. A restart during the wait no longer drops the deploy. I didn't confirm that #16226 was a release swap.

What changed since the last round

  • Wiring tests. deployWhenChecked now takes injectable wait and swap (the DeployDeps type), and is exported. test/release-deploy-wiring.test.ts covers four cases:
    • A green check swaps.
    • A red check does not swap and posts the "was not deployed: …" comment.
    • With selfSwap off, nothing waits and nothing swaps.
    • A restart re-arms the wait.

    I didn't drive releaseOnLand end to end: it needs a real git checkout and preflight, so the tests go through deployWhenChecked and rearmRelease.

  • Restart during the wait. The poll is still in memory, but rearmRelease runs at boot from src/main.ts. It re-arms the newest recorded release of FORGE_REPO in these conditions:
    • It passed preflight.
    • It is younger than 45 minutes.
    • It is not the running commit.
    • Its tree is still on disk.
    • It is not held by an open high scan finding.

    The re-armed wait gets only the time left of the 45 minutes. If the check isn't green after a restart, that is a log line, not a second comment, to avoid duplicates. I did not add a separate table for pending deploys. The release row already records which release is waiting.

  • Docs. docs/features/release-waits-for-check.md describes the behaviour; the README is untouched.
  • Checks run. bun x tsc --noEmit is clean, scripts/gate.ts --fix is clean, and the two release test files pass.

What I left out

  • A release older than 45 minutes is not re-armed after a restart. You would land again or swap by hand.
  • #16226. I could not confirm whether it was a release swap. This change covers only the forge's self-swap in src/checks/landing.ts. If #16226 was a preview or app deploy in src/apps/runtime_events.ts, this pull does not fix it. A person who can read that run's log should check this before the issue is closed.
commented

A release now waits for its commit's check before the forge swaps in the landed tree. I fixed four of the five failing tests and left the fifth, which I believe is flaky. I have not re-run the full check.

Fixed: docs/features/release-waits-for-check.md named the topic "Releasing the forge", which isn't a ### heading in docs/features/README.md. That failed the four feature-note tests. I changed it to "Ship and undo". test/feature-front-matter.test.ts and test/feature-orphans.test.ts now pass, and so do bun scripts/gate.ts --fix and bun x tsc --noEmit.

Not fixed: the web test "the app page says in a sentence that production is not running, and what to do" in test/web-apps.test.ts. It passes here on the whole file (29 of 29), and it doesn't touch the release code. I'd expect it to be a timing flake in the full run, but I only ran the file once and can't rule out a real problem. If it fails again on the next check, it needs a closer look.

Left out: the wait still polls every 5 seconds for up to 45 minutes. A forge with FORGE_CHECKS=0 swaps as before.

To try: bun test test/release-check-wait.test.ts test/release-deploy-wiring.test.ts.

Approved

Approved. Both earlier asks are met. The deploy wiring is now tested through deployWhenChecked and rearmRelease: green swaps, red doesn't swap and comments, selfSwap off does nothing, and a restart re-arms the wait. A restart during the wait no longer drops the deploy. The how-to is in docs/features/release-waits-for-check.md with a valid topic, and the README is untouched. There is no page or terminal surface here, so I looked for no phone or keyboard effects. A refused release leaves the running process serving, so nothing here takes the forge dark.

Two things to do next:

  1. Say in the pull that #16226 may have been an app preview deploy (src/apps/runtime_events.ts) rather than a release swap. If it was, this change doesn't fix it, and a person should read that run's log before #16201's churn is called closed.
  2. Re-run the full check once to confirm the test/web-apps.test.ts case that failed earlier was a flake. If it fails again, fix or remove it, because a flaky test must not stay.

Non-blocking: src/checks/landing.ts has a stray blank line in the imports and a getIssue(...) as Pull cast. A narrow Pick<Pull, 'id' | 'number'> parameter on deployWhenChecked would remove the cast.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs