Repository navigation
feat(bin): add opt-in steer-acknowledgment contract to detect silent steer drops - #5
Merged
Merged
Conversation
…r drops surface within minutes A steer can submit cleanly (composer verification proves submission) and still never be processed into a turn by the worker - the 2026-08-20 incident left a rebase order unprocessed for 15 minutes while supervision reported the work as under way. Close that gap with an acknowledgment layer over the existing architecture, no new daemon: - bin/fm-steer-ack-lib.sh owns durable per-order records under state/pending-acks/, the [ack=<token>] mark, ack detection against the task's status file, the watcher tick, and task cleanup. - fm-send.sh --ack (opt-in) prefixes the visible mark and arms the record before delivery; failed or unconfirmed submits discard it; secondmate, --key, and harness-command targets are refused; plain sends are unchanged. - The generated ship and scout briefs teach workers to append 'resolved [key=ack-<token>]: starting <restatement>' as the first action on a token-marked order, consistent with the keyed status grammar. - The watcher clears acked or orphaned records each cycle and queues exactly one durable actionable check wake per order unacknowledged past the window (default 180s, FM_STEER_ACK_WINDOW_SECS), enqueue-before-suppress. - Teardown clears the task's leftover records. Records are mutated only by the steer path, the watcher singleton, and teardown, so lock-refused read-only sessions never touch them.
… runtime's actual capabilities Four suites failed on machines whose runtimes cannot exercise them, in the same silent-capability class the per-user npm-tool fix (#4) addressed: - Node below 22.18 has no default type stripping, so subtests that dynamically import tracked .ts extensions with plain node failed with ERR_UNKNOWN_FILE_EXTENSION instead of skipping. Probe the capability once and skip with a clear reason in fm-calm-pi-extension (the missing-adapter-export subtest, which fabricates its own fake Pi package and so cannot ride the sibling package-presence gates), fm-pi-watch-extension (whole file - every subtest imports the .ts extension), and the two Pi subtests in fm-turnend-guard. - The Kimi hook fails closed without python3+tomllib (Python >= 3.11), so on an older interpreter every config-validation path collapses into the same tomllib refusal and fm-kimi-harness's accept/refuse matrix cannot run at all; skip the file with the concrete requirement named. CI with current runtimes still runs everything; only genuinely incapable environments skip, each with the exact missing capability in the reason.
This was referenced Aug 25, 2026
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
Firstmate repo: add a steer acknowledgment contract so silent steer drops become detectable within minutes. Incident (2026-08-20, task helm-p6-attachments, claude on herdr): a rebase order sent via fm-send exited 0 and the pane read busy from the worker's own unrelated recap, but the worker never processed the order and sat parked 15 minutes while supervision reported the work as under way; the existing composer-verification layers verify SUBMISSION, not that the agent processed the message into a turn. Deliverable, designed inside the existing architecture with no new daemon: (1) opt-in ack protocol - fm-send gains an --ack flag that prefixes the order with a visible [ack=] mark (8 lowercase hex) and the generated ship and scout brief scaffolds teach workers to append 'resolved [key=ack-]: starting ' to the status file as their FIRST action on receiving a token-marked order, consistent with fm-classify-lib.sh keyed status semantics; (2) detection - one durable pending-ack record per sent token under state/pending-acks/ (a new one-owner library bin/fm-steer-ack-lib.sh, modeled on the pending-reply sidecar pattern), with a cheap watcher tick placed beside fm_pending_reply_tick that clears acked or orphaned records and queues exactly one durable actionable 'check: steer-ack:' wake naming the task and token when an order stays unacknowledged past a bounded window (default 180s, env-tunable via FM_STEER_ACK_WINDOW_SECS), enqueue-before-suppress so a watcher crash can duplicate but never lose the wake; (3) cleanup - any status-line sighting of the token clears the record (liberal matching is deliberate: a worker quoting the mark has demonstrably received the order), teardown clears the task's leftovers, and records are mutated only by the steer path, the watcher singleton, and teardown so lock-refused read-only sessions never touch them; (4) back-compat - plain fm-send without the flag is byte-identical, workers on old briefs simply never ack so only token-marked sends arm detection, and --ack is deliberately refused for secondmate targets (their marked requests already carry the pending-reply expectation), the --key path, explicit non-task endpoints, and harness command invocations (leading '/', or '$...' to codex) whose parsing the visible prefix would break - the record is also created before submit and discarded on every failed or unconfirmed submit so transport failure (already a loud fm-send error) never masquerades as a missed ack; (5) documentation per the repo's knowledge-placement decision tree - full contracts in script headers, plus exactly two AGENTS.md lines (the state-tree entry for pending-acks/ and one trigger line in section 7 pointing at fm-send's help). Behavioral tests in tests/fm-steer-ack.test.sh follow the neighboring watcher-test harness patterns (fake tmux stubs, real fm-watch.sh subprocess, real fm-teardown.sh with a minimal git fixture); a live spawned-worker demo was explicitly not required. A second, separate commit fixes four PRE-EXISTING environment-dependent test failures encountered while running the suite, per the repo rule to fix failures you see even when unrelated: subtests in fm-calm-pi-extension, fm-pi-watch-extension, and fm-turnend-guard import tracked .ts extensions with plain node and failed with ERR_UNKNOWN_FILE_EXTENSION on node < 22.18 (no default type stripping) - they now probe that capability once and skip with a clear reason; and fm-kimi-harness hard-requires python3 with tomllib (Python >= 3.11) because the Kimi hook fails closed without it, so on an older interpreter the whole accept/refuse matrix collapses into the same tomllib refusal - the file now skips with the concrete requirement named. CI with current runtimes still runs everything. bin/fm-lint.sh is clean and the full changed-selection test run is 57 suites / 0 failures on this machine.
What Changed
bin/fm-send.shgains an opt-in--ackflag that prefixes task-bound orders with a visible[ack=<token>]mark and arms a durable pending-ack record understate/pending-acks/via the new one-owner librarybin/fm-steer-ack-lib.sh; a watcher tick inbin/fm-watch.shclears acked or orphaned records and queues exactly one durablecheck: steer-ack:wake when an order stays unacknowledged past a bounded window (default 180s, tunable viaFM_STEER_ACK_WINDOW_SECS). Plain sends are byte-identical,--ackis refused for secondmate targets,--keysends, and harness-command invocations, records are discarded on failed or unconfirmed submits, andbin/fm-teardown.shclears a task's leftovers. Ship and scout brief scaffolds (bin/fm-brief.sh) now teach workers to append a keyedresolved [key=ack-<token>]status line as their first action, with contracts documented in script headers plus two AGENTS.md lines and adocs/scripts.mdinventory row. Covered by 14 behavioral subtests intests/fm-steer-ack.test.shusing the neighboring watcher-test harness patterns (fake tmux, realfm-watch.shandfm-teardown.sh)..ts-import subtests intests/fm-calm-pi-extension.test.sh,tests/fm-pi-watch-extension.test.sh, andtests/fm-turnend-guard.test.shnow probe node's type-stripping capability once and skip with a clear reason on runtimes without it, andtests/fm-kimi-harness.test.shskips naming the concrete Python >= 3.11 tomllib requirement instead of collapsing its accept/refuse matrix on older interpreters. CI on current runtimes still runs everything.Risk Assessment
✅ Low: The feature is opt-in and additive with the plain-send path byte-identical, the durability and mutation-boundary invariants verified against the actual wake-queue and caller code, comprehensive behavioral tests following existing harness patterns, and a second commit that only capability-gates pre-existing environment-dependent test failures.
Testing
Ran the new 14-subtest fm-steer-ack behavioral suite (all pass, including real fm-watch.sh and fm-teardown.sh subprocess cases), captured a manual end-to-end CLI transcript driving the real fm-send/watcher-tick/brief surfaces through the full ack lifecycle (mark delivery, durable record, exactly-once escalation, ack clearing, refusals, docs), and confirmed the four environment-gated suites now skip with concrete named reasons instead of failing on this node 22.14 / Python 3.9 machine; no failures and the worktree is clean. No rendered UI is involved, so CLI transcripts are the evidence medium.
Evidence: Steer-ack end-to-end lifecycle transcript (real fm-send, watcher tick, brief, refusals, AGENTS.md lines)
Evidence: Demo script that produced the transcript (isolated temp fleet, fake tmux backend)
Evidence: Key lifecycle moments from the 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.
bash tests/fm-steer-ack.test.sh- all 14 subtests pass (arming, back-compat, refusals, unconfirmed-submit discard, tick window/escalation/clearing/orphans/re-arm, clear_task scoping, real fm-watch.sh escalate-once and absorb, brief teaching, real fm-teardown.sh cleanup with git fixture)Manual end-to-end demo driving real bin/fm-send.sh, bin/fm-steer-ack-lib.sh tick, and bin/fm-brief.sh against an isolated temp fleet with fake tmux: plain vs --ack keystroke comparison, durable record content, in-window silence, exactly-once wake past window with durable .wake-queue line, ack-line clearing, three refusal stderr messages, generated ship-brief ack instruction, AGENTS.md added linesbash tests/fm-calm-pi-extension.test.sh- exit 0; .ts-import subtest skips with 'no type stripping' reason on node 22.14, other subtests runbash tests/fm-pi-watch-extension.test.sh- exit 0; skips with clear type-stripping reasonbash tests/fm-turnend-guard.test.sh- exit 0; 20 subtests pass, only the two Pi .ts-import subtests skip with clear reasonbash tests/fm-kimi-harness.test.sh- exit 0; skips naming the concrete Python >= 3.11 tomllib requirement on Python 3.9Verified node 22.14 / Python 3.9 locally, i.e. exactly the environment the gating commit targets; verifiedgit status --porcelainclean after testingdocs/scripts.md:8- Pre-existing drift: docs/scripts.md toolbelt inventory is missing 10 bin/ scripts unrelated to this change (fm-lint.sh, fm-doc-audience-check.sh, fm-push-transition-lib.sh, fm-transition-lib.sh, fm-startup-memory-budget.sh, fm-startup-memory-budget-lib.sh, fm-cd-pretool-check.sh, fm-cd-command-policy.mjs, fm-install-shellcheck.sh, fm-herdr-session-cleanup.sh), and no check enforces the table's completeness; a follow-up could backfill the rows and add a completeness assertion.✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.