From 9140d8cd4f7e619d6eb45c3acc96f7a657ad1a2f Mon Sep 17 00:00:00 2001 From: Claude Code Bot Date: Mon, 23 Nov 2026 15:50:48 -0800 Subject: [PATCH 1/2] docs(nos-runner): recover at once after a manual fix Add an "After a manual fix" runbook step and two tests that pin the watchdog reset on an outside variable change. Closes #298 --- docs/runbooks/nos-runner.md | 15 ++++++++++++++- workers/nos-runner-watchdog/test/decide.test.js | 14 ++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/docs/runbooks/nos-runner.md b/docs/runbooks/nos-runner.md index 2e89e19..2cb0ab3 100644 --- a/docs/runbooks/nos-runner.md +++ b/docs/runbooks/nos-runner.md @@ -103,7 +103,7 @@ The updater LaunchAgent runs every 600 s. It pulls the clone and runs `install.s - **Any other SIGTERM** (`launchctl bootout` by hand, a logout) fails over to `ubuntu-latest`, then recovers: the supervisor's "set to ubuntu-latest … Reason: supervisor stopped" alert, then the watchdog's "recovered" alert. During a hold, the supervisor leaves the variable alone. Recovery can take up to about 160 minutes. - To end it sooner, set `NOS_RUNNER` back to `mimolette` by hand. + To end it sooner, see "After a manual fix" in section 6. - **Updater plist change.** A job cannot reload itself. The updater logs "updater plist changed; run install.sh by hand" and sends one alert. Run `install.sh` by hand (section 4, step 3). - **Failed updates alert.** A pass fails when the git fetch or fast-forward fails, the revision cannot be read, or `install.sh` fails. @@ -130,6 +130,19 @@ The supervisor also leaves a hold alone: a self-check failure or a SIGTERM does **Release.** Set `NOS_RUNNER` to `ubuntu-latest`. The watchdog moves it back to `mimolette` after healthy checks. +**After a manual fix.** After you repair the runner by hand, do not wait for the watchdog to recover. Do this: + +1. Confirm both slots are up. The supervisor log shows `started mimolette-N-…` for each slot, + or the org runners page lists 2 idle `mimolette` runners. +2. Run this in your own terminal. Agents cannot write org variables: + + ```bash + gh variable set NOS_RUNNER --org nightowlstudiollc --body mimolette + ``` + +3. Expect no "recovered" alert, because the watchdog sees a change it did not make and resets its counts. + If the runners are unhealthy, the watchdog fails over again after 2 bad checks (about 20 minutes). + **Full stop.** Do all three, in this order: 1. Hold: set `NOS_RUNNER=ubuntu-24.04`. diff --git a/workers/nos-runner-watchdog/test/decide.test.js b/workers/nos-runner-watchdog/test/decide.test.js index ab69127..2f0e46f 100644 --- a/workers/nos-runner-watchdog/test/decide.test.js +++ b/workers/nos-runner-watchdog/test/decide.test.js @@ -310,3 +310,17 @@ test("streak_must_be_contiguous_on_mimolette", () => { assert.equal(r.next.healthyStreak, 1); assert.equal(r.next.flaps, 3); }); + +test("manual flip to mimolette with healthy runners stays mimolette", () => { + const prev = { lastVar: "ubuntu-latest", misses: 0, goods: 1, flaps: 2 }; + const r = decide(prev, good("mimolette")); + assert.equal(r.setVar, null); + assert.equal(r.next.lastVar, "mimolette"); +}); + +test("manual flip to mimolette with no runners needs a second miss to fail over", () => { + const prev = { lastVar: "ubuntu-latest", misses: 0, goods: 1, flaps: 2 }; + const r = decide(prev, bad("mimolette")); + assert.equal(r.next.misses, 1); + assert.equal(r.setVar, null); +}); From b972639adae77d289758999b2602827f174fe226 Mon Sep 17 00:00:00 2001 From: Claude Code Bot Date: Mon, 23 Nov 2026 15:52:16 -0800 Subject: [PATCH 2/2] test(nos-runner-watchdog): pin the second miss after a manual flip Assert the second bad tick fails over with a down alert, and that the first case sends no alert and resets the miss and good counts. Advances #298 --- docs/runbooks/nos-runner.md | 2 +- workers/nos-runner-watchdog/test/decide.test.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/runbooks/nos-runner.md b/docs/runbooks/nos-runner.md index 2cb0ab3..29ecbb7 100644 --- a/docs/runbooks/nos-runner.md +++ b/docs/runbooks/nos-runner.md @@ -140,7 +140,7 @@ The watchdog moves it back to `mimolette` after healthy checks. gh variable set NOS_RUNNER --org nightowlstudiollc --body mimolette ``` -3. Expect no "recovered" alert, because the watchdog sees a change it did not make and resets its counts. +3. Expect no "recovered" alert, because the watchdog sees a change it did not make and resets its miss and good counts. If the runners are unhealthy, the watchdog fails over again after 2 bad checks (about 20 minutes). **Full stop.** Do all three, in this order: diff --git a/workers/nos-runner-watchdog/test/decide.test.js b/workers/nos-runner-watchdog/test/decide.test.js index 2f0e46f..90fd31f 100644 --- a/workers/nos-runner-watchdog/test/decide.test.js +++ b/workers/nos-runner-watchdog/test/decide.test.js @@ -316,6 +316,9 @@ test("manual flip to mimolette with healthy runners stays mimolette", () => { const r = decide(prev, good("mimolette")); assert.equal(r.setVar, null); assert.equal(r.next.lastVar, "mimolette"); + assert.equal(r.notify, null); + assert.equal(r.next.goods, 1); + assert.equal(r.next.misses, 0); }); test("manual flip to mimolette with no runners needs a second miss to fail over", () => { @@ -323,4 +326,7 @@ test("manual flip to mimolette with no runners needs a second miss to fail over" const r = decide(prev, bad("mimolette")); assert.equal(r.next.misses, 1); assert.equal(r.setVar, null); + const r2 = decide(prevOf(r), bad("mimolette")); + assert.equal(r2.setVar, "ubuntu-latest"); + assert.equal(r2.notify, "down"); });