Skip to content

fix: keep routine supervision noise out of captain chat - #3093

Merged
kunchenguid merged 3 commits into
mainfrom
fm/fm-supervision-noop-check-heartbeat-r1
Aug 26, 2026
Merged

kunchenguid merged 3 commits into
mainfrom
fm/fm-supervision-noop-check-heartbeat-r1

Conversation

@kunchenguid

Copy link
Copy Markdown
Owner

Intent

Two unrelated sources of supervision noise were putting routine events into the captain's main chat. Fix both, in the deliberately NARROW scope the captain chose (he explicitly rejected a broader branch-routing design that was prototyped and then discarded - do NOT reintroduce a no-op-check route map, classifier seam, single-boundary verdict, or any fm-wake-route.sh machinery; none of that ships).

  1. SUPPRESS EMPTY BOARD CLOSES AT THEIR SOURCE. When the captain reads a Lavish review board, says nothing, and closes it, that produced a 'check:' wake whose entire content was that nothing happened. The captain's explicit instruction was to suppress it at the source - the same shape as the existing network-checks success gating - and specifically NOT to route it through the Pi supervision branch. Implementation: bin/fm-procevent.sh gains a generic 'silent' adapter seam that deliberately mirrors the existing 'terminal' seam in shape (exit 0 is the only silence verdict; a missing adapter command, an error, or any other exit publishes the wake as before), and bin/fm-procevent-lavish.sh answers it for exactly one positively-determined shape: a session the adapter classifies 'ended' that carries no queued content block at all. A silenced result is recorded durably handled so a later reconcile does not re-announce it; if the marker cannot be recorded the result is announced instead, because a silence nothing remembers would be re-evaluated forever. FAIL CLOSED was a hard constraint: a board close carrying a REAL captain answer (a Send & End arrives as status: feedback with session_ended, so it classifies 'feedback', never 'ended') still reaches main, as does an 'ended' result that still carries a prompts/feedback block, a waiting session, a missing session, an unknown or unreadable result, a server error, and every adapter that implements no 'silent' command at all. The content check anchors on column zero so captain-supplied indented payload text can neither forge a content block nor hide behind a fake empty one, and a content check that cannot complete announces rather than assuming silence. Silence is deliberately independent of the keyed-answer feed, which still runs once per capture for every adapter, so suppressing an announcement never suppresses the captain's own answer.

  2. DECOUPLE THE HEARTBEAT FROM A CO-PRESENT CHECK. A fleet-wide heartbeat review was being deferred to main merely because some unrelated check row happened to be sitting unread in the durable wake queue - scopeForUnreadWake in .pi/extensions/lib/fm-branch-dispatch.ts returned UNSAFE_SCOPE for any check-kind row when heartbeat=true. That put a routine fleet review in the captain's chat for a reason that had nothing to do with the fleet. The captain's instruction: a heartbeat must not be vetoed or ridden by a co-present check. Fix: a check-kind row is permanently main-owned in EVERY mode, so it is now excluded from the branch's eligible-row claim rather than vetoing the scan - the same treatment the non-heartbeat path already got in PR fix: safely split supervision wake handling by actor #2953. Eligibility is now read off the claim set (eligibleSeqs.length > 0) rather than off the heartbeat flag; before this change that point was unreachable for a heartbeat with an empty eligible set, so it changes no pre-existing outcome and additionally keeps a heartbeat from being offered with nothing to hand over.

CONSTRAINTS THE CAPTAIN SET, all preserved and each deliberate:

  • Heartbeat stays ALL-OR-NOTHING in what it actually guarantees: the branch takes every branch-ownable unread row or none of them. An unresolvable signal/stale row (unmapped project), an unknown row kind, a line failing the structural tab-field check, and an unreadable queue or metadata each still defer the whole review to main, in both modes. Only the check-kind veto was removed, because a permanently main-owned row is not fleet context the branch is missing.
  • These classes stay MAIN-ONLY and are NOT offered to the branch: Relay/public mentions, credential/auth failures, watcher-failure repair, real board answers, and first merge confirmations. The isCheckTrigger force-to-main in .pi/extensions/fm-primary-pi-watch.ts is deliberately RETAINED and untouched - it is what guarantees main is woken on each check's own triggering close, so a check row left queued for main never starves. Each of those classes now has a test.
  • The PR fix: safely split supervision wake handling by actor #2953 per-actor split-consume acknowledgement and the no-cross-swallow property are untouched.

Two pre-existing tests pinned the old heartbeat veto and were deliberately INVERTED to the new contract rather than deleted: tests/fm-pi-watch-extension.test.sh's heartbeat mixed-queue test and tests/fm-pi-branch-extension.test.sh's pre-drain heartbeat recheck test. New colocated regressions exercise the real classifier and the real runner end to end, never source-text assertions: an empty board close is captured, recorded handled, wakes nobody, and stays silent through a later reconcile while still retiring its ended source; a board close carrying the captain's real answer still publishes its wake and is left unacknowledged for the handler; the adapter's silence verdict fails closed on every other result shape; adapters with no 'silent' command still announce; a heartbeat with a co-present check row is offered to and accepted by the branch with the check row excluded from its claim; an unresolvable row, an unknown row kind, and a purely main-only queue each still keep a heartbeat off the branch; and every named main-only check class still reaches main.

This edits Firstmate's shared tracked material (bin/, .pi/extensions/, docs/, .agents/skills/) under firstmate-coding-guidelines: one sentence per line in prose, plain dash never the em dash, shellcheck-clean bin scripts, colocated tests updated in the same change, and maintainer-verification evidence recorded in docs/verification/process-event-sources.md. Docs updated to match: docs/pi-supervision-branch.md, docs/watcher-continuity.md, docs/configuration.md, docs/verification/process-event-sources.md, and .agents/skills/process-event-sources/SKILL.md. No agent, tool, or AI name may be added as a commit co-author.

What Changed

  • Add a fail-closed adapter silence seam and suppress only content-free ended Lavish sessions after durably marking them handled.
  • Keep check rows main-owned without letting them veto heartbeat branch claims, while preserving unsafe-queue deferral behavior.
  • Update supervision and process-event documentation and add regression coverage for silent results, heartbeat routing, and main-only check classes.

Risk Assessment

✅ Low: The changes are narrowly scoped, fail closed as required, preserve main-only and per-actor ownership boundaries, and introduce no substantiated correctness or intent-conformance issues.

Testing

Inspected the focused diff, ran the three colocated behavior suites, and manually exercised the public Lavish silence seam; empty closes were suppressed while content, malformed input, and real answers failed closed to announcement, and heartbeat checks confirmed co-present main-only rows neither veto nor ride branch delivery. A reviewer-visible transcript was captured, and the worktree remained clean.

Evidence: Supervision noise end-to-end behavior transcript

Source: Supervision noise end-to-end behavior transcript

$ bin/fm-procevent-lavish.sh silent <captured-result>; echo exit=$?
empty ended board with no content: exit=0 (0 means suppress)
ended board with a declared content block: exit=1 (nonzero means announce)
ended board with malformed content header: exit=1 (nonzero means announce)
Send & End with captain answer: exit=1 (nonzero means announce)

$ targeted end-to-end behavior checks
ok - an empty board close is captured and recorded handled without ever waking the captain
ok - a board close carrying the captain's real answer is still announced
ok - the adapter owns which Lavish results are silent, and fails closed on everything else
ok - an adapter with no silence verdict keeps announcing every result
ok - a heartbeat review survives a check row arriving before its drain
ok - pre-drain eligibility re-check excludes a newly main-owned row without deferring eligible work
ok - a co-present check row neither vetoes nor rides a heartbeat into main
ok - every main-only check class still reaches main, never the supervision branch
ok - heartbeat restoration failure stays on main

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

🔧 **Rebase** - 1 issue found → auto-fixed ✅
  • ⚠️ docs/pi-supervision-branch.md - merge conflict rebasing onto origin/main

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

🔧 **Review** - 1 issue found → auto-fixed (2) ✅
  • 🚨 bin/fm-procevent-lavish.sh:341 - Intent requires silence only when there is “no queued content block at all” and requires any ended result still carrying a prompts/feedback block to reach main. This classifier marks content present only when its declared count is greater than zero, so an ended result with prompts[0]{...}: returns a silent verdict, is recorded handled, and never wakes main; the new test explicitly pins that contradictory behavior. It also treats malformed top-level content headers as absence rather than failing closed. Treat any recognized content block as present and malformed prompts/feedback headers as an indeterminate check that announces.

🔧 Fix: Fail closed on all Lavish content headers
1 warning still open:

  • ⚠️ bin/fm-procevent.sh:508 - When publish_result silences a capture, it records the handled marker but returns nonzero, leaving published_capture=0. The runner then prints not-autohandled ... still unacknowledged even though the result is durably handled. Distinguish the silenced/handled outcome from publication failure before emitting this diagnostic.

🔧 Fix: Suppress false unacknowledged status for silenced results
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • git status --short && git diff --stat f7a387f44ed4fa942914e8944be4981a42e1e102..HEAD && git diff --name-only ...
  • bash tests/fm-procevent.test.sh
  • bash tests/fm-pi-branch-extension.test.sh
  • bash tests/fm-pi-watch-extension.test.sh
  • Manually invoked bin/fm-procevent-lavish.sh silent with an empty ended board, declared content block, malformed content header, and Send & End captain answer.
  • Re-ran focused end-to-end checks and captured the relevant behavioral results in the evidence transcript.
  • git status --short after testing confirmed no transient worktree artifacts remained.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

kunchenguid and others added 3 commits August 25, 2026 22:52
Two unrelated sources of noise put routine supervision events in the
captain's chat.

An empty Lavish board close - the captain reads a review surface, says
nothing, and closes it - became a check wake whose entire content was
that nothing happened. Suppress it at its source instead of routing it
anywhere: the generic runner gains a `silent` adapter seam mirroring the
existing `terminal` one, and the Lavish adapter answers it for exactly
one positively-determined shape, an `ended` session carrying no queued
content block. A silenced result is recorded durably handled so it does
not return on a later reconcile. Everything else announces unchanged - a
`Send & End` close carrying the captain's real answer, an `ended` result
still carrying content, a waiting or missing session, an unreadable
result, and every adapter that implements no `silent` command at all.
The keyed-answer feed is untouched, so suppressing an announcement never
suppresses the captain's own answer.

A fleet heartbeat was deferred to main merely because some unrelated
check row happened to be sitting unread, which put a routine fleet
review in the chat for a reason that had nothing to do with the fleet. A
check row is permanently main-owned, so it is now excluded from a
heartbeat claim rather than vetoing the scan, exactly as in every other
mode. What all-or-nothing guarantees is unchanged: the branch takes
every branch-ownable unread row or none of them, and an unresolvable
task-local row, an unknown row kind, or an unreadable queue still defers
the whole review to main. Main is still woken for the check on that
check's own triggering close, so nothing starves.

Main-only classes are unchanged and now each covered by a test: Relay
mentions, credential failures, merge confirmations, real board answers,
and watcher-failure repair. The per-actor acknowledgement and
no-cross-swallow properties are untouched.
@greptile-apps

greptile-apps Bot commented Aug 26, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

The PR appears safe to merge with no concrete blocking or independently actionable non-blocking issue identified.

The new silence path durably handles only the documented content-free ended result shape and otherwise announces fail closed, while heartbeat routing continues to exclude check rows from branch ownership without weakening unsafe-row deferral.

Reviews (1): Last reviewed commit: "no-mistakes(review): Suppress false unac..." | Re-trigger Greptile

@kunchenguid
kunchenguid merged commit 07bf0c8 into main Aug 26, 2026
14 checks passed
@kunchenguid
kunchenguid deleted the fm/fm-supervision-noop-check-heartbeat-r1 branch August 26, 2026 07:00
Jeffdotchan added a commit to Jeffdotchan/firstmate that referenced this pull request Aug 26, 2026
Resolves the one conflict, bin/fm-decision-hold.sh, in favour of upstream's
shim over the new bin/fm-captain-hold.sh, and ports the local `has-active`
verb (74c29fa) onto it. bin/fm-teardown.sh:2650 gates teardown on that verb,
so dropping it would have silently disabled the refuse-while-a-captain-hold-
is-open guard. The port is a superset of the pre-collapse behaviour: it
matches both the legacy <origin>-decision-* identities and the collapsed
plain <origin> task id.

Brings in, among 60+ others:
- persistent Pi supervision branch (kunchenguid#2858, kunchenguid#2939, kunchenguid#2953, kunchenguid#3093) so routine
  watcher wakes stop landing in the captain's context
- spendPriority quota dispatch (kunchenguid#2574)
- captain-hold collapse (kunchenguid#2728, kunchenguid#2490, kunchenguid#2748, kunchenguid#2764)
knowttl added a commit to knowttl/firstmate that referenced this pull request Aug 26, 2026
Rebuilt from the current fork main (c3a2490), which had independently
absorbed 4 of the original 7 upstream commits via its own kunchenguid:main
merge while this sync was in progress. This merges the 3 that remained:
- 9ce69ac fix(bin): stop a correlation token from hiding and stranding decisions (kunchenguid#1967)
- 07bf0c8 fix: keep routine supervision noise out of captain chat (kunchenguid#3093)
- f7a387f feat(pi): let /supervision-model pick branch reasoning effort (kunchenguid#3079)

Conflict resolution (2 files), both from upstream kunchenguid#3093 adding a new
adapter "silent" no-op suppression path, against the process-event adapter
this fork renamed lavish -> atelier in df367d7:

- bin/fm-procevent-atelier.sh: adopted upstream's new `silent` subcommand,
  its doc block, and the extended usage() range, keeping the fork's Atelier
  naming and Atelier-specific header notes. Auto-merged cmd_silent() body
  and dispatch retained; the one leftover upstream "Lavish" mention renamed.
- .agents/skills/process-event-sources/SKILL.md: kept the fork's two Atelier
  guidance lines and inserted upstream's new "routine no-op" line rewritten
  for Atelier.

Renamed upstream-introduced Lavish/lavish orphans to Atelier/atelier in
docs/configuration.md, docs/verification/process-event-sources.md,
tests/fm-procevent.test.sh, tests/fm-pi-watch-extension.test.sh so nothing
references the nonexistent fm-procevent-lavish.sh. Full-tree grep confirms
zero lavish references remain.

Verified: bin/fm-lint.sh clean (shellcheck 0.11.0, actionlint 1.7.12);
fm-procevent, fm-pi-watch-extension, fm-classify-corr-token all green. One
flaky timing failure in an fm-pi-watch-extension watcher-lock case passed on
re-run and passes identically on plain main, so it is pre-existing flakiness,
not a merge regression.
akrcdev added a commit to akrcdev/firstmate that referenced this pull request Aug 29, 2026