Public: anyone can read this; the crew can change it.
Sentinel: cloud-watch:digitalocean/prod was degraded 39 minutes today: The forge could not read digitalocean/prod to check it for stray machines (no answer in time); it is not known to be cl… #17861
Merged 30h 15m ago, live in production
torque/forge:torque/17853-sentinel-cloud-watch-digitalocean-prod-w → main 0 commits fork
4 files
changed +15
−2
docs/features/cloud.md +1
| @@ -85,6 +85,7 @@ The ceiling counts only what the forge's own rows say it made. The `cloud-watch` | ||
| 85 | 85 | |
| 86 | 86 | - A thing named `forge-<name>` or `forge-<name>-data` with no live pinned row is an **orphan**. A thing not named so, and not acknowledged, is **outside**. Each is priced from the Places catalog beside the forge's own reckoning and the ceiling. |
| 87 | 87 | - An orphan, an outside thing, real cost over the ceiling, or a provider that could not be read raises a card in `/health` `needs`, one notification to admins and one issue (`Cloud account <provider>/<account> shows more than the forge made`). Each sentence names the thing, its age, its monthly cost and the one action that resolves it. |
| 88 | - A provider that is slow for a moment is not a failed reading (#17854, #17853): each page gets up to three tries of 15 seconds, 5 and 15 seconds apart, when there is no answer in time, no connection, or a 429, 502, 503 or 504; any other refusal is the answer and is said at once. A reading that still fails is taken again ten minutes later rather than at the next hour (never sooner than ten minutes after the duty last started), so the `/health` card stands minutes, not the hour; the sentence says "It looks again within ten minutes." | |
| 88 | 89 | - While an orphan stands, a create on that account is refused with that sentence. |
| 89 | 90 | - **Acknowledge as not the forge's** (Settings → Cloud accounts, `o` in the terminal screen, `src/tui/screens/cloud.ts`) records everything standing as not the forge's; later readings are quiet about it, and a new one is not. |
| 90 | 91 | - Quiet when all is as expected: one line on the account says when the watch last looked and what it found. |
src/cloud/watch.ts +1 −1
| @@ -219,7 +219,7 @@ export function problemKey(r: Reading): string { | ||
| 219 | 219 | */ |
| 220 | 220 | export function problems(r: Reading, now: number): string[] { |
| 221 | 221 | const who = `${r.provider}/${r.account}`; |
| 222 | if (r.error !== "") return [`The forge could not read ${who} to check it for stray machines (${r.error}); it is not known to be clean. It looks again within the hour.`]; | |
| 222 | if (r.error !== "") return [`The forge could not read ${who} to check it for stray machines (${r.error}); it is not known to be clean. It looks again within ten minutes.`]; | |
| 223 | 223 | const out = r.resources |
| 224 | 224 | .filter((x) => x.verdict === "orphan") |
| 225 | 225 | .map((x) => `${who} shows an orphan: ${describe(x, now)}, named as the forge names things with no live forge. Retire it in the provider's console, or acknowledge it as not the forge's at ${CLOUD_PAGE}. Creates on ${who} are refused until then.`); |
src/maintain/duties/cloud_watch.ts +4 −1
| @@ -19,6 +19,7 @@ import { getRepo } from "../../core/repos.ts"; | ||
| 19 | 19 | import { resolveSecrets } from "../../core/secret_store.ts"; |
| 20 | 20 | import { ownRepoPath } from "../../kernel/own_repo.ts"; |
| 21 | 21 | import type { Duty, Finding } from "../duty.ts"; |
| 22 | import { lastStarted } from "../runs.ts"; | |
| 22 | 23 | |
| 23 | 24 | export const titleOf = (provider: string, account: string): string => `Cloud account ${provider}/${account} shows more than the forge made`; |
| 24 | 25 | |
| @@ -44,7 +45,9 @@ export const duty: Duty = { | ||
| 44 | 45 | // three lists an account: the runner's own 30 s would call a slow but finishing look timed out. |
| 45 | 46 | timeoutMs: 10 * 60_000, |
| 46 | 47 | budget: { runsPerDay: 60, dollarsPerDay: 1, reason: "hourly is 24 a day; a look that could not read a provider looks again in ten minutes, and it makes only read calls that cost no money" }, |
| 47 | dueNow: ({ db, now }) => rereadDue(db, now.getTime()), | |
| 48 | // Bounded by the duty's own last start too (#17853): an account it cannot even open the | |
| 49 | // credential of keeps its failed reading, and would otherwise make the duty run every tick. | |
| 50 | dueNow: ({ db, now }) => now.getTime() - (lastStarted(db, "cloud-watch") ?? 0) >= REREAD_MS && rereadDue(db, now.getTime()), | |
| 48 | 51 | async run({ db, bus, now, app }) { |
| 49 | 52 | if (app === undefined) return { findings: [], actions: [] }; |
| 50 | 53 | const findings: Finding[] = []; |
test/cloud-watch.test.ts +9
| @@ -19,6 +19,7 @@ import { firewallOf } from "../src/core/pinned_firewall.ts"; | ||
| 19 | 19 | import { createUser, getUserByName } from "../src/core/users.ts"; |
| 20 | 20 | import { duty } from "../src/maintain/duties/cloud_watch.ts"; |
| 21 | 21 | import { duties } from "../src/maintain/registry.ts"; |
| 22 | import { record } from "../src/maintain/runs.ts"; | |
| 22 | 23 | import { cloudWatchLines } from "../src/crew/notify.ts"; |
| 23 | 24 | import { quietLogs } from "./helpers/globals.ts"; |
| 24 | 25 | import { seedPlaces } from "./helpers/places-fixture.ts"; |
| @@ -175,6 +176,14 @@ describe("cloud watch", () => { | ||
| 175 | 176 | down = false; |
| 176 | 177 | expect(due(later(9))).toBe(false); |
| 177 | 178 | expect(due(later(10))).toBe(true); |
| 179 | // The sentence promises what the duty keeps (#17853). | |
| 180 | expect(watchNeeds(app.db, NOW.getTime())[0]!.sentence).toContain("It looks again within ten minutes."); | |
| 181 | // A start of the duty within REREAD_MS holds it back (#17853): an account whose credential will | |
| 182 | // not open keeps its failed reading, and must not make the duty run every tick. | |
| 183 | record(app.db, { duty: "cloud-watch", started: later(9), finished: later(9), findings: [], actions: [], outcome: "ok" }); | |
| 184 | expect(due(later(10))).toBe(false); | |
| 185 | expect(due(later(19))).toBe(true); | |
| 186 | app.db.run("DELETE FROM maintenance_run WHERE duty = 'cloud-watch'"); | |
| 178 | 187 | // An account no longer watched keeps its last reading, and is not due for ever. |
| 179 | 188 | allowWrite(app, admin(), "digitalocean", "main", false); |
| 180 | 189 | expect(due(later(10))).toBe(false); |
new above
offline