Repository navigation
fix(bin): coalesce watcher signals into one wake - #4
Conversation
A crewmate's final status write and the same turn's turn-end hook land seconds apart, producing two wakes for one logical event - each costing a full firstmate turn. On the first changed signal the watcher now lingers FM_SIGNAL_GRACE (default 30s), re-scans, and reports every changed file in a single wake line. Seen-signatures are written only when a wake is actually reported, so a watcher killed mid-cycle can no longer mark a signal seen without delivering it.
|
Reviewed clean by fresh reviewer (kb-i4-rev-s2: e2e maintenance CLI + demo-run inspection + full harness green) and merged into integration branch fm/npt-build-s8 (merge 2254afa; additive conflicts vs #3 union-resolved). Lands in the single batch PR to main. |
The approval-ledger helper (agent-registry gap #4) was committed by the 6h auto-backup as 100644; fm-merge-local.sh invokes it directly, so it needs the exec bit like every other bin/ script. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Check state - correction to the Intent section aboveThe Intent section above, carried over from the task brief, states that GitHub Actions is permanently billing-refused on this repository and that The verified state on head
The single failure, Two honest caveats worth recording:
No check was relaxed, disabled, or deleted. Merge evidence remains the three SHA-256 verifications, the supersession sweep, and the local suite counts. |
* fix(watch): coalesce near-simultaneous signals into one wake A crewmate's final status write and the same turn's turn-end hook land seconds apart, producing two wakes for one logical event - each costing a full firstmate turn. On the first changed signal the watcher now lingers FM_SIGNAL_GRACE (default 30s), re-scans, and reports every changed file in a single wake line. Seen-signatures are written only when a wake is actually reported, so a watcher killed mid-cycle can no longer mark a signal seen without delivering it. * no-mistakes(document): Document watcher signal grace
chore: merge upstream firstmate main into the fork
…ry form the guard prints in its fix command. The guard prints bound refs as `owner/repo#N` (e.g. `'a/b#4'`), but `fm_livecheck_extract_items` in `bin/fm-livecheck-lib.sh` only recognized bare `#N`, so the verifier exited 2 ("no recognizable work item"). I added a `repo_ref_pat` branch to the extractor that emits `ref owner/repo#N`; it canonicalizes the same way as a bare ref bound to a repo, so duplicates still collapse. Regression test `test_hook_printed_command_is_accepted_by_the_verifier` in `tests/fm-livecheck-guard.test.sh` runs the real hook on a reply naming an issue URL, a bare `#4`, a PR URL, a Jira key and a Jenkins build URL. It extracts the command the banner prints and runs the real `fm-verify-items.sh` with a failing fake `gh`. It asserts the exit status is not 2 and that every item gets a lookup line. Before the lib change the verifier rejected the printed command with exit 2 (observed in an experiment; the test then failed on the missing `a/b#4` line). `tests/fm-livecheck-guard.test.sh` and `tests/fm-verify-items.test.sh` both exit 0 locally on macOS. I did not run them on Linux. I briefly used a path-limited `git stash push` mid-session and restored it with `git stash apply` and a drop. The working tree contains only the two intended changes
* feat: add human-readable Herdr worker presentation * no-mistakes(review): capability-gate herdr presentation and skip secondmate worker rename
…ice shaper in config (kunchenguid#4) * chore: take the personal tools out of the shared repository Remove the meeting intake and the menu-bar quota widget, which now live in a private add-on, along with every pointer to them. Drop the app- and site-specific lines from the computer-use skill, and make the desk voice sink generic: the spoken-register owner is now named by a shaper key in config/speak (FM_SPEAK_SHAPER still wins) instead of fixed project paths. * chore: drop the remaining personal setup from the computer-use skill and its tests Remove the Logic Pro card, the music-folder rule and the main-browser claim from the computer-use skill, and swap the music-app test fixture data for TextEdit. * no-mistakes(review): Document shaper contract and armed-home upgrade step for desk speech * no-mistakes(document): Point teammate voice docs at the external speech shaper
…lock and the two-actor lease' (kunchenguid#4) from fm/retire-ownership-layer into main Reviewed-on: https://git.ghazni.xyz/ghazni/firstmate-dsh/pulls/4
Intent
The firstmate watcher (bin/fm-watch.sh) produced duplicate wakes: a crewmate's final status-file write and the same turn's turn-end hook land seconds apart (observed 15s), and since the watcher exits on the first changed signal file and is restarted between wakes, one logical event (crewmate finished its turn) cost two full firstmate turns. The user asked to patch this duplicate-signal behavior. Change: the signal scan is now a pure read collecting all changed files; on the first detection the watcher lingers FM_SIGNAL_GRACE (default 30s, deliberately chosen to cover the observed 15s status-to-turn-end gap), re-scans, dedupes by file, and reports everything in one 'signal: ...' wake line. Seen-signatures are deliberately written only at wake time now, so a watcher killed mid-grace cannot mark a signal seen without reporting it (the old code wrote seen before waking). AGENTS.md section 8 wording updated to match the multi-file wake format. Single-signal wake format is unchanged ('signal: '), keeping existing wake-handling instructions valid. Tested end-to-end in a sandbox: coalescing of two signals 3s apart into one wake, no duplicate wake after restart, and solo-signal wake all verified. The added wake latency (one grace period) is an accepted tradeoff; crewmate tasks run minutes to hours.
What Changed
bin/fm-watch.shto collect changed signal files, wait through a configurableFM_SIGNAL_GRACEwindow, and emit one dedupedsignal: <file>...wake for near-simultaneous status and turn-end signals.AGENTS.mdand noted the default signal grace window inREADME.md.Risk Assessment
✅ Low: The change is narrowly scoped to watcher signal coalescing and documentation, preserves the single-signal output shape, and I found no material correctness or operational risks in the changed code.
Testing
Exercised the actual
bin/fm-watch.shend-to-end with synthetic watcher state: coalesced status plus turn-end signals, verified no duplicate wake after restart, verified kill-during-grace does not swallow a signal, verified solo-signal output shape, captured a transcript artifact, and removed transient in-worktree state afterward.Evidence: fm-watch coalescing transcript
Shows one wake containing both coalesced signal files, no duplicate wake after restart, preserved pending signal after kill during grace, and unchanged solo-signal wake format.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.
FM_SIGNAL_GRACE=2 FM_POLL=1 FM_HEARTBEAT=9999 FM_HEARTBEAT_MAX=9999 FM_CHECK_INTERVAL=9999 bin/fm-watch.shwith a status write followed by a turn-end marker 1s later, isolated from live tmux windows by a faketmuxonPATHFM_SIGNAL_GRACE=1 FM_POLL=1 FM_HEARTBEAT=9999 FM_HEARTBEAT_MAX=9999 FM_CHECK_INTERVAL=9999 bin/fm-watch.shrestarted after the coalesced wake and observed for 3s to confirm no duplicate signal wakeFM_SIGNAL_GRACE=5 ... bin/fm-watch.shkilled during the grace period, followed by a restart withFM_SIGNAL_GRACE=1, to confirm pending signals are not marked seen before a wake is reportedFM_SIGNAL_GRACE=1 ... bin/fm-watch.shwith a single status-file signal to confirm the original single-filesignal: <file>wake shape remains intact✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.