Skip to content

fix: recover stalled fleet work and preserve tool interaction - #6

Closed
kesslerio wants to merge 263 commits into
mainfrom
fix/pi-sdk-supervision-integration
Closed

kesslerio wants to merge 263 commits into
mainfrom
fix/pi-sdk-supervision-integration

Conversation

@kesslerio

@kesslerio kesslerio commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

Related: kesslerio/pi#1

TL;DR

Firstmate tracks actionable instructions until execution or an explicit wait, reconciles completed dependencies, and preserves tool content and interaction when Calm hides and restores rows.

What Problem This Solves

An instruction could be acknowledged while its worker stayed idle, leaving work outside retry supervision.
Completed dependencies could leave stale holds behind.
Tool visibility also needed to preserve input ownership, images, legacy custom entries and HTML exports.

Why This Change Was Made

Acknowledgment, execution and completion represent different states.
Durable obligations and dependency reconciliation make unfinished work visible, while generation and ownership checks constrain recovery and cleanup.
The integration consumes the companion Pi SDK's tested rendering behavior.
This release includes upstream history already present in the accepted candidate because this fork's default branch is older.

User Impact

Firstmate can recover work that has not started and reconsider tasks whose dependencies have completed.
Calm preserves keyboard and pointer ownership, tool content, images and restored legacy rows across visibility changes.

Risk and Rollout

High risk: this changes coordination across instruction queues, leases and process lifetimes. Earlier multi-specialist review covered the broad release, but the final Review inspected 30 paths and explicitly left 388 of 418 files unverified. No concrete defect remained in the inspected paths; this is not complete final-release review coverage.
Runtime rollout is separate and requires selecting the tested patched SDK explicitly; a Pi version number alone does not establish that capability.
These publication repairs have not been deployed.

Evidence

  • Original combined acceptance covered 31 compatibility, accounting and focused stages; retained evidence is reused only for unchanged executed inputs.
  • The frozen SDK passed its offline build, full check, focused regressions and unchanged test suite with both Durable retention configurations.
  • Exact-candidate SDK consumption passed tests/fm-pi-primary-types.test.sh and all 50 cases in tests/fm-pi-branch-extension.test.sh without skips.
  • Seven lifecycle groups passed their original assertions and limits, with independent review and separate process and socket cleanup checks.
  • Retained independent terminal and desktop/mobile interaction and screenshot review covered ten UI batches, 195 groups and 379 captures, plus targeted quiet/away coverage.
  • Five additional fresh UI batches passed 92 groups and captured 161 PNGs; independent review inspected the probe, 69 terminal captures and all 28 browser captures.
  • Both fresh browser batches proved normal shutdown and process cleanup; protected source, raw indices and captured Git controls remained unchanged.
  • CI remains in progress. The stock macOS Bash parse sweep failed in three test-script capture blocks; a minimal repair is under investigation. Required checks must pass before merge.
  • Screenshots are not attached because GitHub attachment-upload login was unavailable.

Published validation evidence: sanitized receipt, sanitized receipt.

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 3 issues found → auto-fixed (3) ✅
  • 🚨 bin/fm-startup-network.sh:410 - An actionable result loses automatic delivery when .wake-queue.lock or .watcher-down.lock outlives the delivery deadline: queue_result_wake fails here, but no retry packet is retained. After release, reconcile does nothing because pending_result requires that packet. Round 6's bounded publication repair and bf789cd's retention repair leave this sibling behind. Retain the original generation through the existing deferred-result mechanism on enqueue failure. Related sites: bin/fm-startup-network.sh:369-371 publication, :535-540 reconciliation; bin/fm-watch.sh:655-667 packet-only detection and :2852-2857 retry. tests/fm-startup-network.test.sh:1101-1103 starts a new stage instead of proving recovery of the original result.
  • 🚨 bin/fm-lab-launch.py:243 - The new guardian misses ordinary detached startup workers. fm-startup-network.sh:307-312 launches its worker in a separate process group; after the startup command exits, that worker reparents before down's first observation. It then belongs neither to recorded-root ancestry nor the guardian's group, allowing successful retirement and lab deletion while it remains alive. This is a sibling omission of 1a8ea30's launch-custody repair. Register detached launches through the existing custody mechanism before ancestry disappears. Related sites: bin/fm-live-lab.sh:619-641 discovery, :652-670 expansion, :878-883 checkpoint/shutdown and :958-961 deletion; bin/fm-supervision-host.sh:558/:790 and bin/fm-claude-stop-autoarm.sh:377 also create independently surviving successor groups.
  • ⚠️ bin/fm-afk-return.sh:527 - A merged task relaunched for follow-up retains its historical PR association and merge-notified marker. This scan consequently labels the working replacement as landed and recommends teardown. Rounds 4/5 repaired generation-aware handoffs in capacity/liveness but left this reporting sibling. Require fm_pr_current_handoff before accepting the merge marker. Related sites: bin/fm-afk-return.sh:528-531 selects the historical association and :664/:666 emits the teardown recommendation; bin/fm-spawn.sh:5090-5097 preserves historical PR fields.

🔧 Fix applied.
3 issues (2 errors, 1 warning) still open:

  • 🚨 bin/fm-lab-launch.py:243 - The new guardian misses ordinary detached startup workers. fm-startup-network.sh:307-312 launches its worker in a separate process group; after the startup command exits, that worker reparents before down's first observation. It then belongs neither to recorded-root ancestry nor the guardian's group, allowing successful retirement and lab deletion while it remains alive. This is a sibling omission of 1a8ea30's launch-custody repair. Register detached launches through the existing custody mechanism before ancestry disappears. Related sites: bin/fm-live-lab.sh:619-641 discovery, :652-670 expansion, :878-883 checkpoint/shutdown and :958-961 deletion; bin/fm-supervision-host.sh:558/:790 and bin/fm-claude-stop-autoarm.sh:377 also create independently surviving successor groups.
  • ⚠️ bin/fm-lab-launch.py:186 - This run's first repair round introduces a launch-loss race: concurrent startup or successor launches share lock_root(), whose LOCK_NB acquisition immediately fails on ordinary contention. The losing startup helper exits without executing its command, while cmd_start records its PID and returns success. Use bounded acquisition at the shared launch boundary and preserve truthful startup failure reporting. Related sites: bin/fm-lab-launch.py:45 acquisition, :230 ordinary launch, :335 sealing; bin/fm-startup-network.sh:310/:314/:332 asynchronous success; bin/fm-supervision-host.sh:561/:565/:567 and bin/fm-claude-stop-autoarm.sh:369/:379 successor callers.
  • 🚨 tests/fm-live-lab.test.sh:888 - This run's first repair round leaves interruption cleanup incomplete in its new detached fixtures. After the startup command exits, its worker and guardian reparent outside the registered wrapper's ancestry. A TERM during the readiness wait reaches cleanup before capture_up_lab registers them; cleanup only walks registered ancestry, so it can report success and delete the fixture while the detached guardian runs indefinitely. Register lab custody before launching and recover its validated anchors during cleanup before stopping roots. Siblings: tests/fm-live-lab.test.sh:888–899 startup setup, :934–943 successor setup, and :37 ancestry-only cleanup; tests/lib.sh:881 owns that ancestry walk.

🔧 Fix applied.
3 issues (2 errors, 1 warning) still open:

  • 🚨 bin/fm-startup-network.sh:363 - The latest fix round (b533df1) can orphan admitted startup work. Probe worker A records worker_started=1 and starts bootstrap; a supported locked-start B replaces its generation before A's caller reads the acknowledgment. await_worker_start returns failure, and this branch terminates A's shell while its separately grouped bootstrap continues without cleanup. Preserve admitted execution custody instead of cancelling solely because acknowledgment was superseded or unreadable. Related sites: bin/fm-startup-network.sh:245-249 permits the upgrade, :255-265 rejects the acknowledgment, :624-634 publishes admission, and :703/:711 starts separately grouped operations.
  • 🚨 bin/fm-supervision-host.sh:456 - Cancellation before ENGINE_PID_FILE publication reads no target here and never checks again. Cleanup later kills only the engine poller, bypassing its descendant reaping. With the supported timeout/gtimeout fallback, the engine continues until TURN_TIMEOUT; Perl's owner-death handling also cannot reap recorded tool groups after their poller is killed. The retained arm-registration repair leaves this engine-launch sibling behind. Protect engine registration and retire its owned execution before stopping the cleanup owner. Related sites: bin/fm-supervision-host.sh:462-466 and :1067-1085; bin/fm-supervision-engine-lib.sh:390-403 launches before identity publication and :420 owns descendant reaping.
  • ⚠️ bin/fm-backend.sh:635 - The source-readability preflight omits fm-cursor-lib.sh from Herdr's dependencies. A missing or unreadable helper passes this check, then is sourced through bin/backends/herdr.sh:94 → bin/fm-agent-process-lib.sh:19 → bin/fm-session-lock-lib.sh:24, retaining the partial-deployment failure this preflight addresses. Add the dependency as the tmux sibling already does at bin/fm-backend.sh:632.

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

🔧 **Test** - 1 issue found → no changes applied (2) ✅
  • ⚠️ live validation verdict: inconclusive (6 of 7 scenarios were driven live against the product); untested: Consume the accepted frozen SDK and preserve reviewed UI and lab behavior.
  • Live validation: ⚠️ inconclusive - 6 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Acknowledge an actionable instruction without executing it: bounded observations retain the obligation, escalate once, and block cleanup. ✅ pass live Instruction CLI behavior
Execute the same instruction twice: only one execution occurs; stale generations are denied and concrete waits remain generation-bound. ✅ pass live Instruction CLI behavior
Complete a prerequisite, then release an explicit hold: approval remains required until release, and the old stop cannot consume newly eligible work. ✅ pass live Dependency and hold reconciliation
Supersede or obscure a startup acknowledgment: admitted workers retain custody and mutating sweeps remain single-flight. ✅ pass live startup-checks.txt; admission-custody test group
Cancel supervision during registration or execution: owned engine and tool processes retire while foreign and replacement identities remain protected. ✅ pass live Engine checks, including retained driver timeout; Owned-process cleanup readback
Load Herdr and tmux adapters with complete, missing, and unreadable cursor dependencies: incomplete deployments refuse before adapter loading. ✅ pass live Backend dependency preflight
Consume the accepted frozen SDK and preserve reviewed UI and lab behavior. ⏸️ untested no The prior payload did not establish a live result for this scenario: it recorded live=false and explicitly claimed no fresh UI or lab interaction. It reported passing exact-SDK branch checks, includin…
  • FM_PI_PACKAGE_DIR=<frozen-accepted-sdk> timeout -k 5s 120s bash tests/fm-pi-branch-extension.test.sh — exit 0, no skips.
  • FM_STARTUP_NETWORK_TEST_GROUP=admission-custody timeout -k 5s 100s bash tests/fm-startup-network.test.sh — exit 0.
  • FM_SUPERVISION_HOST_TEST_GROUP=engine-custody timeout -k 5s 120s bash tests/fm-supervision-host.test.sh — driver timeout retained; unfinished cases subsequently passed in a separate bounded selector.
  • Disposable public-CLI instruction, readiness, and backend preflight drivers; corrected setup errors before final verification.
  • Read retained acceptance receipts and matched their recorded source closure against the current worktree.
  • Checked captured owned process generations after exit, removed transient drivers and fixtures, and confirmed clean git status.

🔧 No changes applied.
1 warning still open:

  • ⚠️ live validation verdict: inconclusive (8 of 9 scenarios were driven live against the product); untested: Terminal and desktop/mobile UI behavior retains its independently reviewed interaction and screenshot acceptance
  • Live validation: ⚠️ inconclusive - 8 of 9 scenarios driven live against the product
Scenario Result Live Evidence
Acknowledged instructions remain pending until execution starts or a current concrete wait is recorded; stale dispositions are refused ✅ pass live instruction-cli.txt
Dependency completion preserves explicit holds, and releasing the hold exposes newly eligible work ✅ pass live ready-review-cli.txt
Superseded or unreadable startup acknowledgments preserve admitted workers without overlapping mutating sweeps ✅ pass live startup-checks.txt
Cancelling engine startup retires owned execution and descendants while preserving foreign or replacement identities ✅ pass live engine-checks.txt; cleanup-readback.json
Herdr and tmux accept complete dependencies and reject missing or unreadable cursor helpers before adapter effects ✅ pass live backend-preflight.txt
Disposable labs launch and retire owned processes while stale, unknown, malformed and replayed cleanup requests fail closed ✅ pass live Exact-candidate product execution and evidence verification
Detached startup and successor launches survive caller exit, handle contention truthfully and clean up after readiness interruption ✅ pass live Exact-candidate product execution and evidence verification
The frozen SDK renders ToolExecutionComponent, preserves stock Calm-off HTML export and operates its installed picker ✅ pass live Exact-candidate product execution and evidence verification
Terminal and desktop/mobile UI behavior retains its independently reviewed interaction and screenshot acceptance ⏸️ untested no The prior payload records historical evidence reuse and unchanged UI inputs, but explicitly reports no fresh interaction or screenshots and live=false. It therefore did not establish a live result for…
  • Reviewed this active run’s baseline instruction, dependency-hold, startup, engine-cancellation and backend-preflight product transcripts.
  • Verified SHA-256 bindings for the acceptance packet and 167 underlying evidence files.
  • Compared all 698 exported source entries with current worktree bytes, modes and links.
  • Inspected seven completed live lab groups, raw product output, separate cleanup readbacks and independent runtime reviews.
  • Verified exact frozen-SDK branch and strict typecheck results, including actual installed renderer, HTML export and picker execution.
  • Rechecked 30 retained UI inputs and independent interaction/screenshot review applicability.
  • Created sanitized product-output evidence and confirmed the worktree remained clean.

🔧 No changes applied.
✅ Re-checked - no issues remain.

  • Live validation: ✅ go - 14 of 14 scenarios driven live against the product
Scenario Result Live Evidence
Acknowledged instructions remain outstanding until execution or a concrete disposition ✅ pass live instruction-cli.txt
Dependency completion preserves explicit holds; release makes work eligible ✅ pass live ready-review-cli.txt
Superseded or unreadable startup acknowledgments preserve admitted execution custody ✅ pass live startup-checks.txt
Engine cancellation retires owned execution while preserving foreign and stale identities ✅ pass live engine-checks.txt
Backend loading rejects missing or unreadable cursor dependencies before effects ✅ pass live backend-preflight.txt
Lab retirement rejects stale ownership and accepts the current guardian ✅ pass live SDK and lifecycle product observations
Malformed, replayed and UNKNOWN retirement requests retain evidence without unrelated signals ✅ pass live SDK and lifecycle product observations
Disposable lab readiness and shutdown enforce identity, trust and descendant custody ✅ pass live SDK and lifecycle product observations
Initial and default shells reach readiness with supervision enabled or disabled ✅ pass live SDK and lifecycle product observations
Forced late-child and mate cleanup failures retain failure evidence and retire captured resources ✅ pass live SDK and lifecycle product observations
Detached startup and successor workers retain custody after launcher exit and interruption ✅ pass live SDK and lifecycle product observations
Accepted frozen SDK renders hidden outcomes while preserving stock HTML and picker behavior ✅ pass live SDK and lifecycle product observations
Terminal users retain correct input ownership, hide/show behavior and Calm rendering ✅ pass live Fresh UI acceptance, sanitized
Desktop and mobile users expand exported output, view images and operate sidebar controls ✅ pass live Fresh UI acceptance, sanitized
  • git rev-parse HEAD HEAD^{tree} and git status --short confirmed the submitted candidate and clean worktree.
  • Rehashed all 698 current source entries against the executed UI manifest, including modes and symlink targets.
  • Verified acceptance packet SHA-256 bindings, 52 underlying UI evidence hashes and all 161 fresh capture hashes.
  • Checked five actual UI batch receipts and all 92 matrix entries for successful completion and cleanup.
  • Verified all seven lifecycle result/readback/review chains and both exact-SDK consumer evidence chains.
  • Reviewed prior Test CLI evidence for instruction obligations, dependency holds, startup custody, engine cancellation and backend preflight.
  • Recorded a sanitized verification receipt without repeating completed workloads.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

sdivanl and others added 30 commits September 21, 2026 19:30
…nchenguid#5174)

* fix: preserve Pi watcher ownership across session replacement

* no-mistakes(document): Scope Pi predecessor retention away from omp

* no-mistakes(ci): Diagnosed all three failing checks; only one was code-caused. (ci-3, genuine) Stock macOS Bash snapshot compatibility: `tests/fm-pi-watch-extension.test.sh` failed the macOS Bash 3.2 `bash -n` parse sweep with `line 4265: unexpected EOF while looking for matching '`. I built GNU Bash 3.2.0 from source locally and reproduced it. Root cause: the PR added a comment containing an apostrophe (`// Replacement shutdown deliberately retains module 2's established arm until`) inside a quoted here-document (`<<'EOF'`) nested inside a `$(...)` command substitution. Bash 3.2 has a parser bug (fixed in later bash) where an unmatched single quote inside such a here-doc body is treated as opening a shell quote and never closed, aborting the whole file parse. The base commit parses cleanly under Bash 3.2, confirming this PR introduced the break. Minimal fix: reworded the comment to remove the apostrophe (`... retains the established module-2 arm until`), preserving meaning. Verified `bin/fm-lint.sh --list-files` (the 6 changed shell files) now all pass `/tmp/bash-3.2/bash -n`; Bash 5 also parses. (ci-1, infrastructure) Behavior portable serial 8: GitHub API shows the `Run portable serial shard 8` step conclusion=success; only `Upload portable serial shard 8 timing artifact` failed with `Failed to FinalizeArtifact ... (403) Forbidden`. This is a transient artifact-service/cancellation failure, not a test or code failure. No change. (ci-2, infrastructure) Lint 1: fetched the job log via the GitHub API; it ends with `##[error]The runner has received a shutdown signal...` then exit 143. The step was cancelled mid-run, not a ShellCheck finding. Independently ran `bin/fm-lint.sh --partition 1of2 --telemetry ...` locally with pinned ShellCheck 0.11.0 and actionlint 1.7.12: exited rc=0 (no findings). No change. The only code change is the apostrophe removal in tests/fm-pi-watch-extension.test.sh; no other files modified
…d#5236)

* fix(bin): retire windowless leftovers and stop claiming a Pi daemon teardown

Catch-up correctly refuses while a leftover task record has no status file.
Cleanup used to deadlock on those same records when they also had no spawn_gen and no window, so they lingered and wedged every later away-mode return. Teardown now treats a windowless leftover as a missing-endpoint legacy record, and stop reports that no daemon terminal was running when none was launched.

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

* no-mistakes(review): Narrow windowless teardown exception to tmux legacy leftovers

* no-mistakes(review): Validate windowless leftover identity via shared endpoint validator

* no-mistakes(review): Refuse windowless leftovers carrying other backends' endpoint identity

* no-mistakes(document): Clarify windowless teardown retry documentation

---------

Co-authored-by: Cursor <[email protected]>
…rted (kunchenguid#5250)

* fix: surface parked launch prompts as not started

* no-mistakes(document): docs: record launch-prompt busy backstop classification

* no-mistakes(document): docs: align tail40 and rendered-text comments with launch-prompt backstop
* feat(afk): make /afk itself the go with a same-turn record write

Collapse the propose-then-confirm away entry into one 'enter' step that
writes state/.afk-contract immediately and prints the announcement and
read-back after the record exists, never asking for a go. The retired
propose, confirm, and --proposal inputs are refused by name, and a stale
proposal left by an older version is removed rather than promoted.
Refresh and replace semantics, verbatim words, the single writer, the
never-set, and per-harness launch behavior are unchanged.

* no-mistakes(document): Refresh away-entry documentation evidence
…nguid#5294)

* fix(bin): map passed-with-override to done instead of unknown

no-mistakes' axi status emits outcome: passed-with-override for a run
that finished with an explicitly approved Test or CI exception. Both
bin/fm-crew-state.sh's outcome resolver and bin/fm-teardown.sh's
pre-teardown terminal-run check only matched the literal passed and
checks-passed tokens, so this outcome fell through to unknown/parked
and a finished worker awaiting merge kept getting re-alerted as stale,
while an abort race during teardown could also leave a finished run
misreported as still parked.

Map passed-with-override to the same done/terminal handling as a
clean passed in both places.

* fix(document): Replace stale outcome mapping with authoritative pointer

* fix(ci): Fixed a pre-existing mock-clock race in tests/fm-contributions.test.sh by advancing time only during the serial issue read. Reproduced the exact CI failure before fixing it. Forced-race replay, all 38 contribution scenarios, scoped ShellCheck, Bash syntax, and diff checks pass. Only the test fixture changed; CI rerun remains with the outer executor
* fix: close landed workers from supervision in both postures and at return

During the 2026-09-22 away window every exemption worker whose pull request
had merged was left sitting for nine hours. The supervision branch received
the stale wake, the merge-landed check, and the hourly inactive-outcome row
for each of them, ran the recovery playbook, found nothing to recover, and
reported "no further action". The branch prompt granted ordinary teardown of
a confirmed-landed task without ever naming the moment or the command, and
the playbook has no landed exit, so the stale path ended at "nothing to
recover". The return brief then listed only blockers, decisions, and the
latest five routine outcomes, so the landed workers stayed invisible after
the captain came back.

- bin/fm-branch-prompt.sh: name the merge-landed wake, and any later stale,
  inactive-outcome, or heartbeat row on a done task with a merged PR, as the
  moment to claim the lease and run bin/fm-teardown.sh with no flags; a
  refusal is reported, never forced or worked around. Add teardown to the
  handling tool list.
- stuck-crewmate-recovery: a landed worker is not a recovery case; point at
  the ordinary teardown owner for each actor.
- bin/fm-afk-return.sh: render a "Landed, cleanup due" section from durable
  records only (a live task record whose recorded PR carries the
  merge-notification marker), between could-not-fix and handled, without
  holding the gate; the afk skill's return step closes each listed task
  through ordinary teardown once the check clears.
- tests: pin the prompt rule in fm-branch-supervision and the brief section
  in fm-afk-return through the real marker writer.

* no-mistakes(document): Document landed-task cleanup ownership
* fix(bin): surface a green no-mistakes PR still in ci merge monitoring

A green PR could sit unreported because neither the worker nor the
supervisor could observe checks-green while the ci step kept monitoring
for the merge.

Supervisor read: fm_nm_select_run's capped-overview inventory reader looked
the repository up by the task worktree path, but no-mistakes registers a
repository once by its main clone path and resolves every linked worktree
to it, so on every task copy of a busy repo the lookup matched no row and
each read reported "complete same-branch run inventory unreadable". Key the
lookup on the overview's own top-level `repo:` line, which every axi
release emits as the resolved working_path.

Even with a readable run, the ci-log classifier treated "base branch
advanced ..., re-arming CI monitor timeout" as not-ready. The monitor logs
a checks state only when it changes and a base advance does not clear
readiness, so a green PR read as still validating for as long as main kept
advancing. Stop treating that line as a marker, matching no-mistakes' own
ci-log parser, and name the run's PR URL in the held-for-merge reading so
the existing inactive-outcome path can act on it without a worker report.

Worker contract: `axi status` never reports checks-passed while the ci
step monitors for merge, so the definition of done no longer makes a
status poll the wait for the next gate or outcome; the drive call's own
return is the green signal, reattached with `no-mistakes axi run` after a
bounded return.

* no-mistakes(review): read the full ci log when checking checks-green

* no-mistakes(review): correct stale ci log tail wording in docs

* no-mistakes(document): Document checks-green supervisor fallback
* fix: derive Lavish polling server from its board session

* no-mistakes(document): Document session-derived Lavish polling

* no-mistakes(document): Correct Lavish routing verification claims
… vanish (kunchenguid#4900)

* fix(bin): ignore vanished state scratch files on secondmate relaunch

Relaunch refused when find(1) exited non-zero while listing a secondmate
home's state directory. A live watcher can delete scratch files between
readdir and processing, which is not evidence that child *.meta records
are unreadable.

Prove the directory is listable from its mode and keep the existing
readable-meta loop as the child-record guarantee. Fixes kunchenguid#4765.

* no-mistakes(review): Skip chmod-000 unlistable-state relaunch test when running as root
…d#4907)

* fix(bin): treat home-owned status closes as already read

Self-announced bookkeeping appends now record their exact byte ranges.
Later drains and signal scans skip those ranges, so two distinct
--resolve-key answers after an OPEN DECISIONS fold do not each wake the
supervisor. Worker-authored lines outside that ledger still signal.

* no-mistakes(review): Keep owned closes in unread status; lock ledger writes

* no-mistakes(review): Drop fold-lag wake suppression so folded worker decisions still wake

* no-mistakes(review): Require real owned growth before ledger marks status seen

* no-mistakes(document): Clarify home-appends ledger scope versus UNREAD STATUS

* no-mistakes(review): Restore fold-lag path, drop owned-range filters, fix test

* no-mistakes(review): Align ledger docs and scope ledger to wake path only

* no-mistakes(review): Restore stranded historical-annotation test comment to its function

* no-mistakes(review): Retire the home-appends lock alongside its ledger

* no-mistakes(document): Note ledger's lock-helper dependency in classify library

* no-mistakes(review): Append-and-coalesce home-appends ledger; fix stamped-line assertions

* no-mistakes(review): Drop redundant empty-span branch; make owned test pin ledger

* no-mistakes(document): Document covers' ascending-order dependency on home-appends ledger

* no-mistakes(document): Note owned-append skip in watcher signal-scan comment
…nguid#5350)

* chore(bin): raise tasks-axi, quota-axi, and lavish-axi floors to latest

Raise the minimum versions to tasks-axi 0.2.6, quota-axi 0.1.50, and
lavish-axi 0.1.77, pin CI's tasks-axi install to 0.2.6, and move the
floor-boundary test fixtures to the new versions.

tasks-axi 0.2.6 makes a failed relation deliverable for a promised-final
expecting pr-merged, so add the regression test: a bound work that ends
failed reports its honest outcome text through fm-public-followup-emit.sh,
consume marks the commitment ready, and deliver posts that text exactly
once.

Also make two hang-guard tests in fm-backlog-atomicity portable to hosts
without coreutils timeout, and stop an installed herdr from leaking into
the secondmate-liveness husk classifier test.

* no-mistakes(review): drop out-of-scope bounded_run hang-guard helper from atomicity test

* no-mistakes(review): pin quota-axi floor at 0.1.49 across fixtures

* no-mistakes(document): Document failed public-followup delivery behavior

* no-mistakes(ci): Updated quota-axi floor and all 0.1.49 fixtures to 0.1.51, corrected bootstrap boundaries to 0.1.51/0.1.52/0.1.50, and bumped the bearings lavish-axi stub to 0.1.77. Bearings, quota procevent, quota chooser, startup budget, and bootstrap floor coverage passed; the full bootstrap suite exceeded the 240-second local command limit after relevant checks passed. git diff --check passed
…rker copy (kunchenguid#4878)

* fix(bin): refuse ship done: when the named head lives only in the worker copy

A ship done: is not current-state done until that exact commit is reachable
outside the disposable copy. The check tests the named head, not whether
some branch moved.

* fix(bin): gate CI-ready ship done: on named-head reachability, not handoff

Keep no-mistakes' first done: as the pipeline handoff, apply the same shared
check when registering a PR and when a secondmate publishes ledger-first,
treat a recorded merged PR as landed after prune, and name the PR head
instead of scanning free-text SHAs.

* no-mistakes(review): Bind named-head gate to recorded PR and forge heads

* no-mistakes(review): Gate direct-PR forge heads and keep pending ledger deliveries

* no-mistakes(review): Align worker done wording, test mapping, pending-retry test

* no-mistakes(test): Raise watcher test time limit to stop load flake

* no-mistakes(document): Restore ledger-path fact and name named-head gate coverage

* ci: re-attest named-head ship-done gate for a fresh serial-3 verdict

* no-mistakes(review): Simplify local-only gate, gate keyed done lines, document recovery

* no-mistakes(document): Name fm-crew-state among named-head gate callers
…all alarm (kunchenguid#5204)

* fix(bin): ring a proven-idle secondmate before a wake-loop stall alarm

A leftover foreign-queue row on an idle, alive, ring-safe mate is still drainable in that home. Ring once, reset the observation interval, and keep the parent alarm for unknown, busy, or still-frozen rows.

* no-mistakes(review): Mark drain steer with from-firstmate fire-and-forget carrier
…unchenguid#5335)

The re-arm recovery cases judged "the watcher stayed live instead of
surfacing recovery" with fixed budgets below what a real stale-lock
recovery costs on a contended host: the arm's default 10s confirmation
deadline, a start helper that returned after about 4s whether or not the
arm had confirmed its watcher, and an 80-poll exit wait.
A changed-suite run beside other suites starves the recovery's many
short-lived processes while this suite's sleeping poll loops keep their
pace, so a watcher still surfacing its recovery read as one that stayed
live (issue kunchenguid#3793).
The original 0.25s window after confirmation was widened to 80 polls in
kunchenguid#3837, which left the same race at a larger size.

Following the CONTRIBUTING.md fixture-budget rule, the re-arm helper now
gives the arm an explicit 30s confirmation budget and waits for its
confirmation or exit within a ceiling that outlasts it, and every wait on
a re-armed watcher uses one named iteration-counted ceiling that outlasts
the same budget.
A passing case returns as soon as the arm reports or exits, and a watcher
that never surfaces its recovery still fails.

A new case delays every mktemp and readlink the re-armed watcher runs
after it publishes its beacon, so its first poll and exit take about 13s
on any host.
It fails with the reported symptom on the previous budgets and passes now.
No bin/ change.
* fix(bin): let one TERM always stop the watcher on bash 5.2

Bash 5.2 runs a pending trap from the parser entry of the next command
substitution it expands, where the trap body is parsed as the inside of
that substitution and fails ("trap: line 2: unexpected EOF while looking
for matching `)'") or is dropped silently, consuming the signal. The
watcher's `trap 'exit 1' HUP INT TERM` could therefore ignore a TERM and
keep polling while its stopper waited: the triage suite's reap waited
forever (CI jobs cancelled at 30 minutes), and the arm's signal path and
the away-mode daemon's shutdown wait for the watcher the same way.
Bash 5.3 fixed the parser; 5.2 is the stock bash on Ubuntu 24.04.

HUP and TERM now keep bash's native fatal-signal handling, which runs the
EXIT trap (watcher_cleanup) and exits on bash 3.2, 5.2, and 5.3. INT keeps
its trap because bash ignores a direct SIGINT while a child runs. The
check-spawn deferral window no longer contains a command substitution.

The triage suite's reap is now bounded and fails the case within 10s with
process evidence instead of hanging the job, and a new regression test
proves TERM stops a watcher blocked inside a poll's pane capture and still
releases its lock and records an acknowledgeable stop.

* no-mistakes(document): Clarify watcher stop-signal documentation
…id#5374)

* fix(bin): submit our own stuck doorbell instead of skipping every later ring

* no-mistakes(review): Confirm and retry Enter once on stuck-doorbell submit

* no-mistakes(document): Clarify doorbell retry and pending-composer documentation
* feat(bin): add the opt-in fleet activity ledger

Homes that create config/fleet-ledger get an append-only JSONL file,
state/fleet-ledger.jsonl, recording task.dispatched, task.status,
task.merged, and task.cleaned_up so outside tools can follow a fleet.
With the flag absent each producer does one file test and nothing else.
docs/fleet-ledger.md owns the record contract and its documented limits.

* no-mistakes(review): Record task.status text verbatim after the first colon

* no-mistakes(document): Clarify fleet ledger status and setup documentation

* no-mistakes(ci): Fixed a timing race in tests/fm-pi-branch-extension.test.sh: the replacement-wake test now waits for the prompt to start before releasing it. The focused test passed twice, and git diff --check passed
…nchenguid#5352)

* fix(bin): format, validate, and surface public-followup deliverables

brief pre-fills report_path=data/<work-id>/report.md and states the accepted
format of every value it cannot know instead of a bare <value> placeholder.
fm-public-followup-emit.sh refuses a deliverable tasks-axi would refuse, in
both the direct and staged destinations, naming the key, value, and format.
consume records the specific deliverable, outcome, or missing key behind a
tasks-axi refusal, and each refusal wakes the owning home once through the
existing relay poll.

* no-mistakes(review): refuse emits missing a required deliverable in both destinations

* no-mistakes(review): require promised deliverables and keep rejections recoverable

* no-mistakes(review): mirror tasks-axi's canonical pull request URL rule

* no-mistakes(review): keep a rejection wake whose line cannot be read

* no-mistakes(review): key emit-time rules on the promise, not the outcome

* no-mistakes(review): bound deliverable keys and values as tasks-axi does

* no-mistakes(review): state rejection wakes as at-least-once and pin it

* no-mistakes(review): enforce the promised contract tasks-axi holds at emit

* no-mistakes(review): stop inferring a staged promise from its outcome

* no-mistakes(document): Refresh public follow-up documentation

* no-mistakes(ci): Fixed both CI flakes. Watcher cleanup is now installed before singleton acquisition, preventing timeout races from leaving stale locks while preserving recovery-failure evidence. Bearings render fixtures now publish a valid isolated Lavish session store and retire each listener after rendering, eliminating false unowned-source races. Verified with checkpoint stress, fm-watch-checkpoint, fm-watcher-lock, repeated fm-bearings-board-render runs, project lint, syntax checks, and git diff checks

* Revert unrelated CI auto-fix edits to the watcher and bearings board test

The CI step's automatic repair changed bin/fm-watch.sh and
tests/fm-bearings-board-render.test.sh to chase two intermittent CI
failures that also occur on main and are not part of this change. Restore
both files so this branch carries only the public-followup deliverable fix.

* no-mistakes(review): Refuse a repeated --deliverable key at emit argument parsing

* no-mistakes(document): Clarify public-followup validation and rejection-wake documentation
* Add verified Devin CLI worker adapter

* no-mistakes(review): Drop Devin resolver refusal and launch marker

* no-mistakes(review): Verify devin in bootstrap, fold kind rule, update docs

* no-mistakes(document): Document Devin sidecar, resume, and worker-only facts

* no-mistakes(document): Document Devin interrupt, liveness anchor, composer signals

* fix(control): never pair Devin interrupt presses on an idle agent

A fast double Escape on an idle Devin opens its /revert picker, where Enter
reverts file changes. fm-control now sends the second press only after the
first renders Devin's 'esc again to interrupt' armed hint, never sooner than
0.5 s, closes a revert picker a mistimed press opened with one Escape, and
refuses to type the exit command while that picker is open. An unarmed
interrupt reports cancel=not-running and leaves the busy record untouched.

* fix(devin): disable Claude hook import and commit attribution for workers

The per-task Devin config now forces read_config_from.claude=false, so a
worker no longer runs the user's or project's Claude Code hooks (including
Herdr's Claude agent-state hook), and attribution=false, so Devin adds no
Co-Authored-By trailer or Generated-with line to commits and PRs.

* test(devin): extend live guard and record Herdr and revert-picker evidence

The credentialed live guard now fails if an imported Claude Code hook runs,
if the worker's commit carries Devin attribution, if an idle interrupt sends
more than one press or opens the revert picker, or if an open picker lets
exit through or is closed with a revert. The Devin reference, agent-control
doc, and verification records carry the 2026-09-22 tmux and Herdr lab results,
including the Herdr exit refusal.

* no-mistakes(document): Correct Devin documentation links and lifecycle guidance

---------

Co-authored-by: Denis Beliaev <[email protected]>
…id#5322)

fm-crew-state classifies the no-mistakes outcome 'passed-with-skips' as
unknown, so a finished worker awaiting merge is re-alerted as stale. The
same blind spot lets fm-teardown's pre-teardown terminal-run check refuse
a legitimate abort race that lands on this outcome.

Map passed-with-skips to done in crew-state resolution, keeping the
skipped publication/CI verification visible in the detail rather than
reporting a clean pass, and recognize it as terminal during teardown.
…nguid#5382)

* fix: refuse missing backend adapter before source

* no-mistakes(review): Gate backend precheck under stock Bash

* no-mistakes(document): Clarify adapter precheck docs

* no-mistakes(lint): Suppress intentional child Bash ShellCheck warning
…kunchenguid#5338)

* fix(test): repair tmux liveness and calm follow-up loaded_off regressions

Both self-tests fail on untouched main on a host whose coreutils are a
multicall binary and whose Chrome has no pre-warmed profile, and each failure
masks the other's file.

tests/fm-tmux-agent-liveness.test.sh - the stand-in harness processes were
symlinks to the host's `sleep`. A single-purpose `sleep` runs happily under
another name, but a multicall coreutils binary (uutils or busybox) resolves its
applet from argv[0]: `claude-link -> sleep` invoked under the harness name runs
the wrong applet and exits immediately, so no foreground process exists and
every positive case reads not-alive ("last verdict for liveness:agent was
missing (expected alive); title=sh comms=[sh ]"). Build a dedicated spinner as
the stand-in target, exactly the way the version-string case already builds its
executable, and require the fallback target to demonstrably survive the rename
before using it. Every assertion is untouched; the stand-in identity signal is
unchanged (the kernel still records the symlink name as the executable
identity).

tests/fm-calm-pi-extension.test.sh - render_export_dom pinned a brand-new
`--user-data-dir` per attempt. On Google Chrome for Testing 151.0.7922.34 that
pristine profile makes Chrome's first-run initialization never complete: the
browser and its renderers start, but --dump-dom never returns, so all three
bounded attempts end exit=0 timed_out=yes bytes=0 and the DOM assertions never
run ("could not render calm-mode HTML export DOM"). Chrome's own profile
creation under a fresh HOME renders the same document in about a second, so the
helper now gives Chrome a private per-attempt HOME instead of the explicit
profile flag. Each attempt still gets an isolated profile, and every DOM
assertion is unchanged.

Root-cause evidence: a pristine --user-data-dir with `--headless=new
--dump-dom` had not returned after 150s, while the same command with an empty
HOME and no --user-data-dir returned the full DOM in ~1s, and reusing an
already-populated profile also returned it in ~1s. The render failure masked
the rest of the file: with it repaired, the Pi follow-up loaded_off case passes
unmodified against an installed @earendil-works/pi-coding-agent package.

These two failures block downstream validation of every lane on hosts with
multicall coreutils or a fresh Chrome profile.

Verification:
- timeout 300 bash tests/fm-tmux-agent-liveness.test.sh -> exit 0, 16 assertions ok
- timeout 700 bash tests/fm-calm-pi-extension.test.sh -> exit 0, 13 assertions ok,
  including the Pi operational follow-up loaded_off case
- bash -n and shellcheck clean on both touched files
- rest of tests/: bin/fm-test-run.sh --all bounded by timeout 900 completed 17 files with 0 failures (fm-afk-contract.test.sh through fm-backend-herdr-launcher-workspace-e2e.test.sh), then the bound cut off the 18th (fm-backend-herdr-presentation-e2e.test.sh, a real-herdr-gated lab test) with no failure recorded

* fix(test): give wake-queue observation checkpoints the alerting ceiling

tests/fm-wake-queue.test.sh's secondmate stall case runs bounded foreground
watcher checkpoints whose job is to record an observation, with the alerting
checkpoint that follows asserting the stall. A checkpoint's exit publishes a
downtime marker, and the next checkpoint consumes it only by reaching the end of
the watcher's poll loop, where the recovery surfacing runs after the stall tick;
the observation itself is recorded by that same stall tick. On a loaded host a
1s ceiling sits under the cost of that iteration (which includes a pane capture
in the active-turn gate), so the observation was never recorded, the downtime
marker stayed pending, and the alerting checkpoint surfaced
`check: rearm-resurface` instead of the stall it asserts:

  not ok - a foreign queue with no progress did not alert: check: rearm-resurface
  not ok - a frozen reprovisioned queue generation was hidden: check: rearm-resurface

Give the observation checkpoints that feed a later alert the same 4s ceiling the
file already documents for alerting checkpoints. The ceiling is only a bound - a
checkpoint still returns on its first actionable wake - so no assertion is
weakened, and the quiet windows get longer, not shorter.

* no-mistakes(document): docs: correct export-DOM Chrome render root cause

* no-mistakes(review): Isolate Chrome profile on macOS, dedupe tmux CC_BIN lookup

* chore: re-trigger fork workflow approval for triage

---------

Co-authored-by: Captain <[email protected]>
Co-authored-by: kunchenguid <[email protected]>
…chenguid#5383)

* fix(bin): classify a status span without re-folding the whole log

A watcher poll could take minutes, so its liveness beacon aged past the
guard's 300s grace and the Stop auto-arm reported the watcher down. On the
main home, cycles ended with beacon_age 91-235s while healthy and 534-706s
while the laptop was CPU-starved.

Cause: whenever a newly appended status span held a keyed needs-decision
or blocked line, status_span_first_actionable_record re-read and re-folded
the ENTIRE log to decide whether that opening was still live, forking
several subshells per line. On a remote second mate's mirrored parent
channel (1.2MB, ~2300 lines) that is 13-20k subshells, about 17s per log
per classification when idle, paid by every signal and heartbeat scan.

Nothing regressed recently: subshell counts per classification were
20,272 from kunchenguid#3268 (2026-08-29, which introduced the whole-log fold) and
13,188 from kunchenguid#3753 onward through HEAD. The cost grew with log size, since
parent-channel logs only grow.

Fix: fold only the captured span. An accepted opening does not depend on
earlier lines and only later lines close or supersede it, and every later
line lies inside the span, so the span fold names the same live openings
at a cost bounded by the span. Old and new classification outputs are
byte-identical across 51 span offsets of real-shaped secondmate and ship
logs.

A real-watcher regression test records every read the classification
makes through the span-reader seam and asserts none reaches before the
classified offset; it fails on the old code (5,157 bytes read from
offset 0 to classify an 84-byte span).

* no-mistakes(document): Clarify span classification and watcher regression coverage
kunchenguid#5362 and kunchenguid#4878) (kunchenguid#5381)

* test: fix watcher timing flakes in fm-pr-check-security

The bounded watcher's hang guard now counts only the watcher's own time: a
case marks the intervals where it holds the watcher on injected work or makes
it wait on concurrent work, and those no longer count against its budget. The
budget itself stays at main's sixty seconds. The helper also stops forcing a
one-second per-check timeout, which killed a correct merged poll whenever that
poll took longer than a second, so the watcher only retried it or exited on a
later check's wake without the merge.

The concurrent-publication case pauses the guard while its arming is in
flight, and its task now sorts before the contributions observer the arming
also registers, so the watcher stops on the poll under test before running
that unrelated fleet snapshot. The case also prints the watcher's stderr when
it fails.

The replacement case pauses the guard while the re-arm runs inside the
watcher, runs that injected arming with the fixture root every other arming
here uses, and waits on the replacement merge's process instead of a
two-second cap. Merged-poll runs retire the contributions observer before the
watcher starts, since no case here exercises it.

The returned-descendant case no longer races a four-second sleep or a TERM
landing at an arbitrary point in the watcher's idle loop: its descendant holds
until killed, and a second check in the same cycle witnesses that it was
drained and stops the watcher.

* no-mistakes(ci): Reproduced the intermittent board-render failure. Its Lavish stub listed an open session but omitted the session-state record required by the listener, so the build could race the listener’s exit. Added matching fixture state; the affected suite passed three consecutive runs, and shell syntax and diff checks passed

* Revert "no-mistakes(ci): Reproduced the intermittent board-render failure. Its Lavish stub listed an open session but omitted the session-state record required by the listener, so the build could race the listener’s exit. Added matching fixture state; the affected suite passed three consecutive runs, and shell syntax and diff checks passed"

This reverts commit 6a59859.
…enguid#5385)

* feat: record task.pr_ready in the fleet ledger when a task PR is registered

* feat: record worker status lines in the fleet ledger as they are written

* no-mistakes(review): Keep worker status append failures and pass the resolved config to the ledger

* no-mistakes(review): Resolve relative config override before embedding in worker command

* no-mistakes(document): Clarify fleet ledger status capture timing
…unchenguid#5386)

* test: synchronize foreign secondmate stall legs on the watcher's recorded observation

Each leg of test_secondmate_foreign_queue_stall_tracks_progress_and_alerts_once
ran the watcher under a 1s or 4s wall-clock checkpoint, but every later leg
depends on the progress observation the previous leg's watcher recorded. Under
load the watcher was killed before its first stall tick, the observation was
never written, and the next leg treated its own sighting as the first one, so
the stall alert never fired.

Run the watcher directly and end each leg on its observable outcome: the
progress marker recording the expected observation, or the watcher's own first
wake. Also move a comment orphaned above this test back to the drain liveness
test it describes.

* no-mistakes(review): Wait for full stall reset before stopping watcher leg
kunchenguid#5391)

The listener resolves its server from that store before it polls. Without a session for this board, it exits in the gap after the build has already sampled a live claim.
…#5390)

* fix(bin): prune a torn-down task's wake rows at teardown

Prune pending durable wake rows (.wake-queue) for a task when it is torn
down, clearing stale wakes for its target window, signal wakes for its status
or turn-ended files, and task-specific check wakes.

Fixes kunchenguid#3419.
Adjacent to kunchenguid#5252.

- bin/fm-wake-lib.sh: add fm_wake_queue_prune_task
- bin/fm-teardown.sh: call fm_wake_queue_prune_task in cleanup_firstmate_home_children and main teardown
- tests/fm-wake-queue.test.sh: add test_wake_queue_prune_task

* no-mistakes(document): docs: note teardown prunes a task's wake rows

---------

Co-authored-by: Captain <[email protected]>
…ixture readiness (kunchenguid#5392)

* Make portable tests match resolved host paths

Summary:
- Match macOS full Node command paths by basename in the Gemini behavior test.
- Mirror symlink-resolved Nix PATH behavior and give the loaded-host race bounded headroom.

Testing:
- bin/fm-lint.sh
- bin/fm-test-run.sh tests/fm-on.test.sh tests/fm-gemini-harness.test.sh tests/fm-procevent.test.sh

Related:
- None

* no-mistakes(review): Mirror production PATH helper rules per directory group in tests

* no-mistakes(test): Wait for orphan runner start marker instead of fixed sleep

* no-mistakes(document): Clarify gemini ancestry test comment for versioned node comm

---------

Co-authored-by: Sandeep Salwan <[email protected]>
…it empty backlogs and corrected the shared ShellCheck source boundary causing both lint failures. Verified portable serial shard 1 (141 cases), 17 ready-queue cases, default lint, source-aware lint for all reported roots, and git diff --check. All passed
The contribution-input mode passed the full backlog JSON and task JSON as
jq argv (--argjson), so a large backlog exceeded the exec argument limit
(E2BIG) and the snapshot aborted mid-run. The main JSON transport path
already writes these payloads to temporary files and reads them with
--slurpfile; this change applies the same file-based transport to the
contribution-input branch.
@kesslerio kesslerio changed the title feat: expand fleet supervision, dispatch, and worker recovery fix: recover stalled fleet work and preserve tool interaction Oct 19, 2026
@kesslerio
kesslerio marked this pull request as draft October 20, 2026 00:11
@kesslerio

Copy link
Copy Markdown
Owner Author

Closing as pre-upstream holding PR: the work (actionable-instruction tracking until execution, Calm tool-content preservation; paired with kesslerio/pi#1) is preserved on branch fix/pi-sdk-supervision-integration pending an upstream carve-out. Tracked in the fork carve-out tracker issue.

@kesslerio kesslerio closed this Nov 2, 2026
@kesslerio

Copy link
Copy Markdown
Owner Author

Closing as pre-upstream holding PR: the work (actionable-instruction tracking until execution, Calm tool-content preservation; paired with kesslerio/pi#1) is preserved on branch fix/pi-sdk-supervision-integration pending an upstream carve-out. Tracked in the fork carve-out tracker issue.

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.