Repository navigation
perf(bin): tune watcher wake cadence for quiet fleets - #354
kingstyles wants to merge 4 commits into
Conversation
…overage to fm-watch-triage test description
…ignal-coalescing cap in architecture.md
13caf39 to
d1d5f28
Compare
|
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#354 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-10, 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. |
Intent
Tune firstmate watcher/wake cadence to reduce supervising LLM token churn without weakening supervision. The requested change was to investigate the wake path, batch benign wakes harder, and consider longer effective heartbeat cadence when the fleet is small or only secondmates are running. The implemented decision keeps ordinary crewmates on the existing stale/heartbeat safety cadence, leaves per-task check poll semantics unchanged, and preserves the absorb-only-when-provably-working rule for no-verb signals and stale panes. It extends signal coalescing so status/turn-end bursts wait for a quiet grace window up to FM_SIGNAL_COALESCE_MAX, defaulting to 90 seconds only when FM_SIGNAL_GRACE is not explicitly set. It adds secondmate-only heartbeat defaults of 1800s base and 14400s cap, while explicit FM_HEARTBEAT/FM_HEARTBEAT_MAX keep the old values unless the secondmate-specific knobs are set. Expected impact: typical idle secondmate-only fleets still wake the LLM 0 times per hour on no-change heartbeats because those remain absorbed, but heartbeat fleet scans drop from 6/hour initially to 2/hour initially and from a 2h cap to a 4h cap, reducing bash supervision churn; bursty status plus turn-end completions that previously could cost two supervisor wake turns should now collapse to one. Documentation, configuration docs, and tests were updated, including hermetic missing-tool tests for hosts that already have node or orca installed.
What Changed
bin/fm-watch.shsignal coalescing so bursts of status/turn-end wakes wait for a quiet grace window capped atFM_SIGNAL_COALESCE_MAX(default 90s whenFM_SIGNAL_GRACEis unset), collapsing what used to be two supervisor wakes into one.kind=secondmate, while explicitFM_HEARTBEAT/FM_HEARTBEAT_MAXstill override; kept the watcher beacon touched during the coalescing wait loop sofm-guard.shliveness checks don't false-alarm.AGENTS.md,CONTRIBUTING.md,docs/architecture.md,docs/configuration.md, anddocs/scripts.mdto document the new cadence knobs, and added/extendedtests/fm-watch-triage.test.sh(28 assertions),tests/lib.sh, and related backend/bootstrap/session-start tests to cover the new behavior, including a fix to the fm-send conformance test's asymmetric preflight-line stripping.Risk Assessment
✅ Low: The change is a well-scoped, backward-compatible tuning of watcher cadence (signal-coalescing quiet-window loop and secondmate-only heartbeat defaults), guarded by explicit-override fallbacks that preserve old behavior, a beacon-freshness fix for the new wait loop, and thorough new tests exercising both cadences and the beacon property.
Testing
Ran the baseline command plus the full 49-file test suite (and re-ran the three files touched by this branch individually for close inspection); every test passes with no failures, confirming the round-1 fm-send conformance failure was resolved by the final commit and the new watcher-cadence behavior (secondmate-only heartbeat backoff, extended signal coalescing, beacon liveness during coalescing) is exercised and passing.
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
🔧 **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: Fix fm-send conformance test's asymmetric preflight-line stripping
✅ 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"bash tests/fm-watch-triage.test.sh (28 assertions covering secondmate-only heartbeat defaults, signal coalescing up to FM_SIGNAL_COALESCE_MAX, beacon freshness, wedge-escalation, absorb-only-when-provably-working)bash tests/fm-backend.test.sh (includes the fm-send old-vs-new conformance test whose asymmetric preflight-stripping bug was the round-1 failure)bash tests/fm-bootstrap.test.shbash tests/fm-session-start.test.shFull suite: for t in tests/*.test.sh; do bash "$t"; done — all 49 files exit 0 with no 'not ok' lines✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.