Pause and resume a maintenance duty (#11205)

Each duty the forge's maintenance runner runs (src/maintain/registry.ts) has an on/off switch, kept in maintenance_duty_state. A paused duty is skipped by every tick. After three errored runs in a row (it threw, timed out or had a finding refused) the runner pauses the duty itself and says why: "paused after 3 errors in a row; last error: …". Resuming starts the count again, so one more error does not pause it at once. The pause also files one issue on the forge's own repository (FORGE_REPO) naming the duty and its last error (src/maintain/park.ts); it carries a Maintenance key: parked/<duty> line, so while it is open no second is filed, restarts included. Closed, the next park files a new one.

All doors are for a forge admin and call one function, switchDuty in src/maintain/pause.ts, so they say the same words.

An unknown duty name is 404 (a flash on the page); a paused that is not a boolean is 422.

Tests: test/maintain-parked-issue.test.ts (one issue for three failures and a fourth tick), test/maintain-pause.test.ts (the three errors, resume from the API, the page and the terminal, the gates).

Merged branches (#13321)

The merged-branches duty finds branches of pulls that merged over seven days ago and whose tip is still the head they merged with. Never listed: the default branch, a branch an open pull uses, a branch that moved since, a fork's branch. It reads refs from the repository's files in one pass (no git process per branch) and lists at most 100 (MERGED_CAP), oldest first.

Tests: test/maintain-merged-branches.test.ts, test/maintain-merged-web.test.ts.

Wait split (#13635)

The wait-split duty finds where a slow public page waits. Every six hours, from the forge's own host, it does three things for each of /healthz, /, /pricing, /terms and /privacy: it times a TCP+TLS handshake with the public origin (the edge), a GET of the public URL (to first byte and to the last byte), and a GET of the same path on 127.0.0.1:<port>, which skips the edge and the tunnel. It also reads the app;dur= the forge wrote in Server-Timing. src/maintain/wait_split.ts splits the first-byte time into edge = connect, tunnel = first byte − connect − loopback, accept = loopback − app, and app. The largest share names the layer. A page under 1 s waits in none. It sends GET only, and its timeout is the proof's own 15 s. A slow or unanswered page is a finding, and every page is one line on /maintenance. Inside a cell, the bare handshake cannot pass the egress proxy: that line says so and counts the handshake as 0 ms.

Tests: test/maintain-wait-split.test.ts.

Duty idle (#13406)

The duty-idle duty watches the other duties for silence. Hourly, it looks at when each duty last started (budget stops do not count as a start). A duty whose last start is more than twice its interval ago is idle; exactly 2x is not. A duty that has never run is skipped, because there is no last run to name. The watcher never watches itself.

For each idle duty it files one issue, once (an open one is not filed again), titled The maintenance duty <name> has not run in twice its interval. The body gives the last run time and the interval. It spends no money.

There is no terminal screen for it: it files an issue, and both doors (the web and the terminal) already show issues.

Tests: test/duty-idle.test.ts.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs