fix(bin): prevent false watcher alarms during Claude handling - #3
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Correct the demonstrated false WATCHER DOWN alarm in the Claude Stop-owned auto-arm model. The authoritative investigation found 854 clean lifecycle closes, disproving the original unexplained-exit premise; do not alter watcher lifecycle around that premise. bin/fm-guard.sh must not label an expected active Claude handling interval as WATCHER DOWN solely because the prior watcher beacon crosses the 300-second age before the next Stop rearm. Preserve the strict PID-and-beacon watcher predicate at turn end, durable wake-queue warnings, and the existing loud recovery path for a genuine auto-arm failure. Scope the tolerance specifically to the lock-owning Claude session and its durable pending handling generation with no failure evidence, so Cursor auto-arm, Pi and pi-signed extension hand-off, and persistent-watcher harness guarantees remain strict. Review and preserve behavior across all supported primary harness supervision models and the tmux, Herdr, Zellij, Orca, and cmux runtime backends. Add executable behavioral regression tests that run the real guard in the same live Claude handling process at the demonstrated 299-second and 301-second boundary, and prove completed handling and genuine failures still alarm; source-grep and prompt-string tests are not acceptable substitutes for behavior. Preserve every existing change. A separate secondmate child-worktree test failure was causally diagnosed: both clean HEAD and the implementation fail only when an unrelated inherited FM_ROOT_OVERRIDE redirects fixture scope, while removing that single condition makes the proven path pass; treat it as demonstrably pre-existing and unrelated, and validate the relevant suites under clean fixture environment. Push and open a PR through no-mistakes, but never merge it.
What Changed
Risk Assessment
✅ Low: The change is narrowly scoped to lock-owned Claude pending-handling intervals, preserves strict failure and sibling supervision paths, and adds executable boundary regressions without source-content-only assertions.
Testing
Under a clean fixture environment, the real guard stayed healthy for the same live lock-owning Claude handling process at both 299s and 301s, while completed handling and genuine auto-arm failures still alarmed; queued-wake warnings, strict turn-end behavior, Cursor/Pi/persistent supervision, and tmux/Herdr/Zellij/Orca/cmux backend behavior also passed. The initial turn-end run inherited active-session routing variables and failed an unrelated fixture, then passed when those ambient variables were removed as required.
Evidence: Claude guard behavioral regression transcript
Source: Claude guard behavioral regression transcript
Evidence: Strict turn-end guard transcript
Source: Strict turn-end guard transcript
Pipeline
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.
env -u FM_ROOT_OVERRIDE bash tests/fm-guard-stale-banner.test.shenv -u FM_ROOT_OVERRIDE bash tests/fm-turnend-guard.test.sh(initial attempt exposed inheritedFM_HOME/supervision routing contamination)env -u FM_ROOT_OVERRIDE -u FM_HOME -u FM_STATE_OVERRIDE -u FM_CONFIG_OVERRIDE -u FM_DATA_OVERRIDE -u FM_PROJECTS_OVERRIDE -u FM_SUPERVISION_MODEL bash tests/fm-turnend-guard.test.sh✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.