Repository navigation
Conversation
|
Automated reminder: thanks for the PR! This branch currently has a merge conflict with the base branch. When you get a chance, please rebase onto (or merge) the latest base branch, resolve the conflict, and push. After that, checks will re-run and the PR will get looked at again. Noted for firstmate#553 at |
|
Automated reminder: this PR still looks blocked on a rebase or merge conflict fix. If you are still interested, please rebase onto the current base branch, resolve the conflict, and push. If I do not hear back, I may close this as inactive. |
|
I am closing this because it has been waiting on a rebase or merge-conflict fix since 2026-07-17, and I have not seen a comment or push since then. If you still want to keep working on this, please reopen it or open a new PR and mention this one. Happy to take another look when there is an update. |
|
Live proof on production, 2026-10-27 ~18:25 UTC.
Fixed. Closing. I signed in on
|
Intent
Fix the Firstmate Pi primary watcher tool disappearing after /reload when a later-loaded extension resets the active tool list. Keep only fm_watch_arm_pi active alongside the current selected safety allowlist, without reactivating unrelated tools or weakening plan/review/validation restrictions, and avoid delayed callbacks that use stale extension APIs. Preserve the human command, tool API, attached process wake delivery, and clean shutdown. Treat restart exit 143 as benign only after the canonical home-scoped health predicate verifies a different watcher with a fresh beacon, while retaining genuine failure reporting. Add deterministic and isolated live reload coverage and record exact empirical evidence in the Pi supervision documentation.
What Changed
fm_watch_arm_piactive alongside Pi’s current safety allowlist after reloads and later tool-surface resets.Risk Assessment
✅ Low: The change is well-bounded, preserves the selected tool allowlist, avoids stale Pi API calls after shutdown, and safely scopes restart handoff handling.
Testing
Completed 1 recorded test check.
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 2 issues found → auto-fixed (4) ✅
.pi/extensions/fm-primary-pi-watch.ts:183- The required criterion says to “avoid delayed callbacks that use stale extension APIs.” After session shutdown, this handler waits up to five seconds for replacement health and may then call sendWake() through the old captured pi.sendUserMessage API. If that API is invalidated during reload, genuine exit-143 failure reporting is silently lost by the catch block. Move verification and failure delivery to the current extension generation or otherwise avoid using the unloaded API.tests/fm-pi-primary-live-e2e.test.sh:124- The live test copies the user's long-lived Pi auth file beneath the repository in an unignored .pi-live-e2e.* directory. An abrupt termination can leave credentials exposed to git status or accidental staging. Use a restrictive temporary directory outside the source tree or avoid materializing the credential under the repository.🔧 Fix: Captain, preserve Pi reload wake delivery safely
1 error still open:
.pi/extensions/fm-primary-pi-watch.ts:310- reportPriorRestart() runs unconditionally without verifying session-lock ownership. A read-only Pi session sharing the same FM_HOME can consume and delete the owning session's restart handoff, contradicting the requirement to retain genuine exit-143 failure reporting. Gate handoff processing and deletion against the existing ownership predicate.🔧 Fix: Captain, gate Pi restart handoffs by session ownership
1 error still open:
.pi/extensions/fm-primary-pi-watch.ts:201- The required criterion says exit 143 is benign only after verifying a different watcher. If reload occurs before the arm child records.watch.lock/pid,previousPidis empty; this check then accepts any briefly healthy PID, including the old watcher still shutting down, as “different.” Do not suppress exit 143 unless a valid prior watcher PID was captured and the canonical predicate returns another PID.🔧 Fix: Captain, require valid prior Pi watcher PID
3 errors still open:
.pi/extensions/fm-primary-pi-watch.ts:270- The requirement says to keepfm_watch_arm_piactive “alongside the current selected safety allowlist.” Restoration runs only duringresources_discover, which Pi emits at startup/reload. Workflow Suite callssetActiveTools(...)during later plan/review/validation transitions, so the watcher tool disappears again until another reload. Reassert it after runtime tool-surface changes without restoring any unrelated tools..pi/extensions/fm-primary-pi-watch.ts:202- The fixed, unversioned handoff file can be cleared or overwritten by an older generation's delayed health check during a rapid second reload. That can delete the newer reload's handoff and contradict the requirement to retain genuine failure reporting. Add generation ownership/CAS and clear only the exact handoff originally read..pi/extensions/fm-primary-pi-watch.ts:197- If reload writescomplete:falsebut the prior child never records its close result, every subsequent generation waits five seconds and returns without reporting or clearing the handoff. Treat an owned handoff that remains incomplete at the deadline as an actionable failure so genuine shutdown failures are retained.🔧 Fix: Captain, preserve Pi watcher runtime and restart handoffs
✅ Re-checked - no issues remain.
command -v tmux >/dev/null || { echo "tmux is required for e2e tests" >&2; exit 1; }; tmux -V; rc=0; for t in tests/*.test.sh; do echo "== $t =="; bash "$t" || rc=1; done; exit "$rc"✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.