Skip to content

fix(bin): recognize an afk-daemon-owned watcher in the turn-end guard - #2853

Open
pramendra wants to merge 3 commits into
kunchenguid:mainfrom
pramendra:fm/turnend-guard-false-positive-under-afk
Open

fix(bin): recognize an afk-daemon-owned watcher in the turn-end guard#2853
pramendra wants to merge 3 commits into
kunchenguid:mainfrom
pramendra:fm/turnend-guard-false-positive-under-afk

Conversation

@pramendra

@pramendra pramendra commented Aug 23, 2026

Copy link
Copy Markdown

Intent

Follow-up on the merged turn-end guard afk-daemon fix: untrack the .serena/ tool-local project config that the prior pipeline run's own review/document step accidentally re-created and committed (a recurring nuisance also being fixed independently on other branches tonight), and ignore .serena/ going forward so the PR does not ship an ephemeral run-scoped file.

What Changed

  • Added fm_afk_daemon_alive and fm_afk_daemon_owns_supervision to bin/fm-wake-lib.sh, treating a live, identity-matched away-mode sub-supervisor daemon lock (state/.supervise-daemon.lock) with a beacon fresh within grace as an alternate liveness proof, mirroring the existing Pi-extension hand-off tolerance.
  • Wired that check into bin/fm-turnend-guard.sh: when the strict watcher lock/beacon check fails, the guard now also accepts daemon-owned supervision (in both --claude and default mode) instead of false-alarming during the daemon's routine watcher teardown/relaunch gap.
  • Added regression tests in tests/fm-turnend-guard.test.sh for the daemon-owned allow case in both modes, plus negative controls for a dead daemon lock and a stale beacon, and documented the new exception in docs/turnend-guard.md.
  • Untracked the accidentally committed .serena/ tool-local project config (re-created by the pipeline's own review/document step) and added .serena/ to .gitignore so it isn't shipped again.

Risk Assessment

✅ Low: The reviewed commit is a clean, narrowly-scoped chore: it untracks the two accidentally-committed .serena/ files and adds .serena/ to .gitignore, exactly matching the stated intent, with no functional code touched.

Testing

Ran the targeted turn-end guard suite (71/71 passing, covering the afk-daemon false-positive fix) and manually exercised git's real .gitignore consumer to confirm the .serena/ untrack-and-ignore follow-up works end-to-end (untracked, and a recreated .serena file is correctly ignored, not resurfaced as untracked). No issues found; worktree left clean.

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.

  • bash tests/fm-turnend-guard.test.sh — 71/71 ok, includes afk-daemon watcher regression cases (e.g. "a live afk daemon with a fresh beacon satisfies the guard", "a dead afk daemon lock does not satisfy the guard")
  • git ls-files .serena — confirms no .serena/ paths are tracked after the untrack commit
  • git status --porcelain before/after recreating .serena/project.yml — confirms git silently ignores it (real-consumer test of the new .gitignore rule)
  • git check-ignore -v .serena/project.yml — confirms the match comes from .gitignore:7:.serena/, the exact line added by the target commit
  • git status --porcelain post-test — confirms no leftover artifacts from manual verification
✅ **Document** - passed

✅ No issues found.

⏭️ **Lint** - skipped

Step was skipped.

✅ **Push** - passed

✅ No issues found.

Your Name added 2 commits August 23, 2026 18:23
…d guard

bin/fm-supervise-daemon.sh tears its watcher down and relaunches it after
every actionable wake and after a bounded crash-loop backoff, so
state/.watch.lock is routinely and briefly dead or genuinely unheld between
watcher generations while away mode is active, even though the daemon and
its beacon stay healthy throughout. fm-turnend-guard.sh's strict
fm_watcher_healthy check has no way to tell that benign hand-off apart from
an abandoned watcher, so it hard-blocked the turn on healthy supervision.

Add fm_afk_daemon_owns_supervision (bin/fm-wake-lib.sh), the daemon-managed
analogue of the existing Pi extension exception: a live identity-matched
away-mode daemon lock plus a fresh beacon now satisfies the guard in every
harness mode. A genuinely dead daemon or a stale beacon still blocks.
@greptile-apps

greptile-apps Bot commented Aug 23, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (2): Last reviewed commit: "chore: untrack accidentally committed .s..." | Re-trigger Greptile

The pipeline's own review/document step re-created this tool-local
directory and committed it. Same recurring nuisance already fixed
independently on other branches tonight; apply the identical fix here
so this PR does not ship an ephemeral run-scoped Serena project file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant