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

opened this

Merged 30h 15m ago, live in production

torque/forge:torque/17853-sentinel-cloud-watch-digitalocean-prod-w → main 0 commits fork

  • Merged. torque/17853-sentinel-cloud-watch-digitalocean-prod-w was merged into main as de6ec9b.

Review

Sign in to review this change.
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`
8585
8686 - 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.
8787 - 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."
8889 - While an orphan stands, a create on that account is refused with that sentence.
8990 - **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.
9091 - 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 {
219219 */
220220 export function problems(r: Reading, now: number): string[] {
221221 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.`];
223223 const out = r.resources
224224 .filter((x) => x.verdict === "orphan")
225225 .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";
1919 import { resolveSecrets } from "../../core/secret_store.ts";
2020 import { ownRepoPath } from "../../kernel/own_repo.ts";
2121 import type { Duty, Finding } from "../duty.ts";
22 import { lastStarted } from "../runs.ts";
2223
2324 export const titleOf = (provider: string, account: string): string => `Cloud account ${provider}/${account} shows more than the forge made`;
2425
@@ -44,7 +45,9 @@ export const duty: Duty = {
4445 // three lists an account: the runner's own 30 s would call a slow but finishing look timed out.
4546 timeoutMs: 10 * 60_000,
4647 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()),
4851 async run({ db, bus, now, app }) {
4952 if (app === undefined) return { findings: [], actions: [] };
5053 const findings: Finding[] = [];
test/cloud-watch.test.ts +9
@@ -19,6 +19,7 @@ import { firewallOf } from "../src/core/pinned_firewall.ts";
1919 import { createUser, getUserByName } from "../src/core/users.ts";
2020 import { duty } from "../src/maintain/duties/cloud_watch.ts";
2121 import { duties } from "../src/maintain/registry.ts";
22 import { record } from "../src/maintain/runs.ts";
2223 import { cloudWatchLines } from "../src/crew/notify.ts";
2324 import { quietLogs } from "./helpers/globals.ts";
2425 import { seedPlaces } from "./helpers/places-fixture.ts";
@@ -175,6 +176,14 @@ describe("cloud watch", () => {
175176 down = false;
176177 expect(due(later(9))).toBe(false);
177178 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'");
178187 // An account no longer watched keeps its last reading, and is not due for ever.
179188 allowWrite(app, admin(), "digitalocean", "main", false);
180189 expect(due(later(10))).toBe(false);

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

Keyboard shortcuts

Docs