Repository navigation
fix(bin): resolve a pending reply only from its own task's status line - #6792
kunchenguid merged 2 commits into
Conversation
Remote reply ingestion handed every corr= token in a mate's payload to fm_pending_reply_try_resolve together with that mate's own status log, so one mate echoing another mate's token resolved the other request. Honor a status-file override only when it is the record's own parent_status, and match the corr= token as a whole word. Fixes kunchenguid#6538
|
CI failed in |
|
Speaking as Kun's firstmate: thanks, @falkoro. I read the whole diff of head What I checked: CI: "Behavior portable serial 4" failed on attempt 2 with Contract-class: restore. The library already promised that a request resolves only from a correlated line in its own parent status. Cross-task resolution broke that existing default path, and this restores it. VISION, rule by rule: one captain/honest interface aligns (a captain-facing ask can't be silently closed); authority aligns (evidence in another mate's line authorizes nothing); scripts own the mechanics aligns; restart is a non-event aligns (obligations close only on the durable event that answers them); delegation with a spine aligns; fleet outlives any vendor n/a; scope aligns. Closes #6538. |
|
Speaking as Kun's firstmate: this is merged. Thank you @falkoro — really appreciate you taking the time on this. |
Intent
Fix kunchenguid/firstmate issue #6538: a parent's pending reply (the durable expectation recorded when firstmate sends a marked, reply-bearing request to a secondmate) can be resolved by a status line from a different task, because the corr= token was matched as a substring and nothing checked that the line came from the task the request was sent to.
Maintainer triage (ready-for-pr, contract-class restore, security FYI between mates sharing a parent channel): restore resolve-only-on-matching task plus exact corr, treat quoted or relayed token text from another task as non-resolving, and pin it with a two-mate regression where mate B's line echoes mate A's token and A's request stays open.
The concrete cross-task path on main is bin/fm-procevent-remote-reply.sh: after ingesting remote mate B's payload it calls fm_pending_reply_try_resolve for every corr= token found in that payload, passing B's own status log as the status-file override, so B echoing or quoting A's token resolved A's request from B's log. All other override callers (the recovery send and escalation paths in bin/fm-pending-reply-lib.sh) already pass the record's own parent_status.
Decisions:
What Changed
_fm_pending_reply_try_resolve_lockedinbin/fm-pending-reply-lib.shnow honors a status-file override only when it is the same file (test -ef) as the record's ownparent_status. Any other file leaves the request open. This stops mate B's log, which echoes or quotes mate A'scorr=token, from resolving A's request. The no-override path is unchanged.fm_pending_reply_text_has_corrnow matches the token as a whole word.corr=<id>can't be preceded or followed by a letter, digit or underscore, soxcorr=<id>andcorr=<id>ffno longer count. Bracketed, space-terminated and end-of-line forms still resolve.test_another_mates_echo_cannot_resolvetotests/fm-pending-reply.test.sh, a two-mate regression where B's line echoes A's token and A's request stays open. The library header anddocs/remote-secondmates.mdnow say a mirrored line settles a record only when it comes from the task the request was sent to.Risk Assessment
✅ Low: The guard sits once in the shared resolver, and the only override callers (remote-reply ingest and the recovery path) pass the record's own status log. The whole-word match is a narrow tightening, and the regression test exercises the public API.
Testing
I ran the pending-reply suite on the fixed code and it passed. I then swapped in the base-commit library, and the new two-mate test failed there, which reproduces the reported bug. I restored the fix and the worktree is clean. I did not stand up a Herdr lab. The test calls the public
fm_pending_reply_try_resolvethe same way the remote-reply ingest does. I did not run the 24 other suites or the whole-word corr matching on its own.ok - another mate's echoed token cannot resolve a requestnot ok - another mate's line echoing the token must not resolve the requestokPipeline
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.
ok - another mate's echoed token cannot resolve a requestnot ok - another mate's line echoing the token must not resolve the requestokbash tests/fm-pending-reply.test.shon the fixed tree: all pass, including the new two-mate testSame suite with bin/fm-pending-reply-lib.sh temporarily swapped for the base-commit version: the new test fails withnot ok - another mate's line echoing the token must not resolve the requestRestored the fixed library afterwards;git status --shortwas clean✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
Issues
Closes #6538