Repository navigation
fix(bin): retain Pi watcher predecessor to stop false down alarms - #5174
Conversation
|
Speaking as Kun's firstmate: stamped waiting-author. HEAD contract-class: restore — tip restores the existing Pi supervision continuity path (no false WATCHER DOWN during ordinary same-process VISION: One captain/interface aligns (honest supervision alarms, fewer false outages); Authority aligns (no consent widen); Scripts/judgment aligns (extension + shell guard); Restart aligns (generation/handoff markers durable); Delegation aligns (continuity spine); Fleet/vendor aligns (Pi adapter; omp deliberately different); Scope aligns (supervision mechanics, not workshop). Align: deepens confidence looking away. CI: NM green (35638624001). CI run 35638624043 — Stock macOS Bash snapshot compatibility FAILED: stock Bash 3.2 failed to parse Overlaps files with open #5172 ( Firstmate-flag: no (author/CI blockers remain). |
…e-caused. (ci-3, genuine) Stock macOS Bash snapshot compatibility: `tests/fm-pi-watch-extension.test.sh` failed the macOS Bash 3.2 `bash -n` parse sweep with `line 4265: unexpected EOF while looking for matching '`. I built GNU Bash 3.2.0 from source locally and reproduced it. Root cause: the PR added a comment containing an apostrophe (`// Replacement shutdown deliberately retains module 2's established arm until`) inside a quoted here-document (`<<'EOF'`) nested inside a `$(...)` command substitution. Bash 3.2 has a parser bug (fixed in later bash) where an unmatched single quote inside such a here-doc body is treated as opening a shell quote and never closed, aborting the whole file parse. The base commit parses cleanly under Bash 3.2, confirming this PR introduced the break. Minimal fix: reworded the comment to remove the apostrophe (`... retains the established module-2 arm until`), preserving meaning. Verified `bin/fm-lint.sh --list-files` (the 6 changed shell files) now all pass `/tmp/bash-3.2/bash -n`; Bash 5 also parses. (ci-1, infrastructure) Behavior portable serial 8: GitHub API shows the `Run portable serial shard 8` step conclusion=success; only `Upload portable serial shard 8 timing artifact` failed with `Failed to FinalizeArtifact ... (403) Forbidden`. This is a transient artifact-service/cancellation failure, not a test or code failure. No change. (ci-2, infrastructure) Lint 1: fetched the job log via the GitHub API; it ends with `##[error]The runner has received a shutdown signal...` then exit 143. The step was cancelled mid-run, not a ShellCheck finding. Independently ran `bin/fm-lint.sh --partition 1of2 --telemetry ...` locally with pinned ShellCheck 0.11.0 and actionlint 1.7.12: exited rc=0 (no findings). No change. The only code change is the apostrophe removal in tests/fm-pi-watch-extension.test.sh; no other files modified
|
Bash 3.2 parse error in Head: All 19 checks pass at that head, including |
|
Speaking as Kun's firstmate: this is merged. Thank you @sdivanl — really appreciate you taking the time on this. Pre-merge recheck at HEAD contract-class: restore — restores existing Pi supervision continuity (no false WATCHER DOWN on ordinary same-process VISION: One captain/interface aligns (honest supervision alarms); Authority aligns; Scripts/judgment aligns (extension + shell guard); Restart aligns (generation/handoff durable); Delegation aligns (continuity spine); Fleet/vendor aligns (Pi adapter; omp deliberately different); Scope aligns. Align. Overlaps files with open #5172 / #3986 — left on their queues (not superseded wholesale). |
Summary: - Record FirstMate's watcher continuity fix. - Refresh the vendored Lavish skill from its reviewed upstream commit. Testing: - ./tests/check.sh Related: - kunchenguid/firstmate#5174 - kunchenguid/lavish-axi@a3b3987
Intent
Fix the recurring Firstmate supervision-monitoring dropouts without suppressing genuine outage alarms. Monitoring has repeatedly reported itself down while work is active, and several repairs genuinely had to start a replacement monitoring process, so this is not only a cosmetic warning.
What Changed
active/handoffphase into its extension marker; on ordinary same-process replacement,session_shutdownflips the marker tohandoffand keeps the established predecessor arm child alive until a distinct active successor generation commits its own tracked replacement arm, rather than tearing it down immediately.fm_pi_extension_loadedtakes an optional required phase, andfm_pi_extension_owns_supervisionnow requires the watcher marker to beactive, so a handoff marker left behind by a generation whose replacement never loaded the extension can no longer satisfy the fresh-beacon tolerance and suppress a genuine outage diagnostic.Risk Assessment
✅ Low: The change is well-bounded: it adds a generation-bound active/handoff marker and retains the established Pi arm child across same-process replacement until the successor's --restart retires it, with the shell guard now rejecting handoff/legacy markers; I found no concrete reachable path producing a wrong result, suppressed genuine alarm, or false alarm, and the changed tests exercise the observable lifecycle and guard behavior.
Testing
I drove the changed Pi supervision surface against the real product. The opt-in live E2E (FM_PI_LIVE_E2E=1 FM_PI_LIVE_WATCH_ONLY=1 tests/fm-pi-primary-live-e2e.test.sh) ran a real Pi 0.86.1 session through three consecutive actionable watcher closes, confirming each restored a ledger-linked successor before wake handling with no turn-end-blind warning, then intentionally stopped the live chain and confirmed the guard still emittedWATCHER DOWN - SUPERVISION IS OFF. Because that E2E does not perform a same-process session replacement, I additionally ran a manual live/newscenario against real Pi in an isolated tmux socket/home: the extension marker moved generation=1 phase=active -> phase=handoff -> generation=2 phase=active, the predecessor arm stayed alive through the uncommitted handoff, a distinct live successor watcher committed, the predecessor retired, and the real guard raised no outage alarm. I also drove the realbin/fm-guard.shagainst an isolated home holding a live session lock: a handoff-phase marker and a legacy 2-line marker each still produced the outage alarm, while a distinct active-generation marker was tolerated. The targeted deterministic suites for the extension, guard, and session-start all passed. The only surface I could not exercise live is thefm-session-start.shdiagnostic with a handoff marker, because a real Pi successor always reloads the tracked extension; that path is covered bytests/fm-session-start.test.sh. No UI surface is involved, so there is no screenshot artifact; evidence is the live CLI/guard transcripts.FM_PI_LIVE_E2E=1 FM_PI_LIVE_WATCH_ONLY=1 bash tests/fm-pi-primary-live-e2e.test.shbin/fm-guard.shstill printedWATCHER DOWN - SUPERVISION IS OFF; see pi-live-watch-…PI_WATCH_EXTENSION: not loadedEvidence: Live Pi /new replacement transcript (real Pi 0.86.1)
Source: Live Pi /new replacement transcript (real Pi 0.86.1)
startup: watcher=4780 arm=4742 owner='generation=1 phase=active' == sending /new == after /new: owner='generation=2 phase=active' saw_handoff=1 pred_alive_during=1 samples=11 successor: watcher=6206 arm=6184 guard output after /new: == sending /quit == ok - real Pi 0.86.1 live /new replacement retained the predecessor under a handoff generation, committed a distinct active successor with a live watcher, and raised no supervision-dropout alarmEvidence: Live Pi watch-only E2E result (real Pi 0.86.1)
Source: Live Pi watch-only E2E result (real Pi 0.86.1)
ok - Pi 0.86.1 live E2E covered repeated successor handoffs and a genuine stopped-chain alarmEvidence: Live adversarial guard marker-phase transcript
Source: Live adversarial guard marker-phase transcript
--- handoff marker (expect alarm) --- WATCHER DOWN - SUPERVISION IS OFF --- active marker (expect tolerance) --- (no output) --- legacy marker (expect alarm) --- WATCHER DOWN - SUPERVISION IS OFF ok - real fm-guard.sh rejects handoff and legacy markers as outage evidence, tolerates only a distinct active generationPipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
FM_PI_LIVE_E2E=1 FM_PI_LIVE_WATCH_ONLY=1 bash tests/fm-pi-primary-live-e2e.test.shbin/fm-guard.shstill printedWATCHER DOWN - SUPERVISION IS OFF; see pi-live-watch-…PI_WATCH_EXTENSION: not loadedbash tests/fm-pi-watch-extension.test.sh(50 assertions, includingPi actionable output waits for predecessor close before successor restoration,Pi session transitions auto-arm through a generation owner across /new /resume /fork/reload, stale callbacks, and quit,Pi replacement handoff tokens stay unique across fresh modules,Pi replacement persistence failure keeps its predecessor until a successor commits)bash tests/fm-guard-stale-banner.test.sh(including the extension-ownership caseshandoff-watch-generationandlegacy-watch-marker)bash tests/fm-session-start.test.sh(includingsession start rejects a Pi watcher generation left in handoff)FM_PI_LIVE_E2E=1 FM_PI_LIVE_WATCH_ONLY=1 bash tests/fm-pi-primary-live-e2e.test.shagainst real Pi 0.86.1 with the tracked extensionManual live drive/tmp/fm-pi-new-live.sh: real Pi in a private tmux socket and isolated FM_HOME,/newsent during armed supervision, sampled marker phase and arm PIDsManual live adversarial drive/tmp/fm-guard-handoff-live.sh: realbin/fm-guard.shagainst an isolated home with handoff, active, and legacy Pi watcher markers✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.