Repository navigation
fix(pi): prevent duplicate captain outcome reports - #3184
Merged
Merged
Conversation
The supervision branch's captain-outcome note told main, unconditionally, that the note "is not your own earlier output" and to relay it now. When main had already reported the same event, that assertion was false and the order turned the correct response - saying nothing new - into a mechanical re-report, so the captain saw one merge reported twice in 16 seconds. Two independent changes, both needed: - The relay instruction is now conditional. It still names itself as a supervision outcome so main cannot mistake it for its own earlier answer (the silent loss that instruction exists to prevent), and it now lets main stay quiet about an outcome it has already given the captain. - The merge case is closed at its source rather than left to that judgment. One merge reaches a home on two independent paths by design - main's own permanently main-owned merge poll, and the branch's task-local status wake - and main's captain-facing text only reaches the branch's mirror at main's turn end, so the branch can escalate before it could possibly see the captain was already told. bin/fm-pr-merge-notified.sh answers that question from bin/fm-pr-lib.sh's canonical merge-notification marker, so the answer holds regardless of mirror timing. A captain outcome naming an already-published merge is delivered as the ordinary rendered note instead of opening a follow-up turn: still appended, still visible, still recorded with the verdict the branch decided, minus the wasted turn. Any error, timeout, or unreadable state relays the outcome. A duplicate announces itself; a lost outcome does not. Regression coverage drives the real delivery path in both directions: a new outcome must still reach the captain in exactly one follow-up turn even beside an unrelated published merge, and an already-published merge must open no second turn while a different PR in the same task still does. The merge path's real producer and this new consumer are exercised end to end in tests/fm-pr-merge.test.sh. Pi-only by construction: the delivery path lives in .pi/extensions, so no other harness loads it, and the new script only reads existing markers.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (4): Last reviewed commit: "no-mistakes(ci): Strengthened the runtim..." | Re-trigger Greptile |
…ope fix The captain reviewed this branch and judged the source-level duplicate suppression overly complicated for the problem it solved, and asked for the change to be reduced to the envelope wording alone. Remove the mergeIntoMain downgrade path, bin/fm-pr-merge-notified.sh, and every test and document that existed only for it. What remains is the conditional captain-outcome instruction: main is told to stay quiet about an outcome it has already reported and to relay anything else, which covers the duplicate without a second mechanism. The silent-loss protection is untouched - the note is still typed, self-describing, and delivered as one invisible follow-up turn - and the behavioral tests still assert that, now requiring both halves of the conditional instruction.
Comment on lines
+145
to
+146
| "If you have already reported this outcome to the captain earlier in this conversation, do not report it again. " + | ||
| "Otherwise relay only this outcome to the captain now, in one short message, in captain outcome language. " + |
There was a problem hiding this comment.
Source deduplication is absent
When main has already reported a merge through its merge poll, mergeIntoMain still opens a follow-up turn for the matching captain verdict and relies only on this instruction for silence, causing the spurious model turn that source-level identity suppression is required to eliminate.
…hat this is intentionally an M1-only, model-facing conditional relay fix—not source-level suppression—addressing Greptile’s mistaken scope expectation without changing runtime behavior. Net diff remains 3 files and 27 insertions. Verified with fm-pi-branch-extension tests, fm-lint, doc audience check, and git diff --check; all passed
… captain outcome retains its required self-description and outcome text. Verified with `bash tests/fm-pi-branch-extension.test.sh`, `bin/fm-lint.sh`, `bin/fm-doc-audience-check.sh`, and `git diff --check`; all passed. The outer pipeline can now commit and attest the new head
This was referenced Aug 27, 2026
Closed
Open
2 of 3 tasks
This was referenced Aug 29, 2026
prandelicious
added a commit
to prandelicious/firstmate
that referenced
this pull request
Aug 29, 2026
Intent
Simplify PR #3184 (branch fm/fm-envelope-modify-m1m2-r1) down to M1 ONLY, on the captain's explicit instruction that the previous version of this PR was overly complicated. Judge this branch by its NET DIFF AGAINST MAIN, which is now 3 files and 27 inserted lines.
BACKGROUND. PR #3154 fixed a real silent-loss bug. The supervision branch's captain-facing outcome note is handed to Pi's model as the note's own text, so without self-description main could mistake an incoming supervision outcome for its own earlier answer and re-emit that stale answer while the outcome was silently lost. #3154 fixed that by making the note typed and self-describing. That protection MUST be preserved untouched; this change does not revert it.
THE DEFECT THIS FIXES (M1). The envelope #3154 introduced carried an UNCONDITIONAL order: "it is not your own earlier output" plus "Relay only this outcome to the captain now". That assertion is false whenever main was separately woken for the same event on its own row, because main firstmate and the supervision branch can each be independently notified of one merge. The unconditional order therefore turned the correct response (saying nothing new) into a mechanical re-report, and the captain saw one outcome reported twice.
THE FIX. Make the relay order CONDITIONAL in .pi/extensions/fm-branch-supervision.ts's CAPTAIN_OUTCOME_INSTRUCTION. Keep the self-description ("a supervision outcome delivered automatically by the supervision branch", "not typed by the captain"), then state that if main has already reported this outcome to the captain earlier in this conversation it must NOT report it again, and OTHERWISE relay only this outcome now, in one short message, in captain outcome language, without restating any earlier answer. This deliberate wording change to a natural-language instruction delivered to a model is the entire product change.
DELIBERATE DECISIONS BY THE CAPTAIN - do not flag these as omissions or regressions:
VERIFICATION ALREADY RUN LOCALLY on this exact tree: tests/fm-pi-branch-extension.test.sh passes with exit 0, bin/fm-lint.sh passes, bin/fm-doc-audience-check.sh passes.
DELIVERY CONSTRAINT: this must land on the SAME existing PR #3184. Merge authority stays with the captain - do NOT merge. Stop at checks green.
What Changed
Risk Assessment
✅ Low: The change is narrowly scoped to conditional model-facing wording, preserves the typed self-describing envelope and new-outcome relay path, and conforms to the explicit M1-only intent.
Testing
Independently exercised the real fm_branch_report delivery path, typed-envelope decoding, conditional duplicate instruction, new-outcome relay instruction, and plain-text encoder fallback; targeted tests passed and runtime evidence confirms the exact hidden note delivered to Pi's model. The author-reported lint and documentation checks were not repeated because this phase prohibits static-analysis tools. No screenshot was appropriate because this surface is intentionally invisible model input rather than rendered UI.
Evidence: Runtime-delivered captain outcome envelope and model-facing body
Source: Runtime-delivered captain outcome envelope and model-facing body
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ No issues found.
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
Targetedtest_branch_dispatch_two_stage_filter_and_prefix_contractfromtests/fm-pi-branch-extension.test.shTargetedtest_captain_outcome_encoding_failure_delivers_plain_instructionfromtests/fm-pi-branch-extension.test.shMutation check using the base commit's unconditional instruction; the strengthened behavior test failed as expectedInspected the net diff and confirmed the M2 helper is absent from the final tree✅ No issues found.
Inspectedgit diff 7ee0c192e9d664b022361bd4609303bebfc7de14..120f43b94001c1aaa8acb9cbe2022a11044a90cfand confirmed the net change is 3 files with 27 insertions and no M2 helper.Ranbash tests/fm-pi-branch-extension.test.sh, exercising the realfm_branch_reportdelivery path, typed envelope decoding, conditional relay wording, single invisible follow-up delivery, routine delivery, and plain-text encoder fallback.Verifiedbin/fm-pr-merge-notified.shis absent andgit status --shortis clean.Inspected the captured provider-facing captain-outcome artifact and its mutation-check evidence.✅ No issues found.
bash tests/fm-pi-branch-extension.test.shbash -x tests/fm-pi-branch-extension.test.shwith extraction of the runtime-delivered operational kind and model-facing body into evidence✅ **Document** - passed
✅ No issues found.
✅ No issues found.
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ No issues found.
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
✅ No issues found.
✅ No issues found.