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

Sentinel: cloud-watch:hetzner/prod was degraded 39 minutes today: The forge could not read hetzner/prod to check it for stray machines (no answer in time); it is not known to be clean. … #17859

opened this

Merged 29h 58m ago, live in production

A single slow answer from a provider no longer leaves a cloud account marked "not known to be clean" for the rest of the hour. Today one Hetzner list page got no answer within 30 s. The watch only looks once an hour, so cloud-watch:hetzner/prod stayed degraded until the next look, 39 minutes later.

Notes

opened this

A single slow answer from a provider no longer leaves a cloud account marked "not known to be clean" for the rest of the hour. Today one Hetzner list page got no answer within 30 s. The watch only looks once an hour, so cloud-watch:hetzner/prod stayed degraded until the next look, 39 minutes later.

  • src/cloud/watch.ts: if a page read times out, can't connect, or gets 429/502/503/504, the same look tries that page again up to twice. Each try gets 15 s, and it waits 5 s, then 15 s, between tries. A refusal (401, 403, 404, 500) is not retried, since it would get the same answer. The pause is an optional last argument to readLive/pages (default Bun.sleep, which is how the repo already pauses), so tests run with no waiting.
  • src/maintain/duties/cloud_watch.ts: if a look still could not read an account the duty watches, dueNow brings the next look 10 minutes later instead of an hour. It skips accounts the duty no longer watches, because their old failed reading would make it due on every tick. The duty's own timeout is now 10 minutes, so a slow look that does finish isn't recorded as timed out (the runner's default is 30 s). The daily run allowance goes from 30 to 60 to leave room for the earlier re-looks.
  • Tests:
    • test/cloud-watch-read.test.ts: a timeout, a 503 and a dropped connection are each retried with the right pauses; three misses in a row fail the read; a 401 is tried only once.
    • test/cloud-watch.test.ts: a failed look is not due again at 9 minutes and is due at 10; an account that is no longer watched is never due; a clean look clears it.

Left alone: the 30 s overall fetch limit and the "not known to be clean" wording. A read that still fails after three tries is reported exactly as before. There is no page or terminal change: both still show the same stored reading, which the commit records as "No door".

Checks run: bun x tsc --noEmit and bun scripts/gate.ts are clean. 22 related test files pass, including the cloud watch suites, the duty roster and budgets, timers-named (which caught a bare setTimeout, now Bun.sleep), unused-exports, hollow and fetch-timeout. bun scripts/fast.ts named 328 files (about 20 minutes), so I didn't run all of them; the forge runs the full check on this push.

To try it: bun test test/cloud-watch-read.test.ts test/cloud-watch.test.ts. In production, cloud-watch:hetzner/prod should stay off the degraded list, or clear within about 10 minutes when Hetzner answers late.

🤖 Generated with Claude Code

Closes #17854

commented

A single slow answer from a provider no longer leaves a cloud account marked "not known to be clean" for the rest of the hour. Today one Hetzner list page got no answer within 30 s. The watch only looks once an hour, so cloud-watch:hetzner/prod stayed degraded until the next look, 39 minutes later.

  • src/cloud/watch.ts: if a page read times out, can't connect, or gets 429/502/503/504, the same look tries that page again up to twice. Each try gets 15 s, and it waits 5 s, then 15 s, between tries. A refusal (401, 403, 404, 500) is not retried, since it would get the same answer. The pause is an optional last argument to readLive/pages (default Bun.sleep, which is how the repo already pauses), so tests run with no waiting.
  • src/maintain/duties/cloud_watch.ts: if a look still could not read an account the duty watches, dueNow brings the next look 10 minutes later instead of an hour. It skips accounts the duty no longer watches, because their old failed reading would make it due on every tick. The duty's own timeout is now 10 minutes, so a slow look that does finish isn't recorded as timed out (the runner's default is 30 s). The daily run allowance goes from 30 to 60 to leave room for the earlier re-looks.
  • Tests:
    • test/cloud-watch-read.test.ts: a timeout, a 503 and a dropped connection are each retried with the right pauses; three misses in a row fail the read; a 401 is tried only once.
    • test/cloud-watch.test.ts: a failed look is not due again at 9 minutes and is due at 10; an account that is no longer watched is never due; a clean look clears it.

Left alone: the 30 s overall fetch limit and the "not known to be clean" wording. A read that still fails after three tries is reported exactly as before. There is no page or terminal change: both still show the same stored reading, which the commit records as "No door".

Checks run: bun x tsc --noEmit and bun scripts/gate.ts are clean. 22 related test files pass, including the cloud watch suites, the duty roster and budgets, timers-named (which caught a bare setTimeout, now Bun.sleep), unused-exports, hollow and fetch-timeout. bun scripts/fast.ts named 328 files (about 20 minutes), so I didn't run all of them; the forge runs the full check on this push.

To try it: bun test test/cloud-watch-read.test.ts test/cloud-watch.test.ts. In production, cloud-watch:hetzner/prod should stay off the degraded list, or clear within about 10 minutes when Hetzner answers late.

🤖 Generated with Claude Code

Sign in to join this conversation.

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

Keyboard shortcuts

Docs