operator app: hold a sleep inhibitor for the whole stand-up — the laptop suspended mid hand-over and corrupted the config repo #1327

Closed
opened 2026-09-08 16:27:40 +00:00 by ben · 2 comments
Owner

Observed (manual trial, laptop .deb from db1d1b23, rented path, community Whakatohea, 2026-09-08): the gateway deploy went live at 00:32:14 local and the finish leg (hand over authority) began committing the config repo. At 00:32:30 the laptop suspended (systemd-logind), the box hard-crashed on resume, and four zero-byte objects were left in ~/.config/IDSS/clan-config/.git/objects — git status --porcelain: exit status 128 … bad object HEAD. Recovered by hand (drop the empty objects, reset refs/heads/master to the last good commit); the retry then reached hand-off.

Cause: nothing in the app holds a sleep inhibitor while a stand-up is in flight. A stand-up on an operator laptop is 30–90 min of unattended work (build, copy, switch, post-deploy legs, seeding), which is exactly the window a desktop idle timer fires in. Greps for powerSaveBlocker / systemd-inhibit / caffeinate across app, helper, internal, scripts return nothing.

Fix (two-way door, ADR 0174): the Electron shell holds powerSaveBlocker.start('prevent-app-suspension') for exactly as long as the founding client observes a stand-up in flight, and releases it the moment the stand-up rests (fault, failed deploy, spec-gate fail, a human gate such as consent or hand-off) or finishes. Derived from the StandupView every stand-up op already returns, so no new helper op. Best-effort: on a headless host or without a session D-Bus the blocker is a no-op and never a gate, so the drives and the sandboxed unit tests see no change.

Out of scope, stated: a lid-close on GNOME ignores inhibitors by default (LidSwitchIgnoreInhibited), so this covers idle-timer and menu suspend, not a closed lid. A corrupt config repo after a crash still surfaces as a raw git error — separate ticket.

**Observed (manual trial, laptop .deb from db1d1b23, rented path, community Whakatohea, 2026-09-08):** the gateway deploy went live at 00:32:14 local and the finish leg (hand over authority) began committing the config repo. At 00:32:30 the laptop suspended (systemd-logind), the box hard-crashed on resume, and four zero-byte objects were left in `~/.config/IDSS/clan-config/.git/objects` — `git status --porcelain: exit status 128 … bad object HEAD`. Recovered by hand (drop the empty objects, reset `refs/heads/master` to the last good commit); the retry then reached hand-off. **Cause:** nothing in the app holds a sleep inhibitor while a stand-up is in flight. A stand-up on an operator laptop is 30–90 min of unattended work (build, copy, switch, post-deploy legs, seeding), which is exactly the window a desktop idle timer fires in. Greps for `powerSaveBlocker` / `systemd-inhibit` / `caffeinate` across app, helper, internal, scripts return nothing. **Fix (two-way door, ADR 0174):** the Electron shell holds `powerSaveBlocker.start('prevent-app-suspension')` for exactly as long as the founding client observes a stand-up in flight, and releases it the moment the stand-up rests (fault, failed deploy, spec-gate fail, a human gate such as consent or hand-off) or finishes. Derived from the `StandupView` every stand-up op already returns, so no new helper op. Best-effort: on a headless host or without a session D-Bus the blocker is a no-op and never a gate, so the drives and the sandboxed unit tests see no change. **Out of scope, stated:** a lid-close on GNOME ignores inhibitors by default (`LidSwitchIgnoreInhibited`), so this covers idle-timer and menu suspend, not a closed lid. A corrupt config repo after a crash still surfaces as a raw git error — separate ticket.

This was generated by AI during triage.

Ruled by agent under ADR 0174 — veto anytime.

Ruling: bug + ready-for-agent.

Why a two-way door: the fix is ordinary Electron/TS product code (hold a powerSaveBlocker while a stand-up is in flight), revertible by a single commit, and — per the filer's own "best-effort" clause — a no-op on a headless host or without a session D-Bus, so drives and the sandboxed unit tests see no behaviour change. No host credentials, no protected .sandcastle/ paths, no live doors, no member-facing trust surface, no security widening. Not on the one-way-door list. The filer already tagged the fix a two-way door.

What proves it: a sandboxed vitest unit test that drives the stand-up lifecycle and asserts the inhibitor is held on the in-flight steps and released on every rest step — provable on this workstation, no re-drive needed (the real inhibitor is a no-op in the sandbox, so only the start/stop decision is under test).

Verified against the codebase (grounds the brief):

  • The claim holds: grep -rniE 'powerSaveBlocker|systemd-inhibit|caffeinate|prevent-app-suspension' across app/, internal/, helper/, scripts/ returns nothing — nothing holds an inhibitor today.
  • The lifecycle signal already exists: every stand-up op returns the seam's StandupView (app/src/lib/founding.ts:750, ops at :893+), whose standup.step is a StandupStep (app/src/lib/founding.ts:351). In-flight steps: deploying, seeded, hand-off (plus the install/reachability legs); rest steps/fields: spec-gate-fail, and standup.fault / deploy.failure for a faulted or failed deploy. Human gates (consent, hand-off waiting on a person) are also rest for inhibitor purposes.
  • Electron main process: app/src-electron/electron-main.ts (429 lines) — where powerSaveBlocker.start('prevent-app-suspension') / .stop(id) lives. No new helper op is needed; derive the held/released decision from the StandupView the client already returns.

Agent brief

Goal: the operator app must not sleep mid stand-up. Hold an Electron power-save inhibitor for exactly the window a stand-up is in flight, release it the instant the stand-up rests or finishes.

Do:

  1. In app/src-electron/electron-main.ts, hold powerSaveBlocker.start('prevent-app-suspension') when the observed StandupView reports an in-flight step, and powerSaveBlocker.stop(id) when it rests. Keep exactly one blocker id; never leak or double-start (guard on powerSaveBlocker.isStarted(id)).
  2. Derive "in flight" from the StandupView/Standup the founding client already returns — do not add a new seam op. In flight = actively working (deploying, seeded, hand-off, and the install/reachability legs that precede them). Rest = spec-gate-fail, a set fault, a failed deploy, a human gate (consent / hand-off awaiting a person), no active stand-up, or finished.
  3. Best-effort by contract: on a headless host or without a session D-Bus the blocker is a no-op and never a gate — the app must behave identically when it fails to start. Wrap in a try/catch that logs and continues.

Prove: a sandboxed vitest unit test (sibling of app/tests/unit/founding.test.ts) that feeds the lifecycle through the in-flight steps then each rest step and asserts the inhibitor decision (held ↔ released) tracks it, with powerSaveBlocker mocked. pnpm --filter app test must stay green.

Out of scope (stated by the filer): a closed lid on GNOME ignores inhibitors by default (LidSwitchIgnoreInhibited) — this covers idle-timer and menu suspend, not a closed lid. Surfacing a corrupt config repo as something friendlier than a raw git status error is a separate ticket.

Touch STATUS.md in the same commit if this changes a tracked row.

> *This was generated by AI during triage.* **Ruled by agent under ADR 0174 — veto anytime.** **Ruling:** `bug` + `ready-for-agent`. **Why a two-way door:** the fix is ordinary Electron/TS product code (hold a `powerSaveBlocker` while a stand-up is in flight), revertible by a single commit, and — per the filer's own "best-effort" clause — a no-op on a headless host or without a session D-Bus, so drives and the sandboxed unit tests see no behaviour change. No host credentials, no protected `.sandcastle/` paths, no live doors, no member-facing trust surface, no security widening. Not on the one-way-door list. The filer already tagged the fix a two-way door. **What proves it:** a sandboxed vitest unit test that drives the stand-up lifecycle and asserts the inhibitor is held on the in-flight steps and released on every rest step — provable on this workstation, no re-drive needed (the real inhibitor is a no-op in the sandbox, so only the start/stop *decision* is under test). **Verified against the codebase (grounds the brief):** - The claim holds: `grep -rniE 'powerSaveBlocker|systemd-inhibit|caffeinate|prevent-app-suspension'` across `app/`, `internal/`, `helper/`, `scripts/` returns **nothing** — nothing holds an inhibitor today. - The lifecycle signal already exists: every stand-up op returns the seam's `StandupView` (`app/src/lib/founding.ts:750`, ops at `:893`+), whose `standup.step` is a `StandupStep` (`app/src/lib/founding.ts:351`). **In-flight** steps: `deploying`, `seeded`, `hand-off` (plus the install/reachability legs); **rest** steps/fields: `spec-gate-fail`, and `standup.fault` / `deploy.failure` for a faulted or failed deploy. Human gates (consent, hand-off waiting on a person) are also rest for inhibitor purposes. - Electron main process: `app/src-electron/electron-main.ts` (429 lines) — where `powerSaveBlocker.start('prevent-app-suspension')` / `.stop(id)` lives. No new helper op is needed; derive the held/released decision from the `StandupView` the client already returns. ## Agent brief **Goal:** the operator app must not sleep mid stand-up. Hold an Electron power-save inhibitor for exactly the window a stand-up is in flight, release it the instant the stand-up rests or finishes. **Do:** 1. In `app/src-electron/electron-main.ts`, hold `powerSaveBlocker.start('prevent-app-suspension')` when the observed `StandupView` reports an in-flight step, and `powerSaveBlocker.stop(id)` when it rests. Keep exactly one blocker id; never leak or double-start (guard on `powerSaveBlocker.isStarted(id)`). 2. Derive "in flight" from the `StandupView`/`Standup` the founding client already returns — do **not** add a new seam op. In flight = actively working (`deploying`, `seeded`, `hand-off`, and the install/reachability legs that precede them). Rest = `spec-gate-fail`, a set `fault`, a failed `deploy`, a human gate (consent / hand-off awaiting a person), no active stand-up, or finished. 3. Best-effort by contract: on a headless host or without a session D-Bus the blocker is a no-op and **never a gate** — the app must behave identically when it fails to start. Wrap in a try/catch that logs and continues. **Prove:** a sandboxed vitest unit test (sibling of `app/tests/unit/founding.test.ts`) that feeds the lifecycle through the in-flight steps then each rest step and asserts the inhibitor decision (held ↔ released) tracks it, with `powerSaveBlocker` mocked. `pnpm --filter app test` must stay green. **Out of scope (stated by the filer):** a closed lid on GNOME ignores inhibitors by default (`LidSwitchIgnoreInhibited`) — this covers idle-timer and menu suspend, not a closed lid. Surfacing a corrupt config repo as something friendlier than a raw `git status` error is a separate ticket. **Touch `STATUS.md`** in the same commit if this changes a tracked row.
Author
Owner

Landed on main as d329ec7b (GOTCHAS #189). Shell holds powerSaveBlocker(prevent-app-suspension) while standupInFlight is true; released at rest/fault/failed deploy/hand-off; 12 unit tests; full app suite green (1439). Not yet in a packaged build — the next .deb Ben packages carries it. Lid-close and corrupt-repo recovery remain out of scope as stated above.

Landed on main as d329ec7b (GOTCHAS #189). Shell holds powerSaveBlocker(prevent-app-suspension) while standupInFlight is true; released at rest/fault/failed deploy/hand-off; 12 unit tests; full app suite green (1439). Not yet in a packaged build — the next .deb Ben packages carries it. Lid-close and corrupt-repo recovery remain out of scope as stated above.
ben closed this issue 2026-09-08 16:36:53 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#1327
No description provided.