Repository navigation
fix(bin): refuse empty text steers in fm-send - #4259
Conversation
7a34956 to
4b54305
Compare
|
Ready for your review when convenient. All 14 checks are green at head Contents, for context on the diff size:
No rush from our side — happy to rebase, split, or drop the autoformat commit if you prefer. |
55675e4 to
d88a710
Compare
d88a710 to
70a9c36
Compare
A marked secondmate request sent with an empty message delivered only marker and correlation bytes and minted a pending-reply expectation the parent could never see resolved, stalling the fleet with no loud error (#4255). Fail closed on an empty or whitespace-only message on the text path, mirroring the existing --resolve-key refusal.
Formatting-only edits produced by ambient Pi-lens autoformat during the msg-loss investigation, kept separate from the behavioural change in c23acba6 so the fix stays reviewable on its own. AGENTS.md is deliberately excluded: its only autoformat edit stripped the trailing space from the documented FM_OPERATIONAL_PREFIX value, which bin/fm-operational-input.sh:28 defines as "FIRSTMATE_OP: " and line 11 records as permanent compatibility. Documenting that constant without its trailing space makes the doc wrong about the contract, so that one line was restored rather than retained.
70a9c36 to
9d464d2
Compare
|
Speaking as Kun's firstmate: this is merged. Thank you @pablontiv — really appreciate you taking the time on this. |
|
Speaking as Kun's firstmate — triage audit for the merge above: Contract-class: restore. Empty/whitespace-only marked text steers were incorrectly accepted ( VISION.md per-rule (inspected refuse hunk + test; whitespace-normalized scan of spawn/handoff/send):
Attestation MATCH; CI |
Intent
Fix message loss: fm-send admits empty and whitespace-only marked text steers, silently dropping the instruction body while still marking and recording the message as delivered, which stalls downstream work with no visible cause. Refuse empty and whitespace-only text steers before marking, recording, or typing them. Refs Firstmate issue #4255.
What Changed
bin/fm-send.shnow rejects an empty or whitespace-only text steer with an explicit error before the message is marked, recorded, or typed, instead of silently delivering marker/correlation bytes with no instruction body.tests/fm-send-inbox.test.shaddstest_empty_message_refused, covering a marked secondmate steer, an explicit empty-string argument, and a whitespace-only message, asserting a nonzero exit, no inbox record, no pending-reply expectation, and nothing typed.bin/fm-send.sh,bin/fm-backlog-handoff.sh,bin/fm-spawn.sh, andtests/fm-send-inbox.test.sh(indentation, brace/redirect spacing), with no behavior change beyond the fix above.Risk Assessment
✅ Low: The behavioral fix (788358c) is an 8-line, correctly-placed guard in bin/fm-send.sh that refuses empty/whitespace-only text steers before any marking, recording, or typing occurs (verified by tracing MESSAGE usage: marking at line 772, inbox write at line 998, both after the new check at line 754-757), matches the required intent exactly, and is covered by new tests; the second commit (9d464d2) touches three additional files but is verified byte-for-byte equivalent to pure whitespace/formatting changes (semicolons to newlines, brace-block reflow,
|spacing in case patterns, removed line-continuation backslashes, redirect joins) via whitespace-normalized token-stream diffing across all four changed files, with zero surviving semantic differences.Testing
Ran the project's fm-send-inbox test suite (all 13 assertions pass, including the new empty-message case) and independently drove the real bin/fm-send.sh CLI against a hand-built stubbed-tmux harness (bypassing the gate-agent fleet-refusal guard the same way the test suite does) for empty-string, whitespace-only, and normal messages on both a plain target and a marked-secondmate target; all matched the intended behavior — refusal before marking/recording/typing for empty/whitespace input, normal delivery (including pending-reply minting) unaffected.
bin/fm-send.sh t1 ""-> rc=1, stderr 'error: a text steer requires a nonempty message...', no t1.inbox dir created, send.log emptybin/fm-send.sh t1 $' \t \n '-> rc=1, same refusal message, no inbox dir, nothing typedbin/fm-send.sh domain ""-> rc=1, refusal message, no domain.inbox dir, pending-replies count 0bin/fm-send.sh t1 "hello world"-> rc=0, inbox/001.msg + doorbell typed; secondmate targetbin/fm-send.sh domain "please check status"-> rc=0, inbox created, pending-r…bash tests/fm-send-inbox.test.shtest_empty_message_refused case 'keypath-after-refusal':run_send ... t1 --key EntersucceedsPipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
🔧 **Rebase** - 1 issue found → auto-fixed ✅
bin/fm-spawn.sh- merge conflict rebasing onto origin/main🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
bin/fm-send.sh t1 ""-> rc=1, stderr 'error: a text steer requires a nonempty message...', no t1.inbox dir created, send.log emptybin/fm-send.sh t1 $' \t \n '-> rc=1, same refusal message, no inbox dir, nothing typedbin/fm-send.sh domain ""-> rc=1, refusal message, no domain.inbox dir, pending-replies count 0bin/fm-send.sh t1 "hello world"-> rc=0, inbox/001.msg + doorbell typed; secondmate targetbin/fm-send.sh domain "please check status"-> rc=0, inbox created, pending-r…bash tests/fm-send-inbox.test.shtest_empty_message_refused case 'keypath-after-refusal':run_send ... t1 --key Entersucceedsbash tests/fm-send-inbox.test.sh (all 13 cases incl. test_empty_message_refused)manual: bin/fm-send.sh t1 '' against stub tmux -> rc=1, refusal message, no inbox dir, nothing typedmanual: bin/fm-send.sh t1 $' \t \n ' (whitespace-only) -> rc=1, same refusal, no inbox, nothing typedmanual: bin/fm-send.sh t1 'hello world' (control) -> rc=0, inbox/001.msg created, doorbell typed, payload never typedmanual: bin/fm-send.sh domain '' against a kind=secondmate meta -> rc=1, refusal, no domain.inbox, 0 pending-replies (the exact reported bug scenario)manual: bin/fm-send.sh domain 'please check status' (secondmate control) -> rc=0, inbox created, 1 pending-reply minted✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.