Skip to content

feat(bin): add steering-inbox read receipts so read steers stop unread alarms - #7453

Open
tiago-peixoto wants to merge 12 commits into
kunchenguid:mainfrom
tiago-peixoto:fm/upstream-7280-inbox-read-ack
Open

tiago-peixoto wants to merge 12 commits into
kunchenguid:mainfrom
tiago-peixoto:fm/upstream-7280-inbox-read-ack

Conversation

@tiago-peixoto

@tiago-peixoto tiago-peixoto commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #7280.

Commit ff43e3ca fixes a pre-existing test-fixture race in tests/fm-watcher-lock.test.sh and tests/fm-claude-stop-autoarm.test.sh.
Behavior portable serial 1 was cancelled at the 30-minute limit, as on main run 40101665463.

What Changed

  • Add bin/fm-task-inbox-read.sh and fm_task_inbox_record_read/fm_task_inbox_is_read/fm_task_inbox_clear_reads in bin/fm-task-inbox-lib.sh: a worker writes an empty <task>.inbox/.read/NNN.msg receipt right after reading a steer, and fm-spawn.sh clears all receipts on every worker launch (refusing to launch if it cannot).
  • The watcher ladder in fm-task-inbox-lib.sh and fm-watch.sh now tracks the oldest unread record instead of the oldest unhandled one, so a read-but-still-pending message no longer re-rings, counts toward the busy budget, or escalates to a stuck-crewmate wake; the handled/ move remains the completed-handling acknowledgement.
  • Brief, relaunch note, polytoken system prompt, doorbell line, and remote charter rewrite (fm-remote-home-seed.sh maps the receipt command to the remote code root) now instruct the read-receipt step with a file-tool fallback; the Rovo grant comment, skills, docs, test-family routing, and tests for brief, relaunch, inbox ladder, and remote lifecycle are updated accordingly.

Risk Assessment

✅ Low: The read receipt only removes a provably read record from unread detection while leaving defaults, the handled/ move, and every other liveness alarm unchanged; I traced the busy, ring, escalate, retry, dead-endpoint, relaunch, and remote-seed paths and found no sequence that silences a never-read message or re-alarms a read one, and the new tests exercise the real watcher for both halves of the intent.

Testing

Ran the four targeted test files (inbox, brief, relaunch, remote secondmate end-to-end), each of which starts real fm-watch.sh, fm-control.sh, fm-spawn.sh, fm-brief.sh or fm-remote-home-seed.sh processes. Inbox, brief and relaunch files passed fully; the relaunch file first failed on the known host trap where a redirected HOME breaks the mise python3 shim and passed once the real interpreter directories were placed ahead on PATH. The remote end-to-end file passed its new read-receipt check and then failed at the pre-existing, already-declined "remote spawn never reached its blocked inheritance write" step. Beyond the test files, hand-driven transcripts against the real watcher at default thresholds show unread steers escalating with the stuck-busy and dead-pane reasons, read steers staying quiet across many busy polls and an idle poll without being retired, an unread successor escalating by name, and a removed receipt restoring the alarm. A scaffolded brief's receipt command, file-tool fallback path and handled move were executed verbatim against a real inbox record. Defaults confirmed unchanged at grace 90, ring max 3, busy max 2. No visual surface exists for this change, so no screenshots were taken. A real Claude worker interpreting the brief was not spawned.

  • Live validation: ✅ go - 12 of 13 scenarios driven live against the product
Scenario Result Live Evidence
Busy worker records a read of a long-running steer and is not escalated: the watcher's busy budget resets, no stale wake is queued, no doorbell is typed, and the record stays in the inbox root until t… ✅ pass live watcher-default-threshold-drive.log section B (polls 2-7, busy-state=none, wake-queue=0, record-in-root=001.msg); tests/fm-task-inbox.test.sh 'read work survives restarts without unread alarms'
A never-read steer on a continuously busy worker still raises the stuck-busy stale wake at the default budget of 2 consecutive busy polls, exactly once ✅ pass live watcher-default-threshold-drive.log section A (poll 2 queues 'stale: ... stuck-busy after 2 consecutive busy-deferred due doorbells; .../001.msg stays unhandled'; poll 3 adds nothing)
A never-read successor message arriving while a read steer is still being worked escalates by its own name and does not inherit silence ✅ pass live watcher-default-threshold-drive.log section C (wake names 002.msg after two busy polls)
Adversarial: removing the receipt of a message the worker never finished brings the stuck-busy alarm back ✅ pass live watcher-default-threshold-drive.log section D (busy-state restarts at 001.msg,1 and escalates on poll 11)
A read receipt arriving during the watcher's own due check prevents escalation ✅ pass live fm-task-inbox.log: 'ok - watcher: a read receipt arriving during the due check prevents unread escalation'
A read receipt silences a spent doorbell ring ladder and an owed fire-and-forget retry ring ✅ pass live fm-task-inbox.log: 'ok - inbox: read receipts silence spent delivery budgets and owed retry rings'
Adversarial: receipts for a missing record, a non-record name, a non-inbox directory, or an unwritable .read/ entry fail with a non-zero exit and do not suppress unread detection ✅ pass live brief-receipt-drive.log adversarial section (exit 1 for missing 009.msg and ../x.msg, exit 2 with no argument); fm-task-inbox.log 'missing, invalid, and unwritable read receipts fail without suppressi…
Dead worker pane: an unread record escalates with the agent-exited reason, while a read record does not raise the unread-instruction wake ✅ pass live watcher-dead-pane-drive.log (unread: 1 wake 'agent has exited or its endpoint is missing'; read: 0 wakes)
Relaunch: a replacement worker does not inherit its predecessor's receipts, so the surviving steer is rung again ✅ pass live fm-control-relaunch.log: 'ok - fm-control relaunch: a replacement worker does not inherit its predecessor's read receipts' (real fm-control.sh relaunch through fm-spawn.sh with the stubbed tmux sessio…
Generated brief tells the worker to record the read before acting, and its receipt command, literal unquoted file-tool fallback path, and handled move all work when run verbatim against a real inbox r… ✅ pass live brief-receipt-drive.log (brief text rendered; receipt command exit 0 creates .read/001.msg and due_action turns from 'ring' to 'quiet'; mkdir/touch at the literal fallback path quiets 002.msg; mv to h…
Remote secondmate charter rewrites the receipt command to the remote code root so it runs against the host-local inbox ✅ pass live fm-remote-secondmate-lifecycle-e2e.log line 11: 'ok - remote charter's read-receipt command runs the remote code root's script against the host-local inbox'
Default alarm thresholds are unchanged (grace 90s, ring max 3, busy max 2) ✅ pass live brief-receipt-drive.log and watcher-default-threshold-drive.log header: 'grace=90 ring_max=3 busy_max=2' with no FM_TASK_INBOX_* in the environment
A real Claude worker launched from the brief reads a steer and runs the receipt command on its own ⏸️ untested no Not driven. This would need a real claude worker spawned in a disposable lab home and a model turn interpreting the brief; the previous test round was cut at the 30-minute budget attempting long liv…
Evidence: Real watcher at default thresholds: unread vs read vs successor vs deleted receipt

Source: Real watcher at default thresholds: unread vs read vs successor vs deleted receipt

defaults in effect: grace=90 busy_max=2

\### A. never-read steer on a continuously busy worker (the alarm must still fire)
after steer (aged past grace)      busy-state=none           wake-queue=0 typed=no record-in-root=001.msg 
poll 1 (busy)                      busy-state=001.msg,1      wake-queue=0 typed=no record-in-root=001.msg 
poll 2 (busy)                      busy-state=001.msg,2      wake-queue=1 typed=no record-in-root=001.msg 
wake queued:
    1792859314	1	stale	sess:fm-t1	stale: sess:fm-t1 (unread firstmate instruction: stuck-busy after 2 consecutive busy-deferred due doorbells; /tmp/fm-task-inbox.PZhoSA/default-unread/state/t1.inbox/001.msg stays unhandled and no doorbell was typed; inspect the worker)
poll 3 (busy)                      busy-state=001.msg,2      wake-queue=1 typed=no record-in-root=001.msg 

\### B. worker reads the long-running steer right away, then stays busy for many polls
poll 1 (busy, unread)              busy-state=001.msg,1      wake-queue=0 typed=no record-in-root=001.msg 
worker reads: please continue
receipt recorded: 001.msg
poll 2 (busy, read)                busy-state=none           wake-queue=0 typed=no record-in-root=001.msg 
poll 3 (busy, read)                busy-state=none           wake-queue=0 typed=no record-in-root=001.msg 
poll 4 (busy, read)                busy-state=none           wake-queue=0 typed=no record-in-root=001.msg 
poll 5 (busy, read)                busy-state=none           wake-queue=0 typed=no record-in-root=001.msg 
poll 6 (busy, read)                busy-state=none           wake-queue=0 typed=no record-in-root=001.msg 
idle pane after the read (would the ladder ring the doorbell again?)
poll 7 (idle, read)                busy-state=none           wake-queue=0 typed=no record-in-root=001.msg 

\### C. a never-read successor arrives while the read one is still being worked
poll 8 (busy)                      busy-state=002.msg,1      wake-queue=0 typed=no record-in-root=001.msg 002.msg 
poll 9 (busy)                      busy-state=002.msg,2      wake-queue=1 typed=no record-in-root=001.msg 002.msg 
wake queued:
    1792859317	1	stale	sess:fm-t1	stale: sess:fm-t1 (unread firstmate instruction: stuck-busy after 2 consecutive busy-deferred due doorbells; /tmp/fm-task-inbox.PZhoSA/default-read/state/t1.inbox/002.msg stays unhandled and no doorbell was typed; inspect the worker)

\### D. adversarial: delete the receipt (fake a read that never happened) - alarm must come back
poll 10 (busy, receipt gone)       busy-state=001.msg,1      wake-queue=0 typed=no record-in-root=001.msg 
poll 11 (busy, receipt gone)       busy-state=001.msg,2      wake-queue=1 typed=no record-in-root=001.msg 
wake queued:
    1792859318	2	stale	sess:fm-t1	stale: sess:fm-t1 (unread firstmate instruction: stuck-busy after 2 consecutive busy-deferred due doorbells; /tmp/fm-task-inbox.PZhoSA/default-read/state/t1.inbox/001.msg stays unhandled and no doorbell was typed; inspect the worker)
Evidence: Driver script for the default-threshold watcher transcript

Source: Driver script for the default-threshold watcher transcript

#!/usr/bin/env bash
# Manual live drive of the issue scenario: the real fm-watch.sh inbox_steer_check
# against a pane whose capture says the worker is busy, at the library's DEFAULT
# busy budget and grace (no FM_TASK_INBOX_* overrides). Each check is a fresh
# watcher process, as across restarts. Fixture functions come from the test file.
set -u
. "$1"   # fixture prelude from tests/fm-task-inbox.test.sh (helpers only)
trap 'rm -rf "$TMP_ROOT"' EXIT
check() {  # <case-dir>  -> one watcher poll, default thresholds
  PATH="$1/fakebin:$PATH" FM_STATE_OVERRIDE="$1/state" FM_SEND_LOG="$1/send.log" \
    FM_FAKE_TMUX_CAPTURE="$1/busy.capture" FM_BUSY_REGEX=BUSYTOKEN \
    env -u FM_TASK_INBOX_GRACE_SECS -u FM_TASK_INBOX_BUSY_MAX -u FM_TASK_INBOX_RING_MAX \
    bash -c '. "$1" && inbox_steer_check sess:fm-t1 t1' _ "$WATCH" > "$1/check.out" 2>&1
}
show() {  # <case-dir> <label>
  local d=$1
  printf '%-34s busy-state=%-14s wake-queue=%s typed=%s record-in-root=%s\n' "$2" \
    "$( [ -e "$d/state/t1.inbox/.busy-state" ] && tr '\t' , < "$d/state/t1.inbox/.busy-state" | tr -d '\n' || echo none)" \
    "$( [ -s "$d/state/.wake-queue" ] && wc -l < "$d/state/.wake-queue" || echo 0)" \
    "$( [ -s "$d/send.log" ] && echo yes || echo no)" \
    "$(ls "$d/state/t1.inbox"/*.msg 2>/dev/null | xargs -n1 basename 2>/dev/null | tr '\n' ' ')"
}
echo "defaults in effect: grace=$(FM_STATE_OVERRIDE=/tmp bash -c '. "$1"; fm_task_inbox_grace_secs' _ "$ROOT/bin/fm-task-inbox-lib.sh") busy_max=$(FM_STATE_OVERRIDE=/tmp bash -c '. "$1"; fm_task_inbox_busy_max' _ "$ROOT/bin/fm-task-inbox-lib.sh")"
echo; echo "### A. never-read steer on a continuously busy worker (the alarm must still fire)"
A=$(busy_case default-unread); : > "$A/send.log"
show "$A" "after steer (aged past grace)"
check "$A"; show "$A" "poll 1 (busy)"
check "$A"; show "$A" "poll 2 (busy)"
echo "wake queued:"; sed 's/^/    /' "$A/state/.wake-queue"
check "$A"; show "$A" "poll 3 (busy)"

echo; echo "### B. worker reads the long-running steer right away, then stays busy for many polls"
B=$(busy_case default-read); : > "$B/send.log"
check "$B"; show "$B" "poll 1 (busy, unread)"
echo "worker reads: $(FM_STATE_OVERRIDE="$B/state" bash -c '. "$1"; fm_task_inbox_body "$2"' _ "$ROOT/bin/fm-task-inbox-lib.sh" "$B/state/t1.inbox/001.msg")"
"$ROOT/bin/fm-task-inbox-read.sh" "$B/state/t1.inbox/001.msg" && echo "receipt recorded: $(ls "$B/state/t1.inbox/.read")"
for i in 2 3 4 5 6; do check "$B"; show "$B" "poll $i (busy, read)"; done
echo "idle pane after the read (would the ladder ring the doorbell again?)"
PATH="$B/fakebin:$PATH" FM_STATE_OVERRIDE="$B/state" FM_SEND_LOG="$B/send.log" FM_FAKE_TMUX_CAPTURE="$(idle_capture "$B")" FM_BUSY_REGEX=BUSYTOKEN \
  env -u FM_TASK_INBOX_GRACE_SECS -u FM_TASK_INBOX_BUSY_MAX bash -c '. "$1" && inbox_steer_check sess:fm-t1 t1' _ "$WATCH" >/dev/null 2>&1
show "$B" "poll 7 (idle, read)"
echo; echo "### C. a never-read successor arrives while the read one is still being worked"
nxt=$(inbox_lib "$B/state" fm_task_inbox_write "$B/state" t1 "second instruction, never read"); age_path "$nxt"
check "$B"; show "$B" "poll 8 (busy)"
check "$B"; show "$B" "poll 9 (busy)"
echo "wake queued:"; sed 's/^/    /' "$B/state/.wake-queue"
echo; echo "### D. adversarial: delete the receipt (fake a read that never happened) - alarm must come back"
rm -f "$B/state/.wake-queue" "$B/state/t1.inbox/002.msg"
rm -rf "$B/state/t1.inbox/.read"
check "$B"; show "$B" "poll 10 (busy, receipt gone)"
check "$B"; show "$B" "poll 11 (busy, receipt gone)"
echo "wake queued:"; sed 's/^/    /' "$B/state/.wake-queue"
Evidence: Dead pane: unread record escalates, read record does not

Source: Dead pane: unread record escalates, read record does not

unread  record: wake-queue lines=1 typed=no
    1792859362	1	stale	sess:fm-t1	stale: sess:fm-t1 (unread firstmate instruction: /tmp/fm-task-inbox.B4TVLD/dead-unread/state/t1.inbox/001.msg is unhandled and the worker's agent has exited or its endpoint is missing, so the doorbell was not typed; recover the worker)
read    record: wake-queue lines=0 typed=no
Evidence: Generated brief inbox section and its receipt command, fallback path, and handled move run verbatim

Source: Generated brief inbox section and its receipt command, fallback path, and handled move run verbatim

## defaults (no FM_TASK_INBOX_* in env)
0
grace=90 ring_max=3 busy_max=2

## scaffold a ship brief in a disposable FM_HOME
--- inbox section as the worker sees it:
# Firstmate instruction inbox
Firstmate steers you through durable message files in '/tmp/fm-brief-drive.XaRnDX/state/ship.inbox'.
When a terminal message says an instruction is waiting there - and at any natural checkpoint when you are unsure - list them with `find '/tmp/fm-brief-drive.XaRnDX/state/ship.inbox' -maxdepth 1 -name '*.msg' 2>/dev/null | sort -V` and read the complete contents of each record (including its final line even when it is not newline-terminated) in numeric order.
Prefer the format-aware `fm_task_inbox_body` reader from `bin/fm-task-inbox-lib.sh` when it is available. If you read manually, a header line `body-terminator=1` means the writer added exactly one synthetic final newline to terminate the record file; that marked newline is not part of the logical message body, so remove only it and preserve any intentional trailing newlines. Legacy records without that marker may end without a newline; read them through the file end.
Immediately after reading each message, before acting, record that you read it: `'~/.no-mistakes/worktrees/5284051b2355/01M5Q99RTNBFRDXBK2ZC9NVJE2/bin/fm-task-inbox-read.sh' '/tmp/fm-brief-drive.XaRnDX/state/ship.inbox'/NNN.msg`.
Do not record a read before actually reading the message.
If the command fails or cannot run, use your file tools to create /tmp/fm-brief-drive.XaRnDX/state/ship.inbox/.read/ if needed, then create the empty receipt /tmp/fm-brief-drive.XaRnDX/state/ship.inbox/.read/NNN.msg for the message you just read.
Report a read-acknowledgement failure only if the file-tool fallback also fails; never assume a failed write acknowledged the message.
Then act on the message and acknowledge completed handling by moving it: `mv '/tmp/fm-brief-drive.XaRnDX/state/ship.inbox'/NNN.msg '/tmp/fm-brief-drive.XaRnDX/state/ship.inbox'/handled/`.
The read receipt stops unread-instruction alarms while you work; it does not mean the work is complete or replace the handled/ move.
An empty or absent inbox needs no action.

## firstmate steers the worker (real record write) and the watcher sees it unread
record=/tmp/fm-brief-drive.XaRnDX/state/ship.inbox/001.msg
due_action(grace=0) before any read: ring /tmp/fm-brief-drive.XaRnDX/state/ship.inbox/001.msg

## worker runs the brief's receipt command verbatim (NNN -> 001)
command: '~/.no-mistakes/worktrees/5284051b2355/01M5Q99RTNBFRDXBK2ZC9NVJE2/bin/fm-task-inbox-read.sh' '/tmp/fm-brief-drive.XaRnDX/state/ship.inbox'/001.msg
exit=0
total 0
drwxrwxr-x 2 firstmate firstmate  60 Oct 24 18:26 .
drwxrwxr-x 4 firstmate firstmate 100 Oct 24 18:26 ..
-rw-rw-r-- 1 firstmate firstmate   0 Oct 24 18:26 001.msg
record still in inbox root: yes
due_action(grace=0) after read: quiet
record_busy after read returns: 0

## worker finishes: runs the brief's handled move verbatim
command: mv '/tmp/fm-brief-drive.XaRnDX/state/ship.inbox'/001.msg '/tmp/fm-brief-drive.XaRnDX/state/ship.inbox'/handled/
exit=0
001.msg
due_action after handled: quiet

## second steer: worker without a shell uses the file-tool fallback path from the brief
record=/tmp/fm-brief-drive.XaRnDX/state/ship.inbox/002.msg
due_action(grace=0) before read: ring /tmp/fm-brief-drive.XaRnDX/state/ship.inbox/002.msg
fallback dir  (literal from brief): /tmp/fm-brief-drive.XaRnDX/state/ship.inbox/.read/
fallback file (literal from brief): /tmp/fm-brief-drive.XaRnDX/state/ship.inbox/.read/002.msg
total 0
drwxrwxr-x 2 firstmate firstmate  80 Oct 24 18:26 .
drwxrwxr-x 4 firstmate firstmate 100 Oct 24 18:26 ..
-rw-rw-r-- 1 firstmate firstmate   0 Oct 24 18:26 001.msg
-rw-rw-r-- 1 firstmate firstmate   0 Oct 24 18:26 002.msg
due_action(grace=0) after file-tool receipt: quiet

## adversarial: a receipt for a record nobody wrote, and a bogus path
error: could not record reading steering message: /tmp/fm-brief-drive.XaRnDX/state/ship.inbox/009.msg
exit(missing 009)=1
error: could not record reading steering message: /tmp/fm-brief-drive.XaRnDX/state/ship.inbox/../x.msg
exit(non-inbox dir)=1
error: expected one steering-message path; use --help
exit(no args)=2
Usage: fm-task-inbox-read.sh <path/to/task.inbox/NNN.msg>
Record that you read the message before acting. Move it to handled/ only after handling.
exit(--help)=0
001.msg
002.msg
Evidence: tests/fm-task-inbox.test.sh output

Source: tests/fm-task-inbox.test.sh output

ok - inbox: a steer is written durably and round-trips byte-exact with a self-describing doorbell
ok - inbox: a hostile-name doorbell executes as a no-op in bare shells
ok - inbox: terminal-control inbox names are rejected without typing
ok - inbox: the ring skips dead or missing endpoints and still rings live or unclassifiable endpoints
ok - inbox: the ring submits its own stuck doorbell, skips other pending text, and retries a lost Enter once on both paths
ok - inbox: the idempotent enqueue dedups an exact re-run onto the same record, handled or not
ok - inbox: idempotent enqueue follows a record concurrently moved to handled
ok - inbox: the handled mv is the idempotent ack and sequences are never reissued
ok - inbox: concurrent writers serialize on the sequence lock and lose nothing
ok - inbox: a writer retries when a competing lock vanishes after its failed claim
ok - inbox: ladder bookkeeping ignores a concurrently removed inbox
ok - inbox: fire-and-forget records stay durable and outside the ladder
ok - inbox: a fire-and-forget record whose ring did not land is owed exactly one retry
ok - inbox: without config/wait-no-turns a fire-and-forget retry mark stays quiet
ok - inbox: the re-ring ladder paces by grace, escalates once, and resets on ack
ok - watcher: an unhandled aged message on an idle pane re-rings without waking firstmate, and the ack silences it
ok - watcher: busy deferrals survive restart, escalate once at the bound, and never type
ok - watcher: read work survives restarts without unread alarms, while an unread successor still escalates
ok - watcher: a read receipt arriving during the due check prevents unread escalation
ok - inbox: read receipts silence spent delivery budgets and owed retry rings
ok - inbox: missing, invalid, and unwritable read receipts fail without suppressing unread detection
ok - watcher: delivery and acknowledgement reset the durable busy budget
ok - watcher: unwritable busy bookkeeping surfaces without typing
ok - watcher: idle successor surfaces once despite unremovable predecessor bookkeeping
ok - watcher: busy successor surfaces once despite unremovable predecessor bookkeeping
ok - watcher: persistent idle busy-reset failure escalates once and later instructions still deliver
ok - watcher: persistent protected busy-reset failure escalates once and later instructions still deliver
ok - watcher: busy limit '999999999999999999999999999999' escalates exactly once at 2
ok - watcher: busy limit '1000000000' escalates exactly once at 2
ok - watcher: busy limit '0' escalates exactly once at 2
ok - watcher: busy limit '000' escalates exactly once at 2
ok - watcher: busy limit '' escalates exactly once at 2
ok - watcher: busy limit 'invalid' escalates exactly once at 2
ok - watcher: busy limit '1' escalates exactly once at 1
ok - watcher: busy limit '3' escalates exactly once at 3
ok - watcher: unremovable obsolete busy state does not block or escalate a fire-and-forget retry
ok - watcher: busy successor escalates once despite stale predecessor ring history
ok - watcher: dead successor escalates once despite stale predecessor ring history
ok - watcher: missing successor escalates once despite stale predecessor ring history
ok - watcher: unwritable successor escalates once despite stale predecessor ring history
ok - watcher: a non-busy protected delivery breaks the busy streak and preserves the attempt ladder
ok - watcher: a non-busy failed delivery breaks the busy streak and preserves the attempt ladder
ok - watcher: a healthy or empty inbox stays completely silent
ok - watcher: acknowledgement silences an unwritable ladder without a stale wake
ok - watcher: unwritable ladder bookkeeping surfaces a stale wake after the doorbell
ok - watcher: a fire-and-forget record's owed retry rings exactly once and never escalates
ok - watcher: a fire-and-forget retry waits out the worker's own decision, then rings once
ok - watcher: spending a retry keeps a newer record's mark written during its ring
ok - watcher: a spent ring budget emits exactly one ordinary stale wake for recovery
ok - watcher: a positively dead pane is never typed into and surfaces exactly one stale wake
ok - watcher: dead-pane recovery overrides stale busy state
exit=0 elapsed=92s
Evidence: tests/fm-brief.test.sh output

Source: tests/fm-brief.test.sh output

ok - fm-brief: scaffolds leave the worker role scope to the launch boundary and keep the secondmate contract
ok - fm-brief.sh: bash -n succeeds
/tmp/fm-brief.qjAKPr/heredoc-in-substitution.sh:2
ok - fm-brief.sh: no heredoc is nested inside a command substitution (Bash 3.2 parse-safe)
ok - fm-brief.sh: --help renders the complete header
ok - fm-brief.sh: no-mistakes/direct-PR/local-only briefs generate cleanly
ok - fm-brief.sh: --forge forgejo names tea in Rule 3, the direct-PR DOD, and the draft read-back, marks the delivery contract, and the closed set refuses everything else
ok - fm-brief.sh: --forge external renders the no-push rule, the review contract, and the adapter, and refuses every impossible shape
ok - fm-brief.sh: ship --mode is required and closed-set validated
ok - fm-brief.sh: the explicit ship mode wins over the registered posture
ok - fm-brief.sh: --yolo and scout/secondmate --mode are refused, never silently dropped
ok - fm-brief.sh: faster paths use configured authority without stacked review
ok - fm-brief.sh: no-mistakes DOD keeps its apostrophe prose and bans --yes outright
ok - fm-brief.sh: no-mistakes DOD detects a green PR from the drive call, not a status poll
ok - fm-brief.sh: PR-based done requires a non-draft PR; a deliberate draft declares a wait
ok - fm-brief.sh: no-mistakes ask-user findings use one event plus a verbatim snapshot
ok - fm-brief.sh: ship project-memory wording bounds edits to corrections of wrong information
ok - fm-brief.sh: --herdr-lab emits the complete hard safety contract
ok - fm-brief.sh: --herdr-lab uses its quoted Firstmate-owned helper path
ok - fm-brief.sh: ship and scout scaffolds make omitted Herdr intent fail-visible
ok - fm-brief.sh: the documented {TASK} and {FIRSTMATE_SPEC} fills cannot corrupt the Herdr safety gate
ok - fm-brief.sh: Herdr lab contract covers scouts and rejects secondmate misuse
ok - fm-brief.sh: --no-projects scaffolds a project-less charter and guards misuse
ok - fm-brief.sh: marked requests avoid generic acknowledgements and preserve material reporting
ok - fm-brief.sh: relative directory inputs ignore CDPATH, render stable absolute charter paths, or fail loudly
ok - fm-brief.sh: custom pause verb renders in every scaffold
ok - fm-brief.sh: ship and scout scaffolds declare a validation-round pause once, then hold it
ok - fm-brief.sh: investigation and visual-review completions load the shared decision policy
ok - fm-brief: scout and secondmate code paths still scaffold well-formed briefs
ok - fm-brief.sh: scout Lavish hosting follows the bootstrap lavish-axi floor
ok - fm-brief: inbox listing is silent on empty/absent inbox and numerically ordered
ok - fm-brief: workers end the turn on a decision, wait in one bounded shell command, and never poll
ok - fm-brief: without config/wait-no-turns the brief and drive text stay as they were
ok - fm-brief: inbox guidance explains marked synthetic terminators in every scaffold
ok - fm-brief.sh: the home brief include lands last on ship and scout, verbatim, and fails closed
ok - fm-brief.sh: --base-branch records the base, targets the PR at it, and is refused where no PR carries it
ok - fm-brief.sh: --branch-prefix omitted defaults every ship mode to fm/<task-id>
ok - fm-brief.sh: a --branch-prefix override renders identically across every generated section
ok - fm-brief.sh: an empty --branch-prefix override resolves to a bare <task-id> branch
ok - fm-brief.sh: --branch-prefix is refused on scout and secondmate scaffolds
ok - fm-brief.sh: --branch-prefix value is validated against embedded spaces and a leading dash
Switched to a new branch '$(touch${IFS}/tmp/fm-brief.qjAKPr/branch-prefix-shell-safe-marker)brief-branch-safe-g3'
ok - fm-brief.sh: ref-format-valid shell metacharacters stay literal in generated branch commands
ok - fm-brief.sh: every crewmate scaffold forbids administering the shared worktree pool
exit=0 elapsed=24s
Evidence: tests/fm-control-relaunch.test.sh output (rerun with real interpreter dirs on PATH)

Source: tests/fm-control-relaunch.test.sh output (rerun with real interpreter dirs on PATH)

real dirs: ~/.local/share/mise/installs/python/3.12.14/bin ~/.local/share/mise/installs/node/22.23.1/bin
ok - fm-spawn --relaunch: tracked opencode wiring is retired as on main
ok - fm-control removes the dialog file after exit and after relaunch
ok - fm-control exit removes the dialog file before it releases the control lock
ok - fm-control relaunch: a same-harness relaunch replaces the agent in the same endpoint and worktree
ok - fm-control relaunch: pending composer text refuses before the exit command is typed
ok - fm-control relaunch: an unreadable composer fails safe before the exit command is typed
ok - fm-control relaunch: a linked spawning home preserves committed and unfinished work in the recorded copy
ok - fm-control relaunch: durable task metadata survives replacement launch publication
ok - fm-control relaunch: delivery and concurrent task metadata publication serialize
ok - fm-control relaunch: disabling tracing clears metadata and pane context
ok - fm-control relaunch: progress and the Firstmate-worktree worker identity reach the replacement
ok - fm-control relaunch: the progress note's inbox listing is silent on an empty inbox
ok - fm-control relaunch: a replacement worker does not inherit its predecessor's read receipts
ok - fm-control relaunch: a ship task refuses without the progress note its replacement needs
ok - fm-control relaunch: switching harness is one ordinary relaunch, and the old wiring goes with the old agent
ok - fm-control relaunch: a refused relaunch onto polytoken keeps the project's own hook layer and the running agent
ok - fm-control relaunch: a refused polytoken profile leaves the running agent untouched
ok - fm-spawn --relaunch: retiring a raw polytoken launch's wiring keeps the project's own layers
ok - fm-control relaunch: a harness switch resets model and effort unless they are named too
ok - fm-control relaunch: a prefixed recorded harness can switch adapters transactionally
ok - fm-control relaunch: a prefixed command requires an explicit replacement harness
ok - fm-control relaunch: a same-harness relaunch keeps the profile axes it was running with
ok - native Ultra relaunch preserves its profile and rejects an unsupported model before stopping
ok - fm-control relaunch: a signed-out worker account pin refuses before the old agent stops
ok - fm-control relaunch: the replacement follows the home's current worker account pin
ok - fm-control relaunch: mate pins are re-read for Claude and Pi, and unusable pins refuse before stopping the agent
ok - fm-control relaunch: a Pi replacement keeps the home's tool exclusions
ok - fm-control relaunch: exclusion-list refusals happen before the running agent stops
ok - fm-control relaunch: explicit model and effort win over the recorded ones
ok - fm-control relaunch: refuses to relaunch onto an adapter with no verified mechanics
ok - fm-control relaunch: the retired incarnation's global turn-end token is revoked
ok - fm-control relaunch: wiring cleanup failure refuses replacement arming
ok - fm-control-lib: one owner resolves each harness's turn-end registry entry, and refuses a malformed token
ok - fm-control relaunch: a secondmate relaunch re-resolves its durable configured harness pin
ok - fm-control relaunch: a claude secondmate keeps settings.local.json and retires the state settings file and the Stop pointer
ok - fm-control relaunch: a mate with a per-mate override line lands on that override, not the default pin
ok - fm-control relaunch: a mate with no override line still resolves the default pin
ok - fm-control relaunch: a legacy secondmate pin file still relaunches the mate onto its first line
ok - fm-control relaunch: an unparseable secondmate pin refuses before anything is stopped
ok - fm-control relaunch: invalid configured effort is ignored before stop
ok - fm-control relaunch: an adapter unverified for this task kind refuses before the agent is stopped
ok - fm-control relaunch: explicit secondmate harness resets unnamed profile axes
ok - fm-control relaunch: a ship task keeps its recorded harness instead of re-reading crew config
ok - fm-spawn --relaunch: with no explicit harness it reuses the task's recorded one, never the crew default
ok - fm-spawn --relaunch: a promoted scout with a recorded custom branch relaunches on it instead of being refused
ok - fm-promote/fm-spawn --relaunch: the current ship contract supersedes stale scout delivery text
ok - fm-spawn --relaunch: wiring armed under a prefixed harness name is still retired
ok - fm-spawn --relaunch: switching away from muse retires its session binding
ok - fm-spawn --relaunch: switching away from cursor retires its session binding
ok - fm-control relaunch: an unaccountable local copy refuses before the agent is touched
ok - fm-control relaunch: a worker with nothing to work from is never launched
ok - fm-control relaunch: a refusal before the agent is stopped leaves the durable record untouched
ok - fm-control relaunch: checkpoint inspection failures refuse before stopping
ok - fm-control relaunch: a launch failure after the stop keeps the prior record and reports the real state
ok - fm-control relaunch: unpublished rollback keeps concurrent durable metadata
ok - fm-control relaunch: post-publication failure keeps the new durable record
ok - fm-control relaunch: partial stop reconciles actual agent state
ok - fm-control relaunch: failed journal replacement preserves durable phase
ok - fm-spawn relaunch: prepublication abort removes replacement state
ok - fm-control relaunch: the checkpoint records the exact unlanded work it preserved
ok - fm-control relaunch: a secondmate's child work is accounted for and its charter is left alone
ok - fm-control relaunch: a secondmate home that is not this secondmate's is refused
ok - fm-control relaunch: unreadable child records fail checkpoint
ok - fm-control relaunch: unlistable state fails checkpoint
ok - fm-control relaunch: a vanished watcher scratch file does not fail the child-record checkpoint
ok - fm-control relaunch: two control actions on one task serialize instead of interleaving
ok - fm-spawn relaunch: direct entry participates in lifecycle serialization
ok - fm-promote: promotion participates in lifecycle serialization
ok - fm-spawn --relaunch: refuses to launch a second agent into a live endpoint
ok - fm-spawn --relaunch: symlinked records refuse before inspection
ok - fm-spawn --relaunch: keeps its early meta lock continuous
ok - fm-spawn --relaunch: pending closes refuse before replacement begins
ok - fm-spawn --relaunch: every identity axis comes from the record, and a contradicting flag refuses
ok - fm-spawn --relaunch: an unrecorded task is refused
ok - fm-spawn --relaunch: refuses to start a replacement outside the copy holding its work
ok - tmux: a window absent from its session refuses both verbs rather than being assumed gone
ok - tmux: an unfindable session refuses both verbs, so a live agent is never duplicated
ok - tmux: a dead server on this socket refuses both verbs rather than proving absence
ok - reclaim: an unclassifiable endpoint is still refused, so two agents cannot share one
ok - fm-spawn --relaunch: resumes the bound Pi session only for a Pi registration
ok - reclaim: a herdr pane that outlived its stopped server is adopted, never orphaned beside a new tab
ok - fm-control exit: a herdr pane that outlived its stopped server is already-stopped, not gone
ok - reclaim: a herdr rebind is created in the session the record names, never the ambient one
ok - reclaim: a herdr agent that came back with its server refuses, so one worktree keeps one agent
ok - reclaim: a herdr reclaim rebinds the endpoint and leaves the whole rest of the task alone
ok - reclaim: a herdr secondmate whose endpoint is gone is sent to its own respawn owner
ok - reclaim: a rebind refused from a plain shell reports the real cause, not a fabricated session mismatch
ok - relaunch re-reads the backlog item instead of blindly re-running the transition
ok - relaunch heals an item that drifted out of In flight while the task stayed live
ok - away supervision relaunches existing In-flight and queued items under the saturated fresh-spawn spend cap
exit=0 elapsed=253s
Evidence: tests/fm-remote-secondmate-lifecycle-e2e.test.sh output (new receipt check passes; later pre-existing declined failure)

Source: tests/fm-remote-secondmate-lifecycle-e2e.test.sh output (new receipt check passes; later pre-existing declined failure)

ok - overlapping remote home provisioning serializes through publication and rollback
ok - competing cleanup of the public home cannot reach a live provisioning clone
ok - a home that appears mid-provision makes the provision die without touching it
ok - remote seed rollback preserves serialized competing routes
ok - unknown readiness preserves its route and brief for reconciliation
ok - remote seeding checks, repairs, and re-checks readiness, then stops on a remaining gap
ok - remote seeding proceeds once the repair closes every gap
ok - remote seeding provisions a supplied origin without touching the primary project tree
ok - remote provisioning re-validates a supplied origin at the receiving host
ok - seeding carries bitbucket, self-hosted, and scp-like origins through to the remote clone
ok - remote charter's read-receipt command runs the remote code root's script against the host-local inbox
ok - remote seed registers the route and provisions the whole home and project clone on that host
ok - remote inheritance rejects incomplete and superseded payload generations
ok - mixed local and remote routes validate without migration
ok - remote spawn launches on the remote-local backend and records a host-qualified route
ok - legacy and mismatched remote endpoints fail closed before backend access
ok - non-herdr remote endpoints are refused without changing either route
not ok - remote spawn never reached its blocked inheritance write
rm: cannot remove '/tmp/fm-remote-secondmate-e2e.CP75aU/remote-home/state/parent-route/ios.git-hooks/sendemail-validate': Permission denied
rm: cannot remove '/tmp/fm-remote-secondmate-e2e.CP75aU/remote-home/state/parent-route/ios.git-hooks/pre-auto-gc': Permission denied
rm: cannot remove '/tmp/fm-remote-secondmate-e2e.CP75aU/remote-home/state/parent-route/ios.git-hooks/post-rewrite': Permission denied
rm: cannot remove '/tmp/fm-remote-secondmate-e2e.CP75aU/remote-home/state/parent-route/ios.git-hooks/pre-push': Permission denied
rm: cannot remove '/tmp/fm-remote-secondmate-e2e.CP75aU/remote-home/state/parent-route/ios.git-hooks/post-merge': Permission denied
rm: cannot remove '/tmp/fm-remote-secondmate-e2e.CP75aU/remote-home/state/parent-route/ios.git-hooks/post-checkout': Permission denied
rm: cannot remove '/tmp/fm-remote-secondmate-e2e.CP75aU/remote-home/state/parent-route/ios.git-hooks/pre-rebase': Permission denied
rm: cannot remove '/tmp/fm-remote-secondmate-e2e.CP75aU/remote-home/state/parent-route/ios.git-hooks/post-commit': Permission denied
rm: cannot remove '/tmp/fm-remote-secondmate-e2e.CP75aU/remote-home/state/parent-route/ios.git-hooks/prepare-commit-msg': Permission denied
rm: cannot remove '/tmp/fm-remote-secondmate-e2e.CP75aU/remote-home/state/parent-route/ios.git-hooks/pre-merge-commit': Permission denied
rm: cannot remove '/tmp/fm-remote-secondmate-e2e.CP75aU/remote-home/state/parent-route/ios.git-hooks/pre-commit': Permission denied
rm: cannot remove '/tmp/fm-remote-secondmate-e2e.CP75aU/remote-home/state/parent-route/ios.git-hooks/post-applypatch': Permission denied
rm: cannot remove '/tmp/fm-remote-secondmate-e2e.CP75aU/remote-home/state/parent-route/ios.git-hooks/pre-applypatch': Permission denied
rm: cannot remove '/tmp/fm-remote-secondmate-e2e.CP75aU/remote-home/state/parent-route/ios.git-hooks/applypatch-msg': Permission denied
rm: cannot remove '/tmp/fm-remote-secondmate-e2e.CP75aU/remote-home/state/parent-route/ios.git-hooks/commit-msg': Permission denied
exit=1 elapsed=256s
Evidence: Stuck-busy wake text for an unread steer vs silence for a read steer (default busy max 2)
\### A. never-read steer on a continuously busy worker
poll 1 (busy) busy-state=001.msg,1 wake-queue=0
poll 2 (busy) busy-state=001.msg,2 wake-queue=1
stale: sess:fm-t1 (unread firstmate instruction: stuck-busy after 2 consecutive busy-deferred due doorbells; .../t1.inbox/001.msg stays unhandled and no doorbell was typed; inspect the worker)

\### B. worker records the read, then stays busy
poll 1 (busy, unread) busy-state=001.msg,1 wake-queue=0
receipt recorded: 001.msg
poll 2..6 (busy, read) busy-state=none wake-queue=0 typed=no record-in-root=001.msg
poll 7 (idle, read) busy-state=none wake-queue=0 typed=no record-in-root=001.msg

\### C. never-read successor still escalates
poll 9 (busy) busy-state=002.msg,2 wake-queue=1 (names 002.msg)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

🔧 **Rebase** - 4 issues found → auto-fixed ✅
  • ⚠️ bin/fm-task-inbox-lib.sh - merge conflict rebasing onto origin/main
  • ⚠️ bin/fm-watch.sh - merge conflict rebasing onto origin/main
  • ⚠️ docs/architecture.md - merge conflict rebasing onto origin/main
  • ⚠️ docs/configuration.md - merge conflict rebasing onto origin/main

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

⚠️ **Review** - 1 info
  • ℹ️ bin/fm-task-inbox-read.sh:21 - The worker-run receipt command sources the whole inbox library, which in turn sources bin/fm-wake-lib.sh and bin/fm-backend.sh. fm-wake-lib.sh runs mkdir -p &#34;$STATE&#34; at source time, with STATE defaulting to $FM_HOME/state and FM_HOME defaulting to the code root. Crew and scout launches do not export FM_HOME (only the secondmate launch at bin/fm-spawn.sh:6868 does, and the env-allowlist floor at bin/fm-spawn.sh:7055 omits it), so a crewmate's receipt run creates &lt;code-root&gt;/state/ as a side effect, and on a read-only code root the command fails and the brief's file-tool fallback takes over. state/ is gitignored, fm_task_inbox_record_read itself needs neither sourced library, and the fallback keeps the receipt reachable, so this is a wart rather than a defect. No action required for this change; noted so a future caller of the receipt script from a worker environment knows the dependency chain it inherits.
✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 12 of 13 scenarios driven live against the product
Scenario Result Live Evidence
Busy worker records a read of a long-running steer and is not escalated: the watcher's busy budget resets, no stale wake is queued, no doorbell is typed, and the record stays in the inbox root until t… ✅ pass live watcher-default-threshold-drive.log section B (polls 2-7, busy-state=none, wake-queue=0, record-in-root=001.msg); tests/fm-task-inbox.test.sh 'read work survives restarts without unread alarms'
A never-read steer on a continuously busy worker still raises the stuck-busy stale wake at the default budget of 2 consecutive busy polls, exactly once ✅ pass live watcher-default-threshold-drive.log section A (poll 2 queues 'stale: ... stuck-busy after 2 consecutive busy-deferred due doorbells; .../001.msg stays unhandled'; poll 3 adds nothing)
A never-read successor message arriving while a read steer is still being worked escalates by its own name and does not inherit silence ✅ pass live watcher-default-threshold-drive.log section C (wake names 002.msg after two busy polls)
Adversarial: removing the receipt of a message the worker never finished brings the stuck-busy alarm back ✅ pass live watcher-default-threshold-drive.log section D (busy-state restarts at 001.msg,1 and escalates on poll 11)
A read receipt arriving during the watcher's own due check prevents escalation ✅ pass live fm-task-inbox.log: 'ok - watcher: a read receipt arriving during the due check prevents unread escalation'
A read receipt silences a spent doorbell ring ladder and an owed fire-and-forget retry ring ✅ pass live fm-task-inbox.log: 'ok - inbox: read receipts silence spent delivery budgets and owed retry rings'
Adversarial: receipts for a missing record, a non-record name, a non-inbox directory, or an unwritable .read/ entry fail with a non-zero exit and do not suppress unread detection ✅ pass live brief-receipt-drive.log adversarial section (exit 1 for missing 009.msg and ../x.msg, exit 2 with no argument); fm-task-inbox.log 'missing, invalid, and unwritable read receipts fail without suppressi…
Dead worker pane: an unread record escalates with the agent-exited reason, while a read record does not raise the unread-instruction wake ✅ pass live watcher-dead-pane-drive.log (unread: 1 wake 'agent has exited or its endpoint is missing'; read: 0 wakes)
Relaunch: a replacement worker does not inherit its predecessor's receipts, so the surviving steer is rung again ✅ pass live fm-control-relaunch.log: 'ok - fm-control relaunch: a replacement worker does not inherit its predecessor's read receipts' (real fm-control.sh relaunch through fm-spawn.sh with the stubbed tmux sessio…
Generated brief tells the worker to record the read before acting, and its receipt command, literal unquoted file-tool fallback path, and handled move all work when run verbatim against a real inbox r… ✅ pass live brief-receipt-drive.log (brief text rendered; receipt command exit 0 creates .read/001.msg and due_action turns from 'ring' to 'quiet'; mkdir/touch at the literal fallback path quiets 002.msg; mv to h…
Remote secondmate charter rewrites the receipt command to the remote code root so it runs against the host-local inbox ✅ pass live fm-remote-secondmate-lifecycle-e2e.log line 11: 'ok - remote charter's read-receipt command runs the remote code root's script against the host-local inbox'
Default alarm thresholds are unchanged (grace 90s, ring max 3, busy max 2) ✅ pass live brief-receipt-drive.log and watcher-default-threshold-drive.log header: 'grace=90 ring_max=3 busy_max=2' with no FM_TASK_INBOX_* in the environment
A real Claude worker launched from the brief reads a steer and runs the receipt command on its own ⏸️ untested no Not driven. This would need a real claude worker spawned in a disposable lab home and a model turn interpreting the brief; the previous test round was cut at the 30-minute budget attempting long liv…
  • bash tests/fm-task-inbox.test.sh (51 ok, exit 0, 92s; real fm-watch.sh subprocess with fake tmux pane)
  • bash tests/fm-brief.test.sh (exit 0, 24s)
  • PATH=&lt;mise python3 dir&gt;:&lt;mise node dir&gt;:$PATH bash tests/fm-control-relaunch.test.sh (90 ok, exit 0, 253s; first run without the PATH fix failed on the mise shim trust error, not the product)
  • bash tests/fm-remote-secondmate-lifecycle-e2e.test.sh (17 ok, then the pre-existing declined failure 'remote spawn never reached its blocked inheritance write'; its new read-receipt check passed)
  • watcher-default-threshold-drive.sh: real inbox_steer_check from bin/fm-watch.sh with no FM_TASK_INBOX_* overrides, unread vs read vs successor vs deleted-receipt timelines
  • watcher-dead-pane-drive.sh: dead pane (pane_current_command=zsh) with unread vs read record
  • brief-receipt-drive.sh: bin/fm-brief.sh ship demo-project --mode no-mistakes in a disposable FM_HOME, then the brief's receipt command, file-tool fallback path, and handled move run verbatim against fm_task_inbox_write records; bin/fm-task-inbox-read.sh rejections for missing record, non-inbox directory, no argument; --help
  • Default thresholds read through the library: grace=90 ring_max=3 busy_max=2
  • git status --short --ignored clean after all drives
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @tiago-peixoto for this, and for the live labs. The base-commit repro of #7280 next to the fixed run is exactly the evidence that helps here.

Checked head bf2932fe against main 11990a20: the body says Fixes #7280, and the diff does what #7280 asked for. A worker records an empty read receipt (<task>.inbox/.read/NNN.msg, via the new bin/fm-task-inbox-read.sh) right after reading a steer. Read messages then no longer count toward the busy budget and no longer raise the "unread firstmate instruction" alarms. A message that was never read still escalates as before, and the defaults (FM_TASK_INBOX_BUSY_MAX, grace) are unchanged. Every launch clears old receipts, so a replacement worker is covered again. Live validation is present (5 of 7 scenarios run live; the remote-host and invalid-receipt cases are covered by tests only).

Contract-class: restore. This is my own read, not the PR's "opt-in" label. The worker brief gets a new step, so it is not opt-in. It restores the stated meaning of an existing default alarm ("unread … stays unhandled"), and it only stops that alarm for a message the worker has provably read. That matches the bar set on #7280. Note for reviewers: the receipt also takes a read message out of the idle-pane ladder and out of the dead-endpoint "unread" escalation. That is consistent with "unread", but those two paths are not covered by the live runs.

VISION.md: One captain: aligns (removes a false recovery turn per long steer). Authority: aligns (no new grant; the worker still has to move the message to handled/). Scripts own mechanics: aligns (receipt and policy live in fm-task-inbox-lib.sh). Restart is a non-event: aligns (durable receipts, cleared on relaunch). Delegation with a spine: aligns (a never-read steer still escalates). Outlives any vendor: aligns (same brief for every harness, plus the Polytoken prompt and remote seed). Scope: aligns.

Status: waiting on CI, nothing needed from you right now. The only red was Behavior portable serial 2, cancelled at the 30-minute ceiling (known infra issue, #7255). I've re-run it once. Everything else is green, including no-mistakes. The PR is MERGEABLE.

@tiago-peixoto
tiago-peixoto force-pushed the fm/upstream-7280-inbox-read-ack branch from bf2932f to ad31aa0 Compare October 18, 2026 15:17
@tiago-peixoto tiago-peixoto changed the title fix(bin): stop unread-steer alarm once a busy worker has read the message fix(bin): stop unread-steer alarms once a worker records reading the message Oct 18, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate (OSS triage): thanks @tiago-peixoto for rebasing onto current main and re-raising through no-mistakes.

Re-checked head ad31aa08 against main 45dd50a5 (0 behind, merges cleanly; attestation matches this head, live validation go 4 of 7). Since the head I reviewed last time (bf2932fe), the change is the rebase plus safer inbox listing in the brief and relaunch note (find … | sort -V, quoted path, so an empty inbox is silent) and the home-layout skill line. That keeps the #7280 bar: an explicit read receipt stops the alarm only for a message the worker has read, defaults (FM_TASK_INBOX_BUSY_MAX, grace) are unchanged, and a never-read message still escalates.

Contract-class (my own read): restore. VISION.md: all seven sections align (no captain-facing surface; refusal path kept for never-read steers; script mechanics; durable per-message receipts; no vendor coupling).

CI: everything is green except Behavior portable serial 5, which failed in tests/fm-remote-secondmate-lifecycle-e2e.test.sh at "the watcher did not exit on its auto-relaunch wake within the bound". That same failure has shown up on several unrelated PRs, so it looks like a timing flake rather than this change. I re-ran the failed job once. Waiting on that re-run; nothing needed from you right now.

@tiago-peixoto tiago-peixoto changed the title fix(bin): stop unread-steer alarms once a worker records reading the message fix(bin): stop unread-instruction alarms for steering messages the worker has read Oct 22, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @tiago-peixoto for merging main in again and re-raising through no-mistakes. I re-read head d7bf037d against main df9eb03a. The attestation matches this head, and live validation passed 8 of 10, including a real Claude worker writing the receipt while the watcher stayed quiet. That's strong evidence.

What changed since my 10-18 look (ad31aa08): a merge of main plus a docs commit lining up the inbox ladder docs with read receipts. The mechanism is the same.

A correction on contract-class (my mistake earlier): new-default, not restore. I'm sorry for the back-and-forth. I called this restore on 10-17 and 10-18 because it keeps the meaning of the "unread" alarm. On a closer tip-vs-main read, it changes the default path for every unconfigured home:

  • every generated brief, the doorbell line, the relaunch note, the Polytoken prompt and AGENTS.md gain a new mandatory worker step (bin/fm-task-inbox-read.sh)
  • a receipt now takes a message out of three default escalations: stuck-busy, the idle-pane re-ring ladder, and the dead-endpoint "unread" wake. On main, the documented reset was only a non-busy check or the handled/ move.
  • spawn gains a new refusal if it can't clear old receipts

All of that is well-motivated, but it's new unconfigured behavior, not a broken default being restored. So once it's otherwise ready, Kun makes the merge-or-leave call himself.

VISION.md (per rule): one captain aligns (removes a false recovery turn per long steer) · authority aligns (no new grant; a never-read steer still escalates) · scripts aligns (receipt and policy live in fm-task-inbox-lib.sh) · restart aligns (durable receipts, cleared on relaunch) · delegation aligns, with the caveat below · vendor: cannot tell yet (see below) · scope aligns.

One thing needed from you before this is ready: no-mistakes' Document step flagged that Rovo's bash tool is confined to the worktree (docs/verification/rovo.md). That means a Rovo crewmate likely can't run fm-task-inbox-read.sh. The brief would then make it report a failure on every steer, and the ladder would keep ringing as before. That warning is still open on this head. Could you either give the brief a file-tool fallback (the receipt is just an empty .read/NNN.msg) or add a live Rovo run showing the receipt path works, then re-raise via git push no-mistakes? The remote-host receipt path is still untested live too. A short live run there would help, but it's not a blocker.

CI: everything was green except Behavior portable serial 2, cancelled at the 30-minute ceiling (known #7255). I've re-run it once.

Status: waiting on you for the Rovo point. After that, plus green CI, this goes to Kun as a new-default decision.

@tiago-peixoto
tiago-peixoto force-pushed the fm/upstream-7280-inbox-read-ack branch from d7bf037 to 89d2ebd Compare October 22, 2026 15:09
@tiago-peixoto tiago-peixoto changed the title fix(bin): stop unread-instruction alarms for steering messages the worker has read feat(bin): add steering-inbox read receipts so read messages stop unread alarms Oct 22, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @tiago-peixoto. The file-tool fallback is exactly what I asked for on the Rovo point, and the review round's follow-up was a good catch: the fallback sentence now hands file tools an unquoted literal path ($STATE/$ID.inbox/.read/NNN.msg), while the shell commands keep the quoted form. The worker reports a read-acknowledgement failure only if both routes fail. Thanks too for saying plainly that the fallback isn't live-verified on Rovo. That's fine, since the receipt is just an empty file and Rovo's file tools are already recorded as working.

Re-checked head 89d2ebdc against main d906d442: the delta since d7bf037d is the fallback (fm-brief.sh, fm-task-inbox-lib.sh), its quoting fix, and doc alignment. The receipt mechanism is unchanged, and a never-read steer still escalates at the default budget. There are no .github changes and nothing touching network or credentials. The attestation matches this head, live validation is go (9 of 11; relaunch-clear and the remote charter rewrite are covered by the suites only), CI is fully green, and GitHub reports it CLEAN.

Contract-class (my own read): new-default, unchanged from 10-22. Every unconfigured home's briefs gain a mandatory receipt step, and a receipt takes a message out of three default escalations. VISION.md per rule: One captain aligns · Authority aligns (no new grant; never-read steers still escalate) · Scripts aligns · Restart aligns (durable receipts, cleared on relaunch) · Delegation aligns · Vendor now aligns (file-tool fallback for harnesses confined to the worktree) · Scope aligns.

Status: with Kun, not waiting on you. Because this changes the default path, the merge-or-leave call is Kun's. Nothing more is needed from you unless he asks.

@tiago-peixoto
tiago-peixoto force-pushed the fm/upstream-7280-inbox-read-ack branch from 89d2ebd to 9297018 Compare October 24, 2026 02:57
@tiago-peixoto tiago-peixoto changed the title feat(bin): add steering-inbox read receipts so read messages stop unread alarms fix(bin): distinguish read steering messages from unfinished work Oct 24, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @tiago-peixoto for bringing this up to current main.

I compared the new head 92970183 against the 89d2ebdc I reviewed on 10-22. The only differences come from resolving the rebase against main d22640f4. The brief and doc lines now carry main's newer "read the complete contents of each record" wording alongside your receipt and file-tool fallback changes. The receipt mechanism and the never-read escalation are unchanged, and there's no new workflow, network or credential surface. The attestation binds this head, live validation is go (9 of 10), all 19 checks are green, and GitHub reports CLEAN.

Contract-class (my own read, unchanged): new-default. Every unconfigured home's briefs gain a mandatory receipt step. VISION.md per rule: every rule still aligns, as on 10-22.

Status: standing captain-decision hold, with Kun, not waiting on you. Nothing more is needed from you unless he asks.

@tiago-peixoto
tiago-peixoto force-pushed the fm/upstream-7280-inbox-read-ack branch from 9297018 to 9ad47ec Compare October 24, 2026 06:57
@tiago-peixoto tiago-peixoto changed the title fix(bin): distinguish read steering messages from unfinished work feat(bin): record steering-inbox read receipts separately from completed handling Oct 24, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @tiago-peixoto. I compared the new head 9ad47ec2 with the flagged head 92970183. It's a rebase onto main 29c3e867, where the only changes are the conflict-resolution context in bin/fm-test-run.sh and the bin/fm-spawn.sh source lines. There's also one new docs-only commit that limits the rovo live-grant claim to the completed-handling half and says plainly that the .read/ receipt fallback hasn't been run live. That's a good honesty fix. The receipt mechanism is unchanged, and there's no new workflow, network or credential surface. The attestation binds 9ad47ec2.

CI: 18 of 19 checks are green. Behavior portable serial 1 hit the 30-minute cap cancel that main also hits, so I've rerun it (run 40072244986).

Contract-class (my own read, unchanged): new-default. VISION.md aligns on every rule, as before.

Status: standing captain-decision hold, with Kun, not waiting on you.

@tiago-peixoto
tiago-peixoto force-pushed the fm/upstream-7280-inbox-read-ack branch from 9ad47ec to 01bba08 Compare October 24, 2026 16:38
@tiago-peixoto tiago-peixoto changed the title feat(bin): record steering-inbox read receipts separately from completed handling feat(bin): add steering-inbox read receipts so read steers stop unread alarms Oct 24, 2026
…ex must not keep an abandoned claim unrecoverable` in tests/fm-claude-stop-autoarm.test.sh has a racy fixture, not a product defect, and nothing in this PR's diff reaches it (the PR touches no file the fixture copies; the same case passed on this branch's five earlier CI runs and the one failing main run today failed a different case). Mechanism: the fixture starts a holder that runs fm_lock_try_create on the steal mutex, polls for the owner's pid file, then SIGKILLs the holder. But fm_lock_prepare_owner writes the pid before the symlink appears, and fm_lock_claim then rewrites the same pid file with a truncating redirect right after the link appears. A KILL that lands between truncate and write leaves an empty pid file. fm_lock_mid_acquire_is_fresh treats a fresh pid-less lock as a mid-acquire claim for 2 s, so fm_lock_reap_dead_link refuses, fm_autoarm_release_abandoned fails, and the hook exits 0 instead of 2. Reproduced locally by constructing that end state: empty pid -> exit 0, no arm, mutex left (exactly the CI symptom); dead numeric pid -> exit 2. Invariant: a fixture must kill a lock holder only after the holder itself reports the claim complete, never on a side effect that appears mid-acquisition. Sibling site with the identical pattern: leave_dead_link_locks in tests/fm-watcher-lock.test.sh (polls the last lock's pid file, then KILLs); three of its four callers are exposed (the fourth pins a dead pid afterwards). Other holder fixtures in tests/fm-wake-queue.test.sh already use the correct ready-marker shape. Fix (tests only): in both fixtures the holder now creates a ready marker after fm_lock_try_create returns; the test waits for that marker (up to ~5 s, matching the watcher-lock file's existing child-startup bound), fails explicitly if the holder never claims, kills, then removes the marker. Removed the now-unused `last` variable in the watcher-lock helper. Comments explain the ordering hazard. Verification: bin/fm-lint.sh on both files passes (full ShellCheck extended analysis, rc=0). bash tests/fm-claude-stop-autoarm.test.sh passes (63 ok, rc=0) and bash tests/fm-watcher-lock.test.sh passes (42 ok, rc=0), both including the dead-steal reclaim cases. A 60-iteration CPU-loaded stress of the original fixture was started but I stopped it before completion, so it provided no evidence either way; the mechanism rests on the code trace plus the end-state reproduction. Not addressed: the separate ci-2 cancelled-without-verdict check (Behavior portable serial 1) was left unselected and needs a human decision
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @tiago-peixoto for the new push. Short update for the head change.

I compared ff43e3ca with 9ad47ec2, the head I last reviewed. The ten earlier commits are the same series rebased onto main d96bff00. Where they changed, it's only conflict context in comments and docs. Two commits are new:

  • 01bba081: comment and doc wording only (bin/fm-brief.sh header, bin/fm-task-inbox-lib.sh: "unhandled" → "unread").
  • ff43e3ca: test fixtures only. The steal-mutex holder in tests/fm-claude-stop-autoarm.test.sh and leave_dead_link_locks in tests/fm-watcher-lock.test.sh now wait for a ready marker before the KILL. No product code changes.

CI on ff43e3ca (run 40116179824): 18 of 19 checks are green, and PR must be raised via no-mistakes passes on this head. The one red, Behavior portable serial 1, was cancelled at the 30-minute cap (17:27Z → 17:57Z). That's the main-wide limit #7706 addresses, not this PR, so I re-ran just that job.

Contract-class: new-default (unchanged). VISION: unchanged, every rule aligns.

Status: still a standing captain-decision hold. This isn't waiting on you. Kun decides whether it lands, and this update doesn't change that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Watcher raises "stuck-busy, message stays unhandled" while the worker is actively acting on that message

2 participants