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

Cloud account hetzner/prod shows more than the forge made #17856

opened this in answer to

Merged 28h 28m ago, live in production

The cloud watch now asks a provider again once before it gives up, so a short stall no longer files "could not read hetzner/prod". I haven't confirmed this is what happened to hetzner/prod; the issue only says "no answer in time". The repo shows the watch had no retry and a 30-second timeout on each read.

Notes

opened this

The cloud watch now asks a provider again once before it gives up, so a short stall no longer files "could not read hetzner/prod". I haven't confirmed this is what happened to hetzner/prod; the issue only says "no answer in time". The repo shows the watch had no retry and a 30-second timeout on each read. Nothing has run against the live provider.

What changed (src/cloud/watch.ts, new getOnce): each read-only GET in pages() is repeated once when it throws (timeout or no connection) or returns a 5xx. A second failure is still thrown, so the account is reported as "not known to be clean" rather than passed. A SyntaxError is not retried. The retry is a new helper in watch.ts and reuses no existing function. I did not run scripts/similar.ts.

Tests (test/cloud-watch-read.test.ts): a timeout on the first read is retried and the account reads clean. A second timeout still throws. A 503 is retried once. bun test test/cloud-watch passes (23 tests), and bun x tsc --noEmit and bun scripts/gate.ts --explain are clean. I did not run scripts/design-lint.ts, since no src/web/ file changed. I did not run the full suite.

Not done:

  • Parallel reads: I tried reading the three lists in parallel. It broke the existing "never ends" test, which relies on the lists being read one after another, so I kept them sequential.
  • Failure threshold: I did not make the "could not read" issue wait for two failed hours in a row.
  • Doors: no page, action or route changed, so the terminal and docs/features/ are untouched.

Try it: bun test test/cloud-watch-read.test.ts. On the next hourly watch, a one-off slow answer from the provider should leave no issue.

Pushing was refused twice with a 530 and then went through on a later try. The branch is up to date with origin.

🤖 Generated with Claude Code

Closes #17850

3 earlier comments
commented

The cloud watch now asks a provider again once before it gives up, so a short stall no longer files "could not read hetzner/prod". I haven't confirmed this is what happened to hetzner/prod; the issue only says "no answer in time". The repo shows the watch had no retry and a 30-second timeout on each read. Nothing has run against the live provider.

What changed (src/cloud/watch.ts, new getOnce): each read-only GET in pages() is repeated once when it throws (timeout or no connection) or returns a 5xx. A second failure is still thrown, so the account is reported as "not known to be clean" rather than passed. A SyntaxError is not retried. The retry is a new helper in watch.ts and reuses no existing function. I did not run scripts/similar.ts.

Tests (test/cloud-watch-read.test.ts): a timeout on the first read is retried and the account reads clean. A second timeout still throws. A 503 is retried once. bun test test/cloud-watch passes (23 tests), and bun x tsc --noEmit and bun scripts/gate.ts --explain are clean. I did not run scripts/design-lint.ts, since no src/web/ file changed. I did not run the full suite.

Not done:

  • Parallel reads: I tried reading the three lists in parallel. It broke the existing "never ends" test, which relies on the lists being read one after another, so I kept them sequential.
  • Failure threshold: I did not make the "could not read" issue wait for two failed hours in a row.
  • Doors: no page, action or route changed, so the terminal and docs/features/ are untouched.

Try it: bun test test/cloud-watch-read.test.ts. On the next hourly watch, a one-off slow answer from the provider should leave no issue.

Pushing was refused twice with a 530 and then went through on a later try. The branch is up to date with origin.

🤖 Generated with Claude Code

commented

Both of @juniper's points are done and pushed to the same branch.

  • Dead guard: I removed the SyntaxError line from getOnce in src/cloud/watch.ts. The pull no longer claims it. res.json() is parsed in pages(), outside the try, so the guard could never fire.
  • Tests (test/cloud-watch-read.test.ts):
    • A 503 on both asks rejects with "answered 503" after exactly 2 calls, so it is never read as clean.
    • A 401 and a 404 are each asked once and rejected.
    • A clean Hetzner read makes exactly 3 calls, one per list, with no double reads.

bun test test/cloud-watch passes (26 tests), bun x tsc --noEmit is clean, and gate.ts --fix changed nothing. It notes one comment line over 100 columns in src/cloud/watch.ts; I left that for the nightly rewrap.

I did not run the full suite or the /llms.txt byte-budget test; I didn't touch anything it covers.

🤖 Generated with Claude Code

commented

When the hourly cloud watch reads a provider and a request times out, can't connect or gets a 5xx, it now asks again exactly once (#17850). Before this round it could ask a third time if the first answer was a 5xx and the retry then threw. A second failure is still an error, so a read that fails twice is never counted as clean.

What changed

  • getOnce in src/cloud/watch.ts: only the first request is inside the try. The retry happens either in the catch or after a 5xx, and in both cases outside the try. The unused e is gone, and an earlier round removed a SyntaxError check that could never run.
  • Tests in test/cloud-watch-read.test.ts cover these cases:
    • a timeout then a success reads clean;
    • a second timeout throws;
    • a 503 then a success makes 2 calls;
    • two 503s throw after 2 calls;
    • a 401 or 404 is asked once only;
    • a clean read makes 3 calls, one per list;
    • a 503 then a throw rejects after exactly 2 calls. I put the old code back temporarily and this test failed with a third call.
  • bun test test/cloud-watch passes (27 tests), bun x tsc --noEmit is clean, and bun scripts/gate.ts --explain fails nothing.

Where this differs from the review

  • Long comments not rewrapped: the three comment lines over 100 columns in src/cloud/watch.ts (50, 54, 77) were already on main. gate.ts --fix left them alone, and when I rewrapped them by hand the gate's "rewrap noise" rule refused it ("only rewraps a comment this pull did not write"). They stay for the nightly rewrap.
  • No pause before the retry: for a timeout, the first request has already waited 30 seconds. Testing a fixed wait without a real sleep would mean adding a parameter that readLive and watchAccount both pass through, and the hourly re-read already acts as the slow retry. I can add it in a follow-up if you want it.

Try it: bun test test/cloud-watch-read.test.ts

🤖 Generated with Claude Code

commented

This pull now changes only tests. It adds three tests that pin the bounds of the cloud watch's retry. The fix itself already landed on main in #17859, so I kept main's code in the merge and dropped my getOnce.

Why the code went: main's page() in src/cloud/watch.ts does everything getOnce did, plus what the reviews asked for:

  • up to three tries, with pauses of 5 s and 15 s in between;
  • the pause can be passed in, so tests don't really wait;
  • each try gives up after 15 s;
  • no retry for 401, 403, 404 or 500;
  • a third failure still fails the read.

Tests kept (test/cloud-watch-read.test.ts): main's #17854 tests already cover a timeout or busy answer being retried, three misses failing, and a 401 being asked once. I dropped my tests that repeated those. The three that cover what main's don't, rewritten for main's three tries:

  • A read that answers makes exactly one call per list and never pauses.
  • A 503 that never clears throws "answered 503 to servers" after three tries, so it is never read as clean.
  • 503s and timeouts mixed stop at three tries, never a fourth.

bun test test/cloud-watch passes (26 tests), bun x tsc --noEmit is clean, and bun scripts/gate.ts --explain satisfies all 32 rules.

Try it: bun test test/cloud-watch-read.test.ts

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs