Repository navigation
Conversation
added 9 commits
July 21, 2026 04:10
PR kunchenguid#693 replaced the arm layer's silent empty-cycle exit with a loud "watcher: FAILED" line, but never checked whether a wake had already landed durably before claiming "no actionable reason" - so a wake that queued successfully just before the process lost visibility into its own reason text (an attached arm never sees the owning watcher's stdout; an owned child can die between a successful append and its own wake() call) got the same false alarm a genuinely stuck cycle gets. bin/fm-watch-arm.sh now snapshots state/.wake-queue.seq at cycle start and reports an accurate "N wake(s) already queued" line instead of the typed FAILED text whenever the queue advanced during the cycle, keeping the FAILED alarm only for the genuinely-empty case. bin/fm-watch.sh's handle_push_transition and multi-file signal loop also stop discarding an already-queued wake on an unrelated post-append failure (a dedupe-marker commit, a partial append): those failures are now best-effort/diagnostic instead of a silent exit 1. bin/backends/herdr.sh's capability probe no longer SIGPIPEs on stderr (cosmetic, pre-existing since PR kunchenguid#472; unrelated to the misreporting but bundled per the same investigation). Root-caused and reproduced deterministically in data/scout-watcher-chain-w1/report.md; upstream issue kunchenguid#693.
This was referenced Jul 21, 2026
raywest
added a commit
to raywest/firstmate
that referenced
this pull request
Jul 21, 2026
* fix(watch): snapshot queue boundary before fork; dedupe partial-append count Port two review-confirmed fixes for the watcher-cycle queued-wake reporting landed by fork PR #7: - Cycle-begin snapshot-before-fork race: the wake-queue sequence baseline is now captured before starting or attaching to a watcher cycle, not after. Capturing it after the fork let a child append and die in the gap, making the new-wake count zero and re-enabling the false FAILED outcome PR #7 was meant to eliminate. The same race in successor adoption is fixed by carrying the original boundary forward across replacement watchers instead of resampling mid-loop. Ported from raywest/firstmate fm/fm-watch-armfix-upstream-r1 (upstream kunchenguid/firstmate PR kunchenguid#807), narrowed to just this fix - the rest of that branch was rebuilt on upstream/main and carries unrelated packaging differences. - Unique-file partial-append count: bin/fm-watch.sh's signal loop scans twice (before and after the grace sleep), so an unchanged pending file is listed twice. The append loop and the pending_total diagnostic both iterated raw pending lines instead of unique files, so a single file was durably appended to the wake queue twice. This fix originates here from the upstream PR kunchenguid#807 reviewer's finding, not as a port - no commit on that branch (or its predecessor) actually applies it, so it does not exist upstream to port. Regression tests adapted/added for both paths. * no-mistakes(document): Document watcher queue boundary timing --------- Co-authored-by: Ray West <[email protected]>
Owner
|
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#807 at |
Owner
|
Speaking as Kun's firstmate: closing this as stale. It has been waiting on a contributor update for 14+ days with no author push or comment. Reopen if you want to pick it back up. |
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.
What Changed
FAILEDalarms.Risk Assessment
✅ Low: The latest successor-boundary fix is narrowly scoped and preserves the queue and retry invariants established by the surrounding changes.
Testing
Completed 1 recorded test check.
Pipeline
Updates from git push no-mistakes
⏭️ **intent** - skipped
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 3 issues found → auto-fixed (2) ✅
bin/fm-watch-arm.sh:315- This new “already queued” outcome is neither an actionable reason nor a literal FAILED line. Pi/OpenCode classify the nonzero exit as a failure, retry silently on success, and never prompt the model to drain the real queued wake. Make this outcome actionable to those adapters (or emit a canonical actionable line).bin/fm-watch-arm.sh:138- The sequence baseline is captured only after the watcher is forked. A child that appends a wake and is terminated before printing it in that interval is included in the baseline, so the new count is zero and the false FAILED result remains possible. Establish the queue boundary before starting/following the cycle.bin/fm-watch.sh:681- For a paused blocked pane, a failed marker commit now returns normally with no backoff. Because the marker remains absent, the next level reconciliation immediately returns the same transition, bypassing the normal poll wait and repeatedly hitting Herdr. Preserve a failure/backoff path when this no-wake commit fails.🔧 Fix: Fix watcher cycle and retry backoff
1 warning still open:
bin/fm-watch-arm.sh:303- A replacement watcher can append a wake before this loop samples its sequence, then exit before producing visible output. That wake is included inSUCCESSOR_QUEUE_SEQ, so the next unexplained close is still reported as empty. Carry the prior watched cycle’s boundary through successor adoption (or otherwise establish it before the successor can append).🔧 Fix: Preserve queue boundary across successors
✅ Re-checked - no issues remain.
🔧 **Test** - 1 issue found → auto-fixed ✅
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"🔧 Fix: Fail metadata writes; correct watcher assertion
✅ 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.