Skip to content

fix(bin): make remote report transfers explicit and fail-open - #4658

Merged
kunchenguid merged 10 commits into
mainfrom
fm/fm-remote-doc-transfer-fix-r1
Sep 16, 2026
Merged

kunchenguid merged 10 commits into
mainfrom
fm/fm-remote-doc-transfer-fix-r1

Conversation

@kunchenguid

@kunchenguid kunchenguid commented Sep 16, 2026 •

Copy link
Copy Markdown
Owner

Intent

Implement the remote-reply document-transfer fix recommended in the scout report data/fm-remote-doc-transfer-failure-diag-s1/report.md (section 12); the captain has authorized this ship. Two defects matter, plus the correctness and tests they require: (b) make the remote-reply document escalation self-clearing and re-attemptable, so a missing document becomes a durable, re-attemptable obligation that clears itself once the document arrives; and (1/2/5) stop treating a bare path mention in free text as a document offer - fetch only on an explicit structured pointer. Deliver via no-mistakes; yolo is off, the captain owns the merge.

REVISED SCOPE (captain's decision after the fail-open assessment): adopt the measured-sufficient FAIL-OPEN scope instead of the fuller approach. A failed or missing document fetch must NEVER raise a durable blocking decision - it is skipped and the cursor advances (fail-open), which fixes the never-clearing false block by construction. Fetch only on an explicit structured report= pointer, and keep the boundary-correct pointer parser with checked extraction/rewrite exit status plus the tests for prose-not-fetched, structured delivery, boundary edges, and a failed write never advancing the cursor. DROP the durable self-clearing obligation state and its poll-side retry, DROP the canonical line identity, and DROP the cross-home exclusion (a cross-home report= either fails to fetch harmlessly or is a legitimate nested remote report; dropping the exclusion is approved and restores legitimate nested remote chains). Accept and document two limitations in the PR: (a) an upgrade duplicate is a one-time effect only - at most one duplicate per legacy delivered bare-path line, only on a whole-log recapture, and this scope removes the ongoing duplication that exists today; include the reasoned residual that a legacy duplicate of a since-resolved decision line could read as re-opening it; (b) no automatic re-attempt for the narrow file-replaced-mid-read race, since the document stays on the remote and the mirrored line still names it. An optional unkeyed reason-note keeping a genuinely undeliverable document visible without entering the decision fold is allowed at the crew's discretion. Land as follow-up commits on the current pipeline head, not a rebuild from main.

The referenced scout report is a private investigation record that does not live in this repository, so the substance of its diagnosis follows.

bin/fm-procevent-remote-reply.sh treated any data/*.md substring in any mirrored remote-secondmate status line as an unconditional instruction to fetch that document through the path-confined remote reader. A remote mate announced a scout and named in prose the path its report would later be written to. The report did not exist yet, the reader returned exit 1, and exit 1 was hard-coded to mean the remote reader refused the document and always would, so the adapter raised blocked [key=remote-reply-document-]. That key had one writer and no resolver anywhere, so the decision could never expire, could not be superseded by the later successful fetch of the very same document, and stood open describing a transfer that had in fact succeeded. The mate's own lines explaining the false alarm also contained the path, so they triggered more failed fetches in one delta and a second block naming the path twice. There was never a transport failure: the document transport was healthy, the report arrived minutes later over the same transport through a later structured report= line, and a live fetch of it succeeded. The reader cannot distinguish a file that is not written yet from one that will never exist, because both return the same exit status.

The ledger publisher in bin/fm-inactive-reconcile.sh emits a report= pointer only after confirming the report file exists, so a structured ledger offer is never early. A whole-log recapture of the remote log happens when the relay's cursor is lost; in code the only path that deletes the cursor is retiring a remote second mate.

What Changed

  • Fetch remote documents only from boundary-valid report=data/….md pointers, leaving bare path mentions untouched.
  • Fail open on undeliverable reports by advancing the cursor and recording an unkeyed reason note instead of a blocking decision.
  • Preserve normalized source-line replay identity, enforce checked extraction and writes, and document/test structured delivery, boundary cases, replay behavior, and transfer limitations.

Risk Assessment

✅ Low: The replay-stable source-line identity follows the authorized ordering and lifecycle constraints, preserves structured-pointer fail-open behavior, and introduces no substantiated correctness or security defect.

Testing

Ran the real remote-reply adapter and process-event runner end to end in an isolated local/remote-home fixture, covering structured transfer, prose handling, fail-open refusals, parser boundaries, failed writes, retries, and replay stability; all scenarios passed and the worktree remained clean.

  • Live validation: ✅ go - 6 of 6 scenarios driven live against the product
Scenario Result Live Evidence
A mate mentions an existing data/*.md path in prose, and the parent mirrors it unchanged without fetching or opening a document decision ✅ pass live Remote-reply end-to-end product transcript: “the remote status and decision model mirrors and the cursor advances” and “the reported incident raises no standing decision and still delivers the report”
A mate publishes an explicit report= pointer, and the parent fetches the document byte-for-byte and rewrites the pointer to its local mirror ✅ pass live Remote-reply end-to-end product transcript: “ingest appends one validated line, fetches its document, and advances the cursor” and “the reported incident raises no standing decision and still delivers…
A malformed, glued, or prefix-only report pointer is rejected while adjacent boundary-valid pointers are fetched and rewritten ✅ pass live Remote-reply end-to-end product transcript: boundary scenarios for malformed, adjacent, and glued pointers all report ok
An unavailable or oversized structured document fails open: its line remains visible, no durable decision opens, and the cursor advances ✅ pass live Remote-reply end-to-end product transcript: “an undeliverable structured offer fails open with one note and never a decision” and “a remote refusal surfaces its own reason without opening a decision”
Pointer extraction, local storage, or parent-stream write failure leaves the delta and cursor uncommitted, then the same delta applies after recovery ✅ pass live Remote-reply end-to-end product transcript: extraction failure, mirror-write failure, and local-storage recovery scenarios all report ok
A commit failure or cursor-loss replay after document availability changes does not duplicate or reopen the original structured decision line ✅ pass live Remote-reply end-to-end product transcript: “source-line identity survives commit failure and cursor-loss recapture” and “a cursor-loss whole-log recapture is acknowledged quietly with no duplicate wa…
Evidence: Remote-reply end-to-end product transcript

Source: Remote-reply end-to-end product transcript

ok - a blocking non-destructive remote delta reaches durable process-event capture
ok - a captured delta is applied, acknowledged, and re-armed without a handler
ok - ingest appends one validated line, fetches its document, and advances the cursor
ok - replayed capture has one deduplicated append and one durable handling identity
cannot retire terminal source; it remains registered: remote-reply-ios
cannot retire terminal source; it remains registered: remote-reply-ios
ok - later generations cannot invalidate an unacknowledged ingested result
cannot retire terminal source; it remains registered: remote-reply-ios
ok - the remote status and decision model mirrors and the cursor advances
ok - a remote mate's new decision folds open exactly as a local mate's does
ok - a replayed mirrored delta is idempotent in both the stream and the cursor
cannot retire terminal source; it remains registered: remote-reply-ios
ok - transported control bytes are normalized in place and never stop the stream
cannot retire terminal source; it remains registered: remote-reply-ios
ok - payload protocol-field names cannot collide with transport metadata
cannot retire terminal source; it remains registered: remote-reply-ios
ok - NUL bytes are normalized in place before shell line processing
ok - local document storage failures remain retryable until delivery succeeds
ok - a structured pointer must end at its token boundary
ok - adjacent pointers are fetched while malformed tokens remain unchanged
ok - a rejected candidate never gives the following text a false leading boundary
ok - nested remote reports relay while an undeliverable foreign pointer fails open
ok - the reported incident raises no standing decision and still delivers the report
ok - an undeliverable structured offer fails open with one note and never a decision
ok - a remote refusal surfaces its own reason without opening a decision
ok - a failed pointer extraction never commits a partial delta
ok - a failed mirror write never drops status content or advances the cursor
ok - source-line identity survives commit failure and cursor-loss recapture
ok - a mirrored reserved-key line cannot squat or clear the parent's own decision
ok - a reply that arrives after escalation resolves it and clears the open decision
ok - a preempted reply poll cannot publish channel freshness
ok - a quiet reply window publishes the caught-up watermark the reply guard reads
ok - a cursor-loss whole-log recapture is acknowledged quietly with no duplicate wake
ok - truncation is detected, escalated once, and not silently rebased
ok - remote reply retirement quiesces and refuses unhandled captured results
ALL TESTS PASSED

Accepted limitations

These were reviewed and accepted as part of the scope decision.

1. One-time legacy upgrade duplicate.
The previous release treated a bare data/*.md path mention as a document offer and rewrote it to its local copy when the document transferred.
This change fetches only on a structured report= pointer, so such a legacy line is no longer recognized as a pointer.
If the remote log is later re-read from the start, each legacy delivered bare-path line can be mirrored once more in its un-rewritten form, at most once per line.
A whole-log re-read happens when the relay's cursor is lost; in code the only path that deletes the cursor is retiring a remote second mate and re-adding it under the same id.
Lines mirrored after this change are protected by the source-line identity.
Residual, reasoned from the open-decision fold rather than measured: if a duplicated legacy line is a needs-decision or blocked line whose key has since been resolved, appending it at the end of the stream reads as re-opening that decision.
For comparison, main already duplicates lines on such a re-read (early prose mentions whose document later arrived), and this change removes that ongoing duplication.

2. No automatic re-attempt for an undeliverable document.
A structured offer whose fetch fails is not retried by the channel's poll.
The ledger publisher only emits report= after confirming the file exists, so for it the remaining window is a file replaced mid-read or a short read.
The document stays on the remote, the mirrored line still names it, and a later structured offer of the same path fetches it.
An unkeyed note: line records the reader's reason; it never enters the open-decision fold, so it cannot stand open the way the original keyed block did.

3. Double-fault residual in the source-line identity.
Mirrored lines are appended before their source identities are recorded, because the reverse order could record a line the parent never received.
If that status append succeeds but recording the identity then fails, and the document's availability also changes before the retry, that one line can still be mirrored twice.

Pre-existing document blocks. Blocks raised by the previous release under remote-reply-document-<id> do not clear themselves, because nothing in this change emits a resolution for them; they are cleared manually, and the two known ones already were.

Behaviour changes worth knowing

  • A report= pointer under data/remote-secondmates/... is fetched like any other structured offer, so a nested remote second mate's report that this mate genuinely holds is relayed again. A foreign pointer this mate does not hold fails open harmlessly.
  • A new private per-secondmate record, state/.remote-reply-mirrored-<id>, holds the exact source lines already mirrored. It deliberately survives adapter retirement, because the parent status stream it describes survives retirement too.

Follow-ups (out of scope)

  • fm-remote-doc-legacy-reconcile-r1: optional automatic reconciliation of remote-reply-document-<id> blocks written by the previous release.
  • bin/fm-remote-file.sh: return distinct exit statuses for a permanent refusal (outside the confinement, oversize) versus a document not retrievable right now (absent, replaced mid-read, short read); today both share exit 1.
  • Revisit the 256 KiB document bound (FM_REMOTE_REPLY_MAX_DOC_BYTES) against real report sizes; the remote job worker already tolerates 1 MiB.
  • Pending-reply via=document gap: a correlated reply carrying a pointer is recorded as answered by a document even when that document did not transfer.

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 2 issues found → auto-fixed ✅
  • 🚨 bin/fm-procevent-remote-reply.sh:510 - Exact-byte deduplication remains dependent on document availability. If an offered document is initially missing, the source line is appended with its remote pointer; if receipt/cursor commit then fails and the document appears before retry, the same captured result is rewritten with a local pointer and appended again. A cursor-loss recapture produces the same duplication. This exceeds the authorized limitation of one-time duplicates for legacy bare-path lines and can duplicate or re-open a current structured status/decision line. Preventing this while honoring the explicit requirement to drop canonical identity requires the user's choice of replay identity semantics.
  • ⚠️ bin/fm-procevent-remote-reply.sh:514 - The unkeyed undeliverable-document note, including stderr capture and reason summarization, is explicitly optional and is not required for the measured-sufficient fail-open behavior. Remove this optional reporting path to keep the implementation to the required scope.

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 6 of 6 scenarios driven live against the product
Scenario Result Live Evidence
A mate mentions an existing data/*.md path in prose, and the parent mirrors it unchanged without fetching or opening a document decision ✅ pass live Remote-reply end-to-end product transcript: “the remote status and decision model mirrors and the cursor advances” and “the reported incident raises no standing decision and still delivers the report”
A mate publishes an explicit report= pointer, and the parent fetches the document byte-for-byte and rewrites the pointer to its local mirror ✅ pass live Remote-reply end-to-end product transcript: “ingest appends one validated line, fetches its document, and advances the cursor” and “the reported incident raises no standing decision and still delivers…
A malformed, glued, or prefix-only report pointer is rejected while adjacent boundary-valid pointers are fetched and rewritten ✅ pass live Remote-reply end-to-end product transcript: boundary scenarios for malformed, adjacent, and glued pointers all report ok
An unavailable or oversized structured document fails open: its line remains visible, no durable decision opens, and the cursor advances ✅ pass live Remote-reply end-to-end product transcript: “an undeliverable structured offer fails open with one note and never a decision” and “a remote refusal surfaces its own reason without opening a decision”
Pointer extraction, local storage, or parent-stream write failure leaves the delta and cursor uncommitted, then the same delta applies after recovery ✅ pass live Remote-reply end-to-end product transcript: extraction failure, mirror-write failure, and local-storage recovery scenarios all report ok
A commit failure or cursor-loss replay after document availability changes does not duplicate or reopen the original structured decision line ✅ pass live Remote-reply end-to-end product transcript: “source-line identity survives commit failure and cursor-loss recapture” and “a cursor-loss whole-log recapture is acknowledged quietly with no duplicate wa…
  • bash tests/fm-remote-reply.test.sh 2>&1 | tee ~/.no-mistakes/evidence/01M2NKVC93RJ4Z47KRXXY3ZDY7/fm-remote-reply-e2e.log
  • git status --short to confirm testing left the worktree clean
✅ **Document** - passed

✅ No issues found.

🔧 **Lint** - 1 issue found → auto-fixed ✅
  • ⚠️ linter found issues (exit code 1)

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ **Push** - passed

✅ No issues found.

…ptable

A remote mate's undelivered document raised a keyed `blocked` decision that
nothing could ever resolve, and any `data/*.md` substring in any mirrored line
was an unconditional fetch instruction. A mate announcing a report it had not
written yet therefore manufactured a permanent, factually false blocker, and
its own explanation of the false alarm manufactured more.

The reader has no permanence vocabulary: a report still being written refuses
exactly like a path that will never exist. So an undelivered document is now a
durable, re-attemptable obligation under `state/remote-replies/<id>.pending-docs`,
re-attempted on the next delta and on the channel's own quiet poll, and retired
with a matching `resolved` line naming the local copy once it arrives. The
cursor still advances and no delta stalls on one bad pointer.

Only a structured `report=data/....md` pointer now offers a document, so a path
merely mentioned in prose - including one under another home's mirror tree,
which is provably not that mate's to serve - is never fetched. Offers are
deduplicated across the whole delta, the escalation names each missing document
once and carries the reader's own reason instead of discarding it, and a
strictly increasing notice ordinal keeps a later escalation from being
swallowed as duplicate bytes. A mirrored line still lands once whichever
pointer form it was first written under.
Two defects in the boundary-safe pointer work.

The at-most-once check compared only the all-remote and all-local renderings
of a line, so it could not recognize a mixed one. A line offering two documents
where only the first was deliverable mirrored as local-plus-remote; once the
second arrived, a cursor-loss whole-log recapture rendered the same line
all-local, matched neither alternate, and mirrored a second time. A line's
identity is now the canonical form every boundary-valid pointer would take once
delivered, derived by the same parser that does extraction and rewriting, so it
no longer depends on which documents happened to be deliverable at the time.

The pointer map was passed to awk through the process environment. A delta may
carry up to the configured 1 MiB bound, and an expanded map of delivered
pointers can exceed the platform's exec argument limit, so awk would fail to
start; because no caller checked, the empty result would have been appended as
blank lines while the cursor advanced past dropped status content. The map now
travels in a file, and every call site checks the exit status and stops the
ingest rather than committing a delta it could not render.

Both passes now run once per stream instead of twice per line.
…acking it

Narrow the remote-reply document fix to the scope the diagnosis actually
requires, as decided after measuring a simpler alternative.

A document the reader cannot deliver now fails open. The mate's line is
mirrored with its own pointer, the cursor advances, and one unkeyed note
carries the reader's reason. A note never enters the open-decision fold, so it
cannot stand open the way the original keyed block did - which removes the
never-clearing false blocker by construction rather than by resolving it.

That makes the durable self-clearing obligation unnecessary, so it goes: the
per-mate pending-documents record, its notice ordinal and resolved
announcements, and the poll-side retry. Canonical line identity goes too, and
with it a way to silently drop a genuine status line; mirroring is back to
at-most-once on exact bytes. The cross-home exclusion goes as well: under
fail-open a cross-home report= either fails harmlessly or is a nested remote
report this mate genuinely holds, which is now relayed again.

Kept: fetching only on a structured report= pointer, the boundary-correct
parser, the file-based rewrite map, and checked extraction and rewrite exit
status. The parser now scans behind a sentinel byte so a rejected candidate can
no longer give the text right after it a false leading boundary.

The reported incident is covered end to end: a report path announced in prose
before it exists raises no decision, and the report still arrives through the
ledger publisher's structured offer once written.
@kunchenguid
kunchenguid merged commit 36c9814 into main Sep 16, 2026
15 checks passed
@kunchenguid
kunchenguid deleted the fm/fm-remote-doc-transfer-fix-r1 branch September 16, 2026 18:29
mdc2122 added a commit to mdc2122/firstmate that referenced this pull request Sep 17, 2026
* fix(bin): report verified PR state for passed runs (kunchenguid#4624)

* fix(bin): derive passed PR state from PR record

A completed no-mistakes run with outcome=passed does not prove the associated pull request merged or closed. A parked gate can be approved on other evidence, so the old crew-state label could report an open PR as merged and make teardown look safe when unlanded work still exists.

For passed runs, derive the crew-state detail from the run or task PR identity, accept a matching merge-poll retirement receipt as local merged evidence, and otherwise perform a bounded forge read. If the identity is absent or unreadable, report the run as passed with unknown PR state instead of inventing a merged claim.

Fixes kunchenguid#4607

* no-mistakes(review): Add bounded GitLab merge-request state reads

* no-mistakes(review): Preserve network-free inactive crew-state scans

* no-mistakes(document): Document PR record readers in shared library

* fix: restore published contribution follow-up (Fixes kunchenguid#4469) (kunchenguid#4627)

* fix: restore published contribution follow-up (Fixes kunchenguid#4469)

* fix(review): Fix contribution freshness and merge actor routing

* fix(review): Restore issue triage and scope contribution follow-up

* fix(test): test: assert one wake per contribution signal

* fix(document): Document contribution follow-up

* fix: restore truthful terminal delivery evidence

* fix(review): Disclose unsupported contributions and deduplicate watcher wakes

* fix(review): Preserve unmeasured unsupported contributions across Bearings

* fix(review): Deduplicate shared contribution wakes and isolate diagnostics

* fix(ci): Captain, fixed the CI failure by updating the PR-security fake GitHub interface to support the contribution observer’s API reads. Verified with shellcheck, git diff --check, the full contribution suite, and a focused merged-poll retirement reproduction. The full PR-security script was not allowed to complete locally after its expanded observer path made it substantially slower

* fix(bin): make remote report transfers explicit and fail-open (kunchenguid#4658)

* fix(bin): make a remote-reply document gap self-clearing and re-attemptable

A remote mate's undelivered document raised a keyed `blocked` decision that
nothing could ever resolve, and any `data/*.md` substring in any mirrored line
was an unconditional fetch instruction. A mate announcing a report it had not
written yet therefore manufactured a permanent, factually false blocker, and
its own explanation of the false alarm manufactured more.

The reader has no permanence vocabulary: a report still being written refuses
exactly like a path that will never exist. So an undelivered document is now a
durable, re-attemptable obligation under `state/remote-replies/<id>.pending-docs`,
re-attempted on the next delta and on the channel's own quiet poll, and retired
with a matching `resolved` line naming the local copy once it arrives. The
cursor still advances and no delta stalls on one bad pointer.

Only a structured `report=data/....md` pointer now offers a document, so a path
merely mentioned in prose - including one under another home's mirror tree,
which is provably not that mate's to serve - is never fetched. Offers are
deduplicated across the whole delta, the escalation names each missing document
once and carries the reader's own reason instead of discarding it, and a
strictly increasing notice ordinal keeps a later escalation from being
swallowed as duplicate bytes. A mirrored line still lands once whichever
pointer form it was first written under.

* no-mistakes(review): Require structured pointer token boundaries

* no-mistakes(review): Unify boundary-safe pointer extraction and rewriting

* fix(bin): identify a mirrored line independently of its delivery state

Two defects in the boundary-safe pointer work.

The at-most-once check compared only the all-remote and all-local renderings
of a line, so it could not recognize a mixed one. A line offering two documents
where only the first was deliverable mirrored as local-plus-remote; once the
second arrived, a cursor-loss whole-log recapture rendered the same line
all-local, matched neither alternate, and mirrored a second time. A line's
identity is now the canonical form every boundary-valid pointer would take once
delivered, derived by the same parser that does extraction and rewriting, so it
no longer depends on which documents happened to be deliverable at the time.

The pointer map was passed to awk through the process environment. A delta may
carry up to the configured 1 MiB bound, and an expanded map of delivered
pointers can exceed the platform's exec argument limit, so awk would fail to
start; because no caller checked, the empty result would have been appended as
blank lines while the cursor advanced past dropped status content. The map now
travels in a file, and every call site checks the exit status and stops the
ingest rather than committing a delta it could not render.

Both passes now run once per stream instead of twice per line.

* no-mistakes(review): Abort ingest when document pointer extraction fails

* no-mistakes(review): Exclude structured cross-home pointers from document transfer

* fix(bin): fail open on an undeliverable remote document instead of tracking it

Narrow the remote-reply document fix to the scope the diagnosis actually
requires, as decided after measuring a simpler alternative.

A document the reader cannot deliver now fails open. The mate's line is
mirrored with its own pointer, the cursor advances, and one unkeyed note
carries the reader's reason. A note never enters the open-decision fold, so it
cannot stand open the way the original keyed block did - which removes the
never-clearing false blocker by construction rather than by resolving it.

That makes the durable self-clearing obligation unnecessary, so it goes: the
per-mate pending-documents record, its notice ordinal and resolved
announcements, and the poll-side retry. Canonical line identity goes too, and
with it a way to silently drop a genuine status line; mirroring is back to
at-most-once on exact bytes. The cross-home exclusion goes as well: under
fail-open a cross-home report= either fails harmlessly or is a nested remote
report this mate genuinely holds, which is now relayed again.

Kept: fetching only on a structured report= pointer, the boundary-correct
parser, the file-based rewrite map, and checked extraction and rewrite exit
status. The parser now scans behind a sentinel byte so a rejected candidate can
no longer give the text right after it a false leading boundary.

The reported incident is covered end to end: a report path announced in prose
before it exists raises no decision, and the report still arrives through the
ledger publisher's structured offer once written.

* no-mistakes(review): Preserve source-line identity across remote reply replays

* no-mistakes(document): Document remote reply transfer and replay semantics

* no-mistakes(lint): Fix staging truncation lint checks

* fix(calm): preserve substantive mid-turn responses (kunchenguid#4655)

* Preserve substantive Calm mid-turn text

* no-mistakes(review): Distinguish newline-preserved replies from short narration

* no-mistakes(document): Document Calm mid-turn preservation boundaries

* no-mistakes(ci): Fixed the flaky contribution watcher test by increasing its bounded checkpoint from 5 to 15 seconds, allowing diagnostics to surface under slower CI load. Verified with `bash tests/fm-contributions.test.sh` and `git diff --check`

* feat(bin): merge a still-open green PR from its armed poll under yolo=on

When a task's merge poll finds the PR still open and the task meta records
yolo=on, the watcher now invokes bin/fm-pr-merge.sh itself instead of only
reporting the still-open PR and waiting for a firstmate turn. The merge
path's own live verification remains the only green check: a red,
unmergeable, or unverifiable PR is refused there and the poll stays armed.
A confirmed landing is recognized by the merge-notified marker the merge
path commits with its durable outcome, so a queued or unconfirmed
acceptance keeps polling and the landed wake is emitted exactly once.

The task's recorded yolo posture now resolves as standing merge authority
ahead of the away-posture record, which is consulted only for a task
without it.

* no-mistakes(review): bound the yolo merge attempt and identity-check its refreshed poll snapshot

* no-mistakes(test): Bound watcher tests by terminating descendant process groups

---------

Co-authored-by: Joseph Kim <[email protected]>
Co-authored-by: Mickaël Rémond <[email protected]>
Co-authored-by: Kun Chen <[email protected]>
Co-authored-by: mdc2122 <[email protected]>
rega10 added a commit to rega10/firstmate that referenced this pull request Sep 17, 2026
* fix(bin): report verified PR state for passed runs (kunchenguid#4624)

* fix(bin): derive passed PR state from PR record

A completed no-mistakes run with outcome=passed does not prove the associated pull request merged or closed. A parked gate can be approved on other evidence, so the old crew-state label could report an open PR as merged and make teardown look safe when unlanded work still exists.

For passed runs, derive the crew-state detail from the run or task PR identity, accept a matching merge-poll retirement receipt as local merged evidence, and otherwise perform a bounded forge read. If the identity is absent or unreadable, report the run as passed with unknown PR state instead of inventing a merged claim.

Fixes kunchenguid#4607

* no-mistakes(review): Add bounded GitLab merge-request state reads

* no-mistakes(review): Preserve network-free inactive crew-state scans

* no-mistakes(document): Document PR record readers in shared library

* fix: restore published contribution follow-up (Fixes kunchenguid#4469) (kunchenguid#4627)

* fix: restore published contribution follow-up (Fixes kunchenguid#4469)

* fix(review): Fix contribution freshness and merge actor routing

* fix(review): Restore issue triage and scope contribution follow-up

* fix(test): test: assert one wake per contribution signal

* fix(document): Document contribution follow-up

* fix: restore truthful terminal delivery evidence

* fix(review): Disclose unsupported contributions and deduplicate watcher wakes

* fix(review): Preserve unmeasured unsupported contributions across Bearings

* fix(review): Deduplicate shared contribution wakes and isolate diagnostics

* fix(ci): Captain, fixed the CI failure by updating the PR-security fake GitHub interface to support the contribution observer’s API reads. Verified with shellcheck, git diff --check, the full contribution suite, and a focused merged-poll retirement reproduction. The full PR-security script was not allowed to complete locally after its expanded observer path made it substantially slower

* fix(bin): make remote report transfers explicit and fail-open (kunchenguid#4658)

* fix(bin): make a remote-reply document gap self-clearing and re-attemptable

A remote mate's undelivered document raised a keyed `blocked` decision that
nothing could ever resolve, and any `data/*.md` substring in any mirrored line
was an unconditional fetch instruction. A mate announcing a report it had not
written yet therefore manufactured a permanent, factually false blocker, and
its own explanation of the false alarm manufactured more.

The reader has no permanence vocabulary: a report still being written refuses
exactly like a path that will never exist. So an undelivered document is now a
durable, re-attemptable obligation under `state/remote-replies/<id>.pending-docs`,
re-attempted on the next delta and on the channel's own quiet poll, and retired
with a matching `resolved` line naming the local copy once it arrives. The
cursor still advances and no delta stalls on one bad pointer.

Only a structured `report=data/....md` pointer now offers a document, so a path
merely mentioned in prose - including one under another home's mirror tree,
which is provably not that mate's to serve - is never fetched. Offers are
deduplicated across the whole delta, the escalation names each missing document
once and carries the reader's own reason instead of discarding it, and a
strictly increasing notice ordinal keeps a later escalation from being
swallowed as duplicate bytes. A mirrored line still lands once whichever
pointer form it was first written under.

* no-mistakes(review): Require structured pointer token boundaries

* no-mistakes(review): Unify boundary-safe pointer extraction and rewriting

* fix(bin): identify a mirrored line independently of its delivery state

Two defects in the boundary-safe pointer work.

The at-most-once check compared only the all-remote and all-local renderings
of a line, so it could not recognize a mixed one. A line offering two documents
where only the first was deliverable mirrored as local-plus-remote; once the
second arrived, a cursor-loss whole-log recapture rendered the same line
all-local, matched neither alternate, and mirrored a second time. A line's
identity is now the canonical form every boundary-valid pointer would take once
delivered, derived by the same parser that does extraction and rewriting, so it
no longer depends on which documents happened to be deliverable at the time.

The pointer map was passed to awk through the process environment. A delta may
carry up to the configured 1 MiB bound, and an expanded map of delivered
pointers can exceed the platform's exec argument limit, so awk would fail to
start; because no caller checked, the empty result would have been appended as
blank lines while the cursor advanced past dropped status content. The map now
travels in a file, and every call site checks the exit status and stops the
ingest rather than committing a delta it could not render.

Both passes now run once per stream instead of twice per line.

* no-mistakes(review): Abort ingest when document pointer extraction fails

* no-mistakes(review): Exclude structured cross-home pointers from document transfer

* fix(bin): fail open on an undeliverable remote document instead of tracking it

Narrow the remote-reply document fix to the scope the diagnosis actually
requires, as decided after measuring a simpler alternative.

A document the reader cannot deliver now fails open. The mate's line is
mirrored with its own pointer, the cursor advances, and one unkeyed note
carries the reader's reason. A note never enters the open-decision fold, so it
cannot stand open the way the original keyed block did - which removes the
never-clearing false blocker by construction rather than by resolving it.

That makes the durable self-clearing obligation unnecessary, so it goes: the
per-mate pending-documents record, its notice ordinal and resolved
announcements, and the poll-side retry. Canonical line identity goes too, and
with it a way to silently drop a genuine status line; mirroring is back to
at-most-once on exact bytes. The cross-home exclusion goes as well: under
fail-open a cross-home report= either fails harmlessly or is a nested remote
report this mate genuinely holds, which is now relayed again.

Kept: fetching only on a structured report= pointer, the boundary-correct
parser, the file-based rewrite map, and checked extraction and rewrite exit
status. The parser now scans behind a sentinel byte so a rejected candidate can
no longer give the text right after it a false leading boundary.

The reported incident is covered end to end: a report path announced in prose
before it exists raises no decision, and the report still arrives through the
ledger publisher's structured offer once written.

* no-mistakes(review): Preserve source-line identity across remote reply replays

* no-mistakes(document): Document remote reply transfer and replay semantics

* no-mistakes(lint): Fix staging truncation lint checks

* fix(calm): preserve substantive mid-turn responses (kunchenguid#4655)

* Preserve substantive Calm mid-turn text

* no-mistakes(review): Distinguish newline-preserved replies from short narration

* no-mistakes(document): Document Calm mid-turn preservation boundaries

* no-mistakes(ci): Fixed the flaky contribution watcher test by increasing its bounded checkpoint from 5 to 15 seconds, allowing diagnostics to surface under slower CI load. Verified with `bash tests/fm-contributions.test.sh` and `git diff --check`

* fix(bin): preserve PR merge polls across volume remounts (kunchenguid#4656)

* fix(bin): re-record PR poll identity after a volume device renumber (Fixes kunchenguid#4260)

A volume remount can renumber the state filesystem's st_dev while every
inode and byte stays the same; APFS does this across a reboot. A poll
registration records its sidecar and check as device:inode, so every poll
armed before the remount failed strict validation and the watcher refused
all of them as unauthenticated state checks until each was re-armed by hand.

There are two device comparisons. fm_pr_private_file_valid compares a live
file's device with the state directory's device read in the same invocation:
it refuses a file that is not on the state directory's own filesystem and
already survives a renumber, so it is unchanged. The registration's recorded
identity versus the live identity (from kunchenguid#556, reused by the kunchenguid#932 retirement
receipt) binds the registration to the exact files published in its own
transaction; its device part is what breaks.

When strict capture fails, the watcher now proves the device is the only
difference: every other artifact check passes (template bytes, both hashes,
private mode, single link, live device, metadata), both recorded identities
name one device, and each recorded inode equals its live inode. Only then,
under the task's control lock, does it rewrite the two identity lines,
repeating the whole proof and comparing the registration's file identity and
bytes just before the rename, and then capture strictly again. A swapped,
altered, re-moded, relinked, split-device, or foreign-device artifact still
fails a proof and is still refused, and a pending retirement receipt blocks
the rewrite.

Reproduction: on macOS a poll armed on an APFS disk image that was detached
and re-attached behind another image moved st_dev 16777239 -> 16777243 with
inodes, bytes, mode, and link count unchanged; the real watcher refused it on
main and reports its merge with this change. The portable regression test
rewrites a real registration's recorded device and drives the watcher.

Not changed here: the status presentation cursor keys rows by its own
device:inode identity in bin/fm-classify-lib.sh, a different helper that
needs its own fix; a retirement receipt left by a reboot between its
publication and removal still names the old device and stays refused; custom
check trust binds only a content hash and is unaffected.

* fix(review): Serialize PR poll publication writers

* fix(review): Bound PR poll publication lock scope

* fix(bin): keep contribution records when the poll budget runs out (follow-up to kunchenguid#4627) (kunchenguid#4661)

A budget that expires partway through an observation no longer records an
error or prints the unavailable wake; the URL keeps its prior record and is
observed first next poll. forge() flags budget exhaustion at the point it
refuses, or when a read is killed at the budget's own deadline, so a genuine
forge failure still records the error and wakes. Each distinct URL is now
observed once per poll and applied to every owning task.

* fix(bin): clear parent pending-replies on local secondmate retirement (kunchenguid#4680)

* fix(bin): clear parent pending-replies on local secondmate retirement

Local secondmate teardown left resolved parent pending-reply records behind
after home removal (seen after papa-hdds / pxmx retirement). Refuse non-forced
retirement while any reply for that id is still unresolved, and delete every
matching record plus its delivery confirmation after a successful local or
remote retirement, matching the remote cleanup path.

* no-mistakes(document): Align secondmate retirement docs with pending-reply cleanup

* no-mistakes(review): Lokale Pending-replies-Sicherheitsprüfung vor Home-Entfernung

* no-mistakes(review): Pending-replies-corr_id auf 16-Hex absichern

* no-mistakes(review): Pending-replies Basename und corr_id abgleichen

* no-mistakes(document): Clarify forced retirement pending-reply cleanup

---------

Co-authored-by: ladwein <[email protected]>

* fix(bin): accept Orca's composite worktree id when tearing down a task (kunchenguid#4677)

* fix(bin): accept Orca's composite worktree id at teardown

Teardown refused every Orca-backed task because the endpoint validator
checked orca_worktree_id with the simple-atom rule meant for tmux-style
window names, which rejects any character outside [A-Za-z0-9._@%+-]. Orca
returns that id as `<orca id>::<absolute worktree path>`, so the colon and
slashes in every real value made validation fail and finished Orca tasks
could never be cleaned up.

Validate the field as the composite it is: both halves of the first `::`
split present, the path half absolute, and no embedded newline, carriage
return, or tab. The terminal field keeps the atom check, which is correct
for it, and no other backend's validation changes.

The existing Orca fixtures recorded ids like `wt-teardown`, a shape Orca
never returns, which is why the suite passed a check the real value fails.
They now carry the composite form, so the tests exercise the real value.

* no-mistakes(document): name Orca's repo id in the composite worktree id

* no-mistakes(document): list teardown endpoint safety suite in Orca regression entry points

* feat(bin): add opt-in typed dispatch resolution (kunchenguid#4692)

* feat(bin): add opt-in typed dispatch resolution through typesafe.ai

Add bin/fm-dispatch-resolve.sh, which resolves one concrete crewmate or
scout profile from a written brief with typesafe.ai's System One model:
one Choice question over the rules' `when` texts, then the confidence
floor, the rule's `approval` and `floor`, each profile's `provider` and
`floor`, one quota-axi snapshot, and the spendPriority argmax all in code.
It is off unless TYPESAFE_API_KEY is in the environment or the home's
gitignored .env; off means one stderr line, exit 0, and no network call,
so firstmate dispatches exactly as before. The key reaches curl on a file
descriptor, never argv.

Extract fmx_env_get into bin/fm-env-lib.sh as the one .env accessor and
the harness-to-provider table into bin/fm-quota-axi-lib.sh so the new
tool and bin/fm-quota-choose.sh share one owner each. Bootstrap validates
the four new optional dispatch fields. Document the schema, the operator
contract, the AGENTS.md intake step, and the live and benchmark evidence.

* no-mistakes(review): Harden typed dispatch resolution and quota bounds

* no-mistakes(review): Validate dispatch floors and ranking evidence

* no-mistakes(review): Tighten dispatch response and floor evidence

* no-mistakes(review): Neutralize none matching and resolve defaults locally

* no-mistakes(review): Preserve providerless profiles outside typed resolution

* no-mistakes(review): Validate response usage and reject duplicate profiles

* no-mistakes(review): Escalate unverifiable floors and validate probabilities

* no-mistakes(review): Validate probability mass and unknown profile floors

* no-mistakes(review): Simplify resolver interface and preserve fallback routing

* no-mistakes(review): Fix constants and rank partial quota evidence

* no-mistakes(review): Add authoritative provider mapping and enforce explicit providers

* no-mistakes(review): Declare provider for documented Pi profile

* no-mistakes(review): Validate provider identifiers and support Gemini dispatch

* no-mistakes(review): Strictly anchor provider identifiers

* no-mistakes(review): Validate selectors and preserve fallback candidate evidence

* no-mistakes(review): Gate typed validation and harden resolver evidence

* no-mistakes(review): Preserve opt-in routing and harden candidate evidence

* no-mistakes(review): Prioritize known exhaustion over quota uncertainty

* no-mistakes(review): Isolate API secrets and preserve no-key diagnostics

* no-mistakes(review): Fallback safely when dispatch rules are absent

* no-mistakes(review): Prioritize quota vetoes and isolate bootstrap secrets

* no-mistakes(document): Document typed dispatch safety and fallback behavior

* fix(bin): read the latest status event so buried declarations and open decisions aren't lost (kunchenguid#3753)

* test: reproduce buried status declarations in shared readers

* fix: share status event reads and preserve open blockers

* fix: retain terminal scout and ship status declarations

* no-mistakes(review): Fix status chronology, legacy completions, and reader performance

* no-mistakes(review): Share terminal decision reconciliation across fleet snapshots

* no-mistakes(review): Unify terminal supersession across cached folds and consumers

* no-mistakes(review): Filter per-key status history while preserving terminal chronology

* no-mistakes(test): Preserve parent lock ownership in Bash 3.2 subshells

* no-mistakes(review): Anchor legacy status tokens so prose cannot hide pauses

* no-mistakes(document): Document latest-event status read and kind-scoped fold cursor

* no-mistakes(lint): Quote literal done in test for-lists for SC1010

* ci: expect 19 snapshot/fleet-view tests

This branch adds a fleet-snapshot regression, so the stock macOS Bash
lane's hardcoded guard of 18 'ok - ' lines fails on the new count.
Bump the guard and its message to 19.

* no-mistakes(review): Restore multiline child outcome reporting

* no-mistakes(review): Select ledger terminal events through bounded shared reader

* no-mistakes(review): Report newest open decision instead of preferring blocked

* no-mistakes(review): Require colon before ship/scout terminal supersession in fold

* no-mistakes(review): Gate socket-down override on latest event; drop lock matrix

* no-mistakes(review): Fold only colon-bearing or keyed lines as decision transitions

* no-mistakes(review): Pre-select candidate lines before per-key closing-verb fold

* no-mistakes(test): Update fleet-view expectations to newest-open-decision rule

* no-mistakes(document): Align status-read docs with fold-resolved crew state

* no-mistakes(document): Correct status-reader contracts in classify-lib and crew-state headers

* no-mistakes(ci): Greptile P1 (bin/fm-crew-state.sh:729, "Stale socket blocker survives") was a real defect introduced by commit b7c2183 on this branch, and is fixed. Root cause: the daemon-socket-down override took its verb check from `last_status_line "$LOG"` but its evidence and emitted detail from `$LOG_LINE` (status_current_line = the fold's newest still-open decision). Those are different lines whenever a later recognized `blocked:` event is one the decision fold declines. Reproduced by sourcing bin/fm-classify-lib.sh on `blocked: no-mistakes daemon socket is missing` followed by `blocked [key=pending-reply-t3]: still waiting on the answer` (reserved-namespace key whose note does not speak that vocabulary, so _fm_decision_key_transition_allowed rejects it): open set still holds the socket blocker, last_status_line returns the newer line, its verb is blocked, so the gate passed and the stale daemon-down evidence overrode a healthy attributed run. Fix (bin/fm-crew-state.sh): capture LOG_LATEST=$(last_status_line "$LOG") once and read verb, socket-down evidence, and the emitted note all off that same line, so the override fires only while the socket-down declaration is itself the log's latest recognized event — preserving the narrow override the prior round's user instruction asked for. Comment updated to state that contract. No new machinery; the two-line conflation was removed rather than papered over. Regression: extended tests/fm-crew-state.test.sh:test_socket_refusal_override_expires_when_the_crew_moves_on with the reproduced sequence, asserting the run-step reading (state: working, source: run-step) and absence of the override detail. It fails before the fix ("not ok - a later unfolded blocked event also hands the reading back to the run (missing: 'state: working')") and passes after. Verified locally: tests/fm-crew-state.test.sh, tests/fm-fleet-snapshot-view.test.sh, tests/fm-classify-decision-key.test.sh, tests/fm-watch-triage.test.sh, tests/fm-captain-hold-lifecycle.test.sh all pass; bin/fm-lint.sh (shellcheck 0.11.0 + actionlint) exits 0. Changes left uncommitted in the worktree

* test: fold terminal-cleanup snapshot coverage into the completed-scout case

Keep the ship/scout/secondmate supersession assertions without adding a
nineteenth top-level fleet-view test, so CI can stay at the upstream suite count.

* no-mistakes(document): Clarify socket-down override expiry in architecture doc

* ci: retrigger flaky contribution check

* fix(bin): launch codex crewmates with codex's hook layer disabled (kunchenguid#4689)

* fix(spawn): launch codex crewmates with codex's hook layer disabled

A freshly launched Codex worker never reached its instructions. Codex
stopped it on an interactive "Hooks need review" modal whose selection
sits on "Review hooks", which is neither trusting nor declining.
Firstmate's key plane carries only Enter, Escape and Ctrl-C with no arrow
navigation, so the selection cannot be moved, and pre-accepting the
prompt by writing Codex's own trust store would record an operator
consent that was never given.

The hooks are the machine's own ~/.codex/hooks.json plus any project's
.codex/hooks.json. A crewmate needs neither: its turn-end signal is the
-c notify= program on the same launch, and Firstmate's project hooks are
primary-session infrastructure that stands down in a child worktree.

Crewmate and scout launches now pass --disable hooks. That is the
opposite of --dangerously-bypass-hook-trust, which RUNS the untrusted
hooks; disabling the feature runs none of them and leaves the operator's
~/.codex untouched. An unknown feature name is a hard Codex error, so a
release that drops the flag fails the launch loudly instead of silently
restoring the modal. A secondmate is a primary in its own home and keeps
the project hooks its turn-end guard and session-start digest ride on.

Verified on codex-cli 0.151.0: the modal is gone and the turn-end
notification still lands.

This unblocks the second review that every finished pull request is supposed to get.

Fixes kunchenguid#4673

* no-mistakes(review): Fix contradictory hook count in Codex verification record

* no-mistakes(document): Clarify typed dispatch gate ownership

---------

Co-authored-by: Joseph Kim <[email protected]>
Co-authored-by: Mickaël Rémond <[email protected]>
Co-authored-by: Kun Chen <[email protected]>
Co-authored-by: Sebastian <[email protected]>
Co-authored-by: ladwein <[email protected]>
Co-authored-by: Juan José González Giraldo <[email protected]>
Co-authored-by: Tiago <[email protected]>
Co-authored-by: Cody <[email protected]>
Co-authored-by: Rene Garza Jr. <[email protected]>
mdc2122 added a commit to mdc2122/firstmate that referenced this pull request Sep 17, 2026
* fix(bin): report verified PR state for passed runs (kunchenguid#4624)

* fix(bin): derive passed PR state from PR record

A completed no-mistakes run with outcome=passed does not prove the associated pull request merged or closed. A parked gate can be approved on other evidence, so the old crew-state label could report an open PR as merged and make teardown look safe when unlanded work still exists.

For passed runs, derive the crew-state detail from the run or task PR identity, accept a matching merge-poll retirement receipt as local merged evidence, and otherwise perform a bounded forge read. If the identity is absent or unreadable, report the run as passed with unknown PR state instead of inventing a merged claim.

Fixes kunchenguid#4607

* no-mistakes(review): Add bounded GitLab merge-request state reads

* no-mistakes(review): Preserve network-free inactive crew-state scans

* no-mistakes(document): Document PR record readers in shared library

* fix: restore published contribution follow-up (Fixes kunchenguid#4469) (kunchenguid#4627)

* fix: restore published contribution follow-up (Fixes kunchenguid#4469)

* fix(review): Fix contribution freshness and merge actor routing

* fix(review): Restore issue triage and scope contribution follow-up

* fix(test): test: assert one wake per contribution signal

* fix(document): Document contribution follow-up

* fix: restore truthful terminal delivery evidence

* fix(review): Disclose unsupported contributions and deduplicate watcher wakes

* fix(review): Preserve unmeasured unsupported contributions across Bearings

* fix(review): Deduplicate shared contribution wakes and isolate diagnostics

* fix(ci): Captain, fixed the CI failure by updating the PR-security fake GitHub interface to support the contribution observer’s API reads. Verified with shellcheck, git diff --check, the full contribution suite, and a focused merged-poll retirement reproduction. The full PR-security script was not allowed to complete locally after its expanded observer path made it substantially slower

* fix(bin): make remote report transfers explicit and fail-open (kunchenguid#4658)

* fix(bin): make a remote-reply document gap self-clearing and re-attemptable

A remote mate's undelivered document raised a keyed `blocked` decision that
nothing could ever resolve, and any `data/*.md` substring in any mirrored line
was an unconditional fetch instruction. A mate announcing a report it had not
written yet therefore manufactured a permanent, factually false blocker, and
its own explanation of the false alarm manufactured more.

The reader has no permanence vocabulary: a report still being written refuses
exactly like a path that will never exist. So an undelivered document is now a
durable, re-attemptable obligation under `state/remote-replies/<id>.pending-docs`,
re-attempted on the next delta and on the channel's own quiet poll, and retired
with a matching `resolved` line naming the local copy once it arrives. The
cursor still advances and no delta stalls on one bad pointer.

Only a structured `report=data/....md` pointer now offers a document, so a path
merely mentioned in prose - including one under another home's mirror tree,
which is provably not that mate's to serve - is never fetched. Offers are
deduplicated across the whole delta, the escalation names each missing document
once and carries the reader's own reason instead of discarding it, and a
strictly increasing notice ordinal keeps a later escalation from being
swallowed as duplicate bytes. A mirrored line still lands once whichever
pointer form it was first written under.

* no-mistakes(review): Require structured pointer token boundaries

* no-mistakes(review): Unify boundary-safe pointer extraction and rewriting

* fix(bin): identify a mirrored line independently of its delivery state

Two defects in the boundary-safe pointer work.

The at-most-once check compared only the all-remote and all-local renderings
of a line, so it could not recognize a mixed one. A line offering two documents
where only the first was deliverable mirrored as local-plus-remote; once the
second arrived, a cursor-loss whole-log recapture rendered the same line
all-local, matched neither alternate, and mirrored a second time. A line's
identity is now the canonical form every boundary-valid pointer would take once
delivered, derived by the same parser that does extraction and rewriting, so it
no longer depends on which documents happened to be deliverable at the time.

The pointer map was passed to awk through the process environment. A delta may
carry up to the configured 1 MiB bound, and an expanded map of delivered
pointers can exceed the platform's exec argument limit, so awk would fail to
start; because no caller checked, the empty result would have been appended as
blank lines while the cursor advanced past dropped status content. The map now
travels in a file, and every call site checks the exit status and stops the
ingest rather than committing a delta it could not render.

Both passes now run once per stream instead of twice per line.

* no-mistakes(review): Abort ingest when document pointer extraction fails

* no-mistakes(review): Exclude structured cross-home pointers from document transfer

* fix(bin): fail open on an undeliverable remote document instead of tracking it

Narrow the remote-reply document fix to the scope the diagnosis actually
requires, as decided after measuring a simpler alternative.

A document the reader cannot deliver now fails open. The mate's line is
mirrored with its own pointer, the cursor advances, and one unkeyed note
carries the reader's reason. A note never enters the open-decision fold, so it
cannot stand open the way the original keyed block did - which removes the
never-clearing false blocker by construction rather than by resolving it.

That makes the durable self-clearing obligation unnecessary, so it goes: the
per-mate pending-documents record, its notice ordinal and resolved
announcements, and the poll-side retry. Canonical line identity goes too, and
with it a way to silently drop a genuine status line; mirroring is back to
at-most-once on exact bytes. The cross-home exclusion goes as well: under
fail-open a cross-home report= either fails harmlessly or is a nested remote
report this mate genuinely holds, which is now relayed again.

Kept: fetching only on a structured report= pointer, the boundary-correct
parser, the file-based rewrite map, and checked extraction and rewrite exit
status. The parser now scans behind a sentinel byte so a rejected candidate can
no longer give the text right after it a false leading boundary.

The reported incident is covered end to end: a report path announced in prose
before it exists raises no decision, and the report still arrives through the
ledger publisher's structured offer once written.

* no-mistakes(review): Preserve source-line identity across remote reply replays

* no-mistakes(document): Document remote reply transfer and replay semantics

* no-mistakes(lint): Fix staging truncation lint checks

* fix(calm): preserve substantive mid-turn responses (kunchenguid#4655)

* Preserve substantive Calm mid-turn text

* no-mistakes(review): Distinguish newline-preserved replies from short narration

* no-mistakes(document): Document Calm mid-turn preservation boundaries

* no-mistakes(ci): Fixed the flaky contribution watcher test by increasing its bounded checkpoint from 5 to 15 seconds, allowing diagnostics to surface under slower CI load. Verified with `bash tests/fm-contributions.test.sh` and `git diff --check`

* feat(bin): merge a still-open green PR from its armed poll under yolo=on

When a task's merge poll finds the PR still open and the task meta records
yolo=on, the watcher now invokes bin/fm-pr-merge.sh itself instead of only
reporting the still-open PR and waiting for a firstmate turn. The merge
path's own live verification remains the only green check: a red,
unmergeable, or unverifiable PR is refused there and the poll stays armed.
A confirmed landing is recognized by the merge-notified marker the merge
path commits with its durable outcome, so a queued or unconfirmed
acceptance keeps polling and the landed wake is emitted exactly once.

The task's recorded yolo posture now resolves as standing merge authority
ahead of the away-posture record, which is consulted only for a task
without it.

* no-mistakes(review): bound the yolo merge attempt and identity-check its refreshed poll snapshot

* no-mistakes(test): Bound watcher tests by terminating descendant process groups

---------

Co-authored-by: Joseph Kim <[email protected]>
Co-authored-by: Mickaël Rémond <[email protected]>
Co-authored-by: Kun Chen <[email protected]>
Co-authored-by: mdc2122 <[email protected]>