Repository navigation
feat: record fleet status immediately and emit PR-ready events - #5385
Merged
Merged
Conversation
…resolved config to the ledger
…g in worker command
dscott98
added a commit
to Simplifying-Cloud/firstmate
that referenced
this pull request
Sep 23, 2026
* feat: cut validation token cost without lowering review rigor Classify documentation-only changes as direct-PR surfaces on no-mistakes-prod-only projects, fold small pre-merge follow-ups into the open task's branch for one validation of the final head, document the machine-global per-purpose model routing no-mistakes supports (economical agent_config default with strong review_agents pins and its unsupported per-step boundary), and pin the repo-side boundary with a deterministic contract test. * no-mistakes(review): Prioritize full validation over every lighter delivery category * no-mistakes(document): Remove machine-specific claims from validation routing documentation * fix: submit stuck inbox doorbells instead of skipping them (kunchenguid#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 * docs: state the captain-approved model-routing boundary precisely Strong models serve review and review fixes; economical models serve all other validation work and fixes, which is the approved policy rather than an unsupported claim that difficult non-review fixes get stronger models. * feat: add opt-in fleet activity ledger (kunchenguid#5375) * 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 * fix: validate public follow-up deliverables and wake on rejection (kunchenguid#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 * feat: add Devin CLI crewmate and scout adapter (kunchenguid#5380) * 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]> * fix(bin): recognize passed-with-skips as a passing outcome (kunchenguid#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. * fix(bin): refuse unavailable backend adapters before sourcing (kunchenguid#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 * test: repair base-red liveness, export-DOM, and wake-queue self-tests (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]> * fix: keep watcher status classification bounded to new log spans (kunchenguid#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 * test: close pr-check watcher test gaps (original flake already fixed by 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. * feat: record fleet status immediately and emit PR-ready events (kunchenguid#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 * test: synchronize foreign queue stall checks with watcher progress (kunchenguid#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 * test: isolate the bearings render fixture from the shared Lavish store (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. * fix(bin): prune a torn-down task's wake rows at teardown (kunchenguid#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]> * test: align portable test expectations with resolved host paths and fixture 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]> * no-mistakes(document): Correct capture inbox ownership reference --------- Co-authored-by: Kun Chen <[email protected]> Co-authored-by: Denis Beliaev <[email protected]> Co-authored-by: Mickaël Rémond <[email protected]> Co-authored-by: NATHAN Menkin <[email protected]> Co-authored-by: blackxwhite88 <[email protected]> Co-authored-by: Captain <[email protected]> Co-authored-by: kunchenguid <[email protected]> Co-authored-by: Sandeep Salwan <[email protected]> Co-authored-by: Sandeep Salwan <[email protected]>
mituso89
pushed a commit
to mituso89/firstmate
that referenced
this pull request
Sep 26, 2026
…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
RooseveltAdvisors
pushed a commit
to RooseveltAdvisors/firstmate
that referenced
this pull request
Sep 29, 2026
…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
Intent
"ok do 1 and 2 in a single PR"
Context for those words: 1 and 2 are the minimum follow-ups to the fleet activity ledger (merged PR #5375, which added an opt-in, append-only state/fleet-ledger.jsonl that outside tools can read, gated by the presence flag config/fleet-ledger, recording task.dispatched, task.status, task.merged, and task.cleaned_up, where task.status records were captured by the watcher once per poll) so it can drive a status light like the one the requester described: a lamp that goes red when an agent asks a question or something fails, and green when a PR is ready for review, reacting instantly via kqueue on a file.
(1) Make task.status records reach the ledger at the moment the status line is written, instead of trailing by one watcher poll.
(2) Add a typed task.pr_ready event carrying pr (the full URL), written where firstmate records a task PR.
What Changed
task.statuswhen the status line is appended; the watcher remains a backstop and avoids recording captured lines again.task.pr_readywith the full PR URL, excluding merge-time re-records.Risk Assessment
🚨 High: The implementation explicitly narrows the required immediate status behavior, leaving real failure and reply paths delayed; the scope needs human approval before merge.
Testing
Both targeted test scripts passed. An isolated live CLI check showed immediate status recording without a duplicate on capture, a typed PR-ready record with the full URL, a nonzero result on failed status append, and no new ledger record when the flag was absent. The PR-registration producer was exercised with a fake forge, not a live forge.
tests/fm-fleet-ledger.test.shtests/fm-fleet-ledger.test.shtests/fm-fleet-ledger.test.shEvidence: Isolated live ledger CLI transcript
Source: Isolated live ledger CLI transcript
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
docs/fleet-ledger.md:62- The required follow-up says to maketask.statusrecords reach the ledger “at the moment the status line is written.” This change instead makes only the generated worker command immediate (bin/fm-brief.sh:250,333,432,521). The changed limits section explicitly leaves firstmate-written failures, answers, relayed replies, and remote second-mate reports waiting for a watcher poll (docs/fleet-ledger.md:63-65). For example,bin/fm-spawn.sh:3685appends a failed-launch status without invoking the ledger, so a status light sees no failure until polling resumes. Ask whether that narrower worker-only scope is acceptable; otherwise cover those write paths at their shared status-write boundary.bin/fm-fleet-ledger.sh:94- With a supportedFM_STATE_OVERRIDEoutside the home'sstate/directory, the generated command tests the real config flag (bin/fm-brief.sh:250), butappendedthen looks forconfig/fleet-ledgerbeside the overridden state directory. With no worker environment, it exits without recording the line; only the watcher later captures it. Pass the scaffold's resolved config directory to the ledger invocation.bin/fm-brief.sh:250- If the status-file redirection fails, the new semicolon and trailing|| truemake the worker's status command succeed anyway. Previously the failed append returned an error; now a worker can believe its decision or failure was reported when no line landed. The same command is rendered at lines 333, 432, and 521. Preserve the append's failure status while ignoring only ledger failures.🔧 Fix applied.
3 issues (1 error, 2 warnings) still open:
docs/fleet-ledger.md:62- The required follow-up says to maketask.statusrecords reach the ledger “at the moment the status line is written.” This change instead makes only the generated worker command immediate (bin/fm-brief.sh:250,333,432,521). The changed limits section explicitly leaves firstmate-written failures, answers, relayed replies, and remote second-mate reports waiting for a watcher poll (docs/fleet-ledger.md:63-65). For example,bin/fm-spawn.sh:3685appends a failed-launch status without invoking the ledger, so a status light sees no failure until polling resumes. Ask whether that narrower worker-only scope is acceptable; otherwise cover those write paths at their shared status-write boundary.bin/fm-brief.sh:250- If the status-file redirection fails, the new semicolon and trailing|| truemake the worker's status command succeed anyway. Previously the failed append returned an error; now a worker can believe its decision or failure was reported when no line landed. The same command is rendered at lines 333, 432, and 521. Preserve the append's failure status while ignoring only ledger failures.bin/fm-brief.sh:250- The prior fix round passed the scaffold's CONFIG value to the ledger, but left relative FM_CONFIG_OVERRIDE paths unresolved at line 139. If firstmate scaffolds with FM_CONFIG_OVERRIDE=custom-config and the worker runs from its separate worktree, the generated command tests custom-config relative to the worker's directory, misses the flag, and skips the immediate task.status record. Resolve the config directory before embedding it in the worker command.🔧 Fix applied.
1 error still open:
docs/fleet-ledger.md:62- The required follow-up says to maketask.statusrecords reach the ledger “at the moment the status line is written.” This change instead makes only the generated worker command immediate (bin/fm-brief.sh:250,333,432,521). The changed limits section explicitly leaves firstmate-written failures, answers, relayed replies, and remote second-mate reports waiting for a watcher poll (docs/fleet-ledger.md:63-65). For example,bin/fm-spawn.sh:3685appends a failed-launch status without invoking the ledger, so a status light sees no failure until polling resumes. Ask whether that narrower worker-only scope is acceptable; otherwise cover those write paths at their shared status-write boundary.tests/fm-fleet-ledger.test.shtests/fm-fleet-ledger.test.shtests/fm-fleet-ledger.test.shtests/fm-fleet-ledger.test.shtests/fm-brief.test.shScaffolded a brief in an isolated home, ran its status command from a separate worker directory, invokedbin/fm-fleet-ledger.sh captureandpr_ready, and checked the resulting JSONL records.Ran the generated command with an unwritable status destination and with the ledger flag absent.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.