Repository navigation
Merge upstream round 3 through kunchenguid/firstmate@9e3df47b - #264
Merged
Merged
Conversation
…nchenguid#3273) * fix(bin): keep home-summary publication bounded and off the watcher beat A home whose tasks had accumulated ordinary status history could not publish state/home-summary.json at all, and every attempt starved the watcher's liveness beacon while it failed silently. The producer's per-task open-decision fold spent tens of milliseconds per status line on a bash 3.2 global bracket-class substitution used only as a blank-line guard. On a real home that made the whole ledger producer take minutes, so publication burned its full FM_HOME_SUMMARY_TIMEOUT on every attempt and never completed. Replace that guard with an equivalent case glob in the one fold owner, which both the whole-file and cursor-backed folds use. Bound each per-task current-state read in the snapshot with FM_SNAPSHOT_CREW_STATE_TIMEOUT. For a remote secondmate that read crosses ssh, whose dead-peer detection deliberately never kills a slow-but-alive remote command, so nothing else bounded it. Detach the watcher's two publication triggers from the poll loop. The loop owns the beacon that fm-guard.sh reads as proof supervision is alive, and an inline publication put up to a full publication deadline between two beacon touches. A single in-flight publication is tracked so a slow one cannot accumulate clones. Report a repeatedly failing publication at session start. Publication stays deliberately non-fatal to its caller, so the existing bounded home-local failure record is now surfaced as a HOME_SUMMARY bootstrap line once the ledger is absent or stale and failures have been recorded since. * no-mistakes(review): Preserve home-summary failure attempt ordering * no-mistakes(review): Enforce durable home-summary single-flight and ordering * no-mistakes(review): Derive failure ordering from publication boundaries * no-mistakes(review): Restore best-effort failure logging and publication scoping * no-mistakes(review): Make ordering regression sensitive to one failure * no-mistakes(document): Correct HOME_SUMMARY diagnostic guidance
…henguid#3268) * fix(supervision): classify the appended status span, not the last line An actionable project update could be classified as routine and absorbed, so a worker that raised a decision, hit a blocker, failed, or finished stalled silently with the captain never told. Trigger, mask, symptom. A worker appends a captain-relevant event (`needs-decision`, `blocked`, `failed`, `done`). Any later routine append - a `working:` progress note - lands before the supervisor classifies the batch; the watcher's 30s signal-grace linger exists precisely to coalesce a status write with the same turn's turn-end, so this window is ordinary rather than rare. Both supervisors then asked "is the LAST line captain-relevant?", read the routine line, and absorbed the wake. The `.seen-*` suppressor advanced either way, so nothing ever re-read the event. When the crew was also provably working, the no-verb fallback absorbed it too, which is why the event disappeared completely instead of surfacing late. Reproduced end to end against a real watcher before any change: with the trailing `working:` append the watcher never exits and the wake queue stays empty; with that one line removed - the smallest counterfactual - the same `needs-decision` surfaces and queues. The away-mode daemon's `classify_signal` returns `self|routine signal` for a `blocked:` event under the same mask, which is the worse case because no captain is present to notice. The proven path was already in the tree: `status_open_decisions` fixed this exact masking for the durable decision fold, and its header states the rule - reading an append-only event log last-event-wins cannot represent an earlier event that a later unrelated line moved past. The classification path was never migrated to that read model. That is the earliest divergence, and the fix is to migrate it rather than to special-case the symptom. `status_span_first_actionable` in bin/fm-classify-lib.sh is the new single owner: it reads the bytes at or after a caller-supplied position and returns the first still-live captain-relevant event. Each supervisor supplies its own position, because the always-on watcher and the away-mode daemon classify the same stream independently and must not share one cursor: the watcher reads the size already recorded in its `.seen-*` signature (no new state) and its `.hb-surfaced-<task>` backstop marker, and the daemon its `.subsuper-seen-status-<task>` marker. Those two markers held the escalated line and now hold the escalated-through byte offset, which also removes a second defect in the same code - content dedup silently swallowed a genuinely new event whose text repeated an older one. An absent, malformed, or past-the-end position reads the whole log, so uncertainty surfaces events rather than losing them, and a marker an older build wrote as a status line reads that way too. Status logs are only ever appended to, including across a reused task id, so a recorded position keeps its meaning. A `needs-decision`/`blocked` event in the span is retired only when the whole-file fold proves its key closed; `status_open_decisions` stays the sole owner of that rule, so same-key reopening and reserved-key namespaces need no second implementation here. Every other captain-relevant event is terminal and always actionable. Both backstops now walk every status log instead of only those whose last line looks captain-relevant, because the event a backstop most needs to catch is exactly one a later append has moved past. That leaves `scan_captain_relevant_statuses` with no callers, and it is removed rather than left as a working copy of the defective read model. Regression coverage exercises the classifier and both supervisors through their own interfaces: the masked decision, the captain-reported release/install completion followed by cleanup chatter, and the away-mode blocker all surface; a routine append after an already-classified event stays absorbed, so the fix does not convert ordinary progress into wakes; and the heartbeat backstop catches a masked event the per-wake path missed. The end-to-end watcher tests drive a real fm-watch.sh with the crew reported as provably working, which is the configuration that made the original stall silent. Two further claims in the supplied RCA are deliberately not patched here. "Repeated operational recoveries produced all-clear replies despite known actions" is downstream of this same cause, not an independent contributor: an all-clear reply is the documented response when the specific event needs no action, so a classification that wrongly reported "no action" produces it, and correcting the classification removes it. "The project was subjected to validation requirements outside its accepted path" is delivery-mode selection, which AGENTS.md section 7 owns; no code changed here touches it, so it is out of scope. Harness and backend axes were inspected rather than assumed: nothing in this path reads a vendor-emitted signal. The status log's format and append protocol are Firstmate's own and identical for every harness, and no runtime backend reads or writes `.status` files (`bin/backends/*` contain no reference to them). The surrounding triage's only backend touchpoints - pane capture and the authoritative crew-state read - are unchanged. No live-harness guard applies and no per-harness verification record changes. Verified with `bin/fm-lint.sh`, `bin/fm-doc-audience-check.sh`, and `bin/fm-test-run.sh --changed --base origin/main`. * no-mistakes(review): Prevent status races and surface classification failures * no-mistakes(review): Surface unreadable signals and preserve AFK endpoints * no-mistakes(review): Route stale wakes through captured span verdicts * no-mistakes(review): Retire supervision offsets with reused task state * no-mistakes(review): Bind status offsets and preserve live decision origins * no-mistakes(review): Strengthen status identity with verified birth time * no-mistakes(review): Skip turn-end markers during status classification * no-mistakes(review): Preserve status presentation with platform-strength identities * no-mistakes(review): Retain failed wakes and advance routine checkpoints * no-mistakes(review): Surface all events and retain unreadable wakes * no-mistakes(review): Treat absent status logs as successful empty spans * no-mistakes(review): Bound repeated classification failures with durable receipts * revert(supervision): drop the failure-receipt and durable-retry machinery Captain-authorized revert to the minimal fix. Review rounds added a durable failure-receipt store and wake-retention-on-failure to bound repeated classification failures. That machinery grew larger than the fix it protected and kept producing its own defects: an unreadable log still looped forever because the always-on watcher never consulted the receipt, and the receipt was persisted before its diagnostic was durably queued, so a crash in between swallowed the alarm outright. Those two defects go away with the code that contained them rather than being repaired. Removed: the failure-receipt path, fingerprint, record and clear helpers and their retirement bookkeeping; the retention of a durable wake when classification fails; and the error-propagation plumbing in both supervisors that existed only to drive them. Kept, because it is the accepted fix rather than the declined machinery: span classification of the events appended since a supervisor last looked, in both supervisors and both backstops; reporting every actionable event in a span and committing a position only through what was reported; naming the live opening of a reopened decision; treating an absent log as ordinary and an unreadable one as worth reporting; the non-.status filter; and the platform-strength identity that guards a position commit without failing a read. Replacement behavior for a log that cannot be classified: report it once, do NOT advance the classification position so the content is classified from where it stopped once readable, and DO advance the wake signature so the report is bounded to one per distinct file state. Reporting and reading are different acts: telling the captain about a log is not the same as having read it, and only the latter may move a classification position. The residual risk is explicit and accepted: there is no guaranteed automatic retry inside a crash-mid-read window, and the locked session-start replay of the durable queue covers it. That rationale is recorded at mark_escalated_seen so a future reader does not reintroduce the retry as a "missing" guarantee. Also fixes lint failures that arrived with the review-fix commits and were never caught because the run never reached its lint step: an unfollowable conditional source directive, a second unquoted-expansion site left after a call was split across lines, cleanup of the file being read inside its own read loop (restructured to one post-loop teardown rather than three in-loop copies), stub functions in tests that are invoked indirectly, and a test local left unused when its assignment was replaced by a helper. bin/fm-lint.sh passes on the default branch, so these were introduced here. Verified with `bin/fm-lint.sh`, the end-to-end masked-decision and away-mode reproductions, and `bin/fm-test-run.sh` over the supervision, wake-queue, wake-drain, watch-arm and inactive-reconcile suites (6 scripts, 0 failures). * no-mistakes(review): Correct classification failure contract documentation * no-mistakes(review): Bound unreadable status reports without skipping classification * no-mistakes(review): Preserve escalation markers when buffering fails * no-mistakes(review): Detect permission recovery without advancing classification * no-mistakes(document): Document status span classification contract * no-mistakes(ci): Fixed CI failures by lazily loading classification helpers in fm-wake-lib, preserving minimal recovery/remote fixtures; added a public current-status marker helper and updated behavioral fixtures to use the v2 marker contract; resolved ShellCheck variable collisions in fm-control and fm-public-followup-lib. Verified fm-lint, bash syntax, fm-control, public-followup, wake-queue, send-resolve-key, captain-hold, pending-reply, remote-reply, remote-backlog-handoff, turnend-guard, and Claude autoarm tests. The Pi branch suite reached a separate local stock-render mismatch under Node 24; its CI-reported missing-classifier failure path is fixed * no-mistakes(review): Escalate blockers while preserving declared-wait cadence * no-mistakes(review): Clarify actionable events override wait self-handling * no-mistakes(review): Surface rejected decisions and dangling status links * no-mistakes(document): Document reserved-key reconciliation classification * no-mistakes(ci): Fixed the flaky portable serial CI test by modeling the retained staging directory as genuinely owned by a live process and aging both fixtures deterministically. This removes scheduler-timing dependence while verifying the worker reaps abandoned staging and preserves live staging. Verified with fm-remote-transport-lanes.test.sh, bin/fm-lint.sh, bash syntax, and git diff --check * no-mistakes(document): Correct away-mode classification documentation
…#3289) * docs: split harness adapter operations reference * no-mistakes(review): Fix harness adapter routing and ownership contracts * no-mistakes(review): Prune duplicate harness adapter ownership prose * no-mistakes(review): Fix default effort routing and Grok max semantics * no-mistakes(review): Remove source-only routing test and duplicate semantics * no-mistakes(review): Add local harness adapter instruction evaluation * no-mistakes(review): Fix harness evaluation gating and change mapping * no-mistakes(test): Captain, require explicit harness instruction evaluator model * no-mistakes(document): Fix harness adapter documentation references
* test(fixtures): share fake-toolchain and spawn-world builders Future tests can start from tests/fixtures.sh instead of copying stubs, and a no-mistakes version-floor bump is one constant rather than a multi-file edit. Migrated this round: fm-busy-adapter-wiring, fm-spawn-pool-base-freshen, fm-grok-harness, fm-tangle-guard, fm-gate-refuse, fm-spawn-dispatch-profile. Left for opportunistic migration: remaining make_spawn_fakebin copies (trace-context, kimi, muse, backend), the make_stubs send cluster, and the fake no-mistakes version banners in bootstrap/session-start/secondmate suites. Did not touch tests/fm-pr-check-security.test.sh. * no-mistakes(review): Prevent fake SSH test from blocking on stdin * no-mistakes(document): Clarify shared fixture documentation * no-mistakes(ci): Fixed the flaky watcher triage test by extending its startup-sensitive timer-repair wait from 3s to 10s, matching existing loaded-runner budgets. Verified with the full tests/fm-watch-triage.test.sh suite, bash syntax validation, and git diff checks * no-mistakes(ci): Fixed portable serial shard 4 by updating the inactive-reconcile fixture to prime status through the public fm_wake_status_mark_current API, ensuring classifier helpers load correctly and preventing the idle watcher from exiting. Verified the test three consecutive times, ran fm-test-fixtures, ShellCheck, bash syntax checks, and git diff checks. The outer no-mistakes executor can now bind a fresh attestation to the new head * no-mistakes(ci): Added behavioral coverage proving the shared spawn tmux fixture defaults an unset FM_FAKE_PANE_PATH to empty. Verified the fixture suite, ShellCheck, syntax/diff checks, and all six migrated test suites; all passed. The outer executor can now bind a fresh no-mistakes attestation to the updated head
* feat(bin): retire completed PR-check migration machinery Every registered home already carried both completion markers, and no installer still creates pre-migration checks. Remove the one-time migrate script, its bootstrap/watch/teardown/docs surface, and migration-path tests without weakening live check-trust or PR-poll authentication. * no-mistakes(review): Restore live PR-check security coverage * no-mistakes(document): Refresh retired PR-check documentation * no-mistakes(ci): Fixed both failing CI checks. Updated inactive-reconcile setup to use the public status-marking interface, preventing false watcher exits. Made remote-job shutdown deterministic by stopping the complete worker tree before tampering. Verified both affected test suites, repeated inactive reconciliation, shell syntax, and git diff checks
Round 3 of the recorded 7-round upstream sync plan: the contiguous first-parent prefix f66be0f..9e3df47, five upstream changes. - 5f31097 (kunchenguid#3273) home-summary publication no longer starves supervision. - 4eb587d (kunchenguid#3268) routine status updates no longer hide actionable events. - c731c36 (kunchenguid#3289) harness-adapters split into a router plus references/. - 0ace60a (kunchenguid#3296) shared shell fixtures centralized in tests/fixtures.sh. - 9e3df47 (kunchenguid#3299) legacy PR-check migration machinery retired. Twenty paths conflicted. The two load-bearing resolutions: The harness-adapters skill had been split independently on both sides. Under TRACK this takes upstream's references/ layout and its routing artifact, adds references/harness/agy.md with an agy routing row, re-homes the fork's own prose (bin/fm-launch-lib.sh ownership, the crew-only secondmate gate, the dashboard's additive per-task event wiring) into references/common/, and retires bin/fm-harness-adapter-doc.sh with its test. docs/fork-divergence.md records that retirement as the sixth capability collision resolved by the remote-doctor precedent. Upstream deleted only bin/fm-pr-check-migrate.sh, so every inherited PR_CHECK_MIGRATION and .pr-check-migration* reference was removed with it across AGENTS.md, the bootstrap-diagnostics skill, bin/fm-bootstrap.sh, bin/fm-session-start.sh, bin/fm-teardown.sh and the security and watcher-lock suites. The fork's endpoint-binding and run-attribution migrations, which sit directly below the deleted bootstrap call, are kept. Deliberate divergences preserved rather than merged away: the fleet snapshot's single FM_SNAPSHOT_TASK_TIMEOUT contract (upstream's second name was again not introduced), the watcher's live declared-wait routing and self-widening cadence (upstream's escalation gating adopted with pause_streak_bump moved inside it), and the parked-decision marker reconciliation in bin/fm-push-transition-lib.sh (carried into upstream's rewritten mark_surfaced).
The round's harness-adapters resolution deleted bin/fm-harness-adapter-doc.sh, so its inventory row no longer names a script this repo carries.
The merge threads upstream's escalation gating across the fork's three run-progress branches with a flag; declare it beside the other housekeeping locals so it cannot leak into the daemon's outer scope.
kunchenguid#3299 moved the staged-record tamper setup to a bare whole-tree stop. This fork's worker is a restart supervisor plus a serving child in one process group, and worker_reap_descendants escalates TERM to KILL in a single pass, so a group signal kills the child between publishing its shutdown quarantine and clearing it. Ownership stays quarantined and the tamper step cannot start a worker at all. Re-sequence the setup to TERM the recorded child first and let it complete its own shutdown, which ends the supervisor with it. Upstream's two assertions stay byte-identical, and a bounded process-group check follows them so the tree stop cannot pass vacuously on an already-dead pid. docs/fork-divergence.md records this under the existing descendant-reaping entry, as a consequence of that divergence rather than a new one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Round 3 of the recorded 7-round upstream sync plan: merge the contiguous first-parent prefix
f66be0f8..9e3df47bfromkunchenguid/firstmateinto this fork as one reviewable merge PR.bb268932f3983e6b31df9006989b08163237b736f66be0f8f7f56f78d09458d909bdd555b9dbcf769e3df47b4a5f228d8e3bf2b889e7119f95b85be5Endpoint identity
The plan named the endpoint by its abbreviation. Both identities were resolved and they agree:
9e3df47bis the commit upstream PRkunchenguid/firstmate#3299landed onmain, and itsfirst parent is change 19. Nothing later than it entered the round: the only commits this branch
adds over the fork base are the five upstream changes, the merge commit, and one follow-up commit
that removes the inventory row for a script this round deleted.
Upstream has advanced past the plan's own round-7 endpoint since the plan was written; that is
expected and changed nothing here. The round is a full merge of a contiguous prefix, created with
git merge --no-ffand one upstream parent. No cherry-pick, rebase, force-push, squash, or forkmainrewrite was used.Applicability of every upstream change in this round
5f310975kunchenguid/firstmate#3273bin/fm-home-summary-refresh.sh,bin/fm-classify-lib.sh,bin/fm-watch.sh, and 488 lines of new test). Two parts needed a decision: its newHOME_SUMMARY:bootstrap diagnostic had to be threaded into the fork's longer diagnostic list, and its second per-task read boundFM_SNAPSHOT_CREW_STATE_TIMEOUTduplicates a fork contract the ledger says must stay single.4eb587d6kunchenguid/firstmate#3268signal_reason_is_actionable->signal_files_actionablerewrite, the deletion ofscan_captain_relevant_statuses, and the status-span presentation-marker contract all took cleanly, exactly as the plan predicted, because the fork's callers were unchanged base. Three sites needed a decision: theafkskill's declared-wait bullet, the rewrittenmark_surfacedinbin/fm-push-transition-lib.sh, and the away daemon's escalation gating inbin/fm-supervise-daemon.sh.c731c36ckunchenguid/firstmate#32890ace60abkunchenguid/firstmate#3296tests/fixtures.shand five of the six migrated suites took cleanly, and the plan's prediction held: the fixture code moved into a NEW file, so the fork's descendant reaping intests/lib.shis untouched.tests/fm-spawn-dispatch-profile.test.shneeded adapting because the fork's inline tmux stub and brief writer carry behaviour the shared builders do not; see the per-file table.9e3df47bkunchenguid/firstmate#3299bin/fm-pr-check-migrate.sh. Every fork reference toPR_CHECK_MIGRATION:and.pr-check-migration*is inherited from the merge base and had to be removed with it; the complete sweep is below. The fork's own run-attribution and endpoint-binding migrations, six lines below the deleted bootstrap call, are kept and still run. This change also carried incidental churn intests/fm-remote-job.test.shthat did not compose with the fork's worker; see "The remote job worker stop" below.Semantic collision C1: the harness-adapters split
The
harness-adaptersskill had been split independently on both sides of the same merge base:kunchenguid/firstmate#3289):SKILL.mdbecomes a 95-line router carrying an embeddedharness-adapter-routing-v1JSON object, withreferences/common/{control-and-recovery,dispatch,model-and-effort,primary-hooks}.mdand
references/harness/<h>.md, pinned by a newtests/fm-harness-adapter-references.test.sh.HelloWorldSungin/firstmate#191,faea8a28): a 268-line shared head plusharnesses/<h>.mdincluding the fork-only
agy.md, routed by a 114-linebin/fm-harness-adapter-doc.sh.Same facts, different filenames and different routing. Resolved under TRACK using the remote-doctor
precedent in
docs/fork-divergence.md: take upstream's implementation whole, preserve compatiblefork-only intent, and never blend two designs.
What was taken. Upstream's
SKILL.mdrouter, its fourreferences/common/*.mdfiles, its eightreferences/harness/*.mdfiles, andtests/fm-harness-adapter-references.test.sh.What was re-homed rather than dropped. Every fork-only fact was located by diffing the merge
base's monolithic
SKILL.mdagainst the fork's whole split tree, then checking each fork-addedsentence against upstream's whole tree. Of 111 fork-added lines, all but four groups were the fork's
own split-mechanism prose (which retires with the fork's split) or restatements upstream's
references/common/*.mdandreferences/harness/*.mdalready carry. The four that were genuinelyfork-only moved to their new owners:
harnesses/agy.md)references/harness/agy.md, plus an"agy"row in the routing object and its crew-only/Herdr-only boundary in the router's Non-negotiable safety sectionreferences/harness/agy.md, matching upstream's per-harness shapebin/fm-launch-lib.showns launch-command construction, andbin/fm-spawn.shthe surrounding gatesreferences/common/dispatch.mdOwners and Adapter verificationagyandmusereferences/common/dispatch.mdResolutionreferences/common/primary-hooks.mdTurn endbin/fm-harness-adapter-doc.shretired, not ported. Porting it would have left two routingconsumers over one table, which is what the fork's own one-owner rule and the remote-doctor
precedent both forbid. The property it existed for survives structurally rather than at runtime:
upstream's
tests/fm-harness-adapter-references.test.shfails the build when any routed target isunreadable, so a missing reference cannot reach a session at all, and the router's own text keeps a
harness undispatchable until its entry and owners land.
tests/fm-harness-adapter-doc.test.shwentwith it.
Consumers that followed.
docs/documentation-audiences.json(nine paths repointed, agy insertedin order),
docs/scripts.md(row removed),bin/fm-test-run.sh(changed-file family map),docs/verification/muse.md,CONTRIBUTING.md,docs/configuration.md, and the ledger's agy link.docs/adr/0002-stow-session-end.mdstill names the retired script inside a dated 2026-08-26 reviewrecord. That is a historical observation of what that review counted, not a live pointer; the count
it reports still holds of the adopted tree. It was left as written rather than back-dating an ADR,
and both
bin/fm-pointer-check.shandbin/fm-doc-audience-check.shpass with it in place.The remote job worker stop (change 20's incidental fixture churn)
kunchenguid/firstmate#3299also moved the staged-record tamper setup intests/fm-remote-job.test.shfrom "TERM the recorded serving child" to a bare whole-tree stop.That does not compose with this fork's worker, and it is a real mechanism rather than a flake:
fork's previous block makes the same tree pass, which isolates the cause to this hunk.
fm_remote_job_stop_worker_treeis byte-identical between the two trees, so the difference is theworker, not the helper.
and
worker_reap_descendantsescalates TERM to KILL in a single pass with no grace between them.A group signal therefore reaches supervisor and child at the same instant, and the supervisor kills
the child between publishing its shutdown quarantine and clearing it.
worker.pidpresent holding a dead pid, plusworker.ready,worker.identity, andlock/quarantineall left behind, after whichfm_remote_job_ensure_workerrefuses and the tamper step cannot run at all.
So a whole-group stop of this worker deliberately leaves ownership quarantined. That is the
fail-safe working as designed, and it is a consequence of the recorded "Remote job worker descendant
reaping" divergence rather than a new one.
Resolution. The setup is re-sequenced to TERM the recorded serving child first and let it
complete its own shutdown, which releases ownership and ends the supervisor with it. Upstream's two
assertions are kept byte-identical and contiguous - verified programmatically against
9e3df47b, not by eye - and a bounded process-group check follows them, because once the child isgone the tree stop would otherwise pass vacuously on an already-dead pid. The comment at the
re-sequenced step names the mechanism and says explicitly not to normalise it back, so the next
reader does not find an unexplained ordering and helpfully undo it.
The added group check was proven non-vacuous rather than assumed: against a real live process group
it reports "not stopped" after spending its full bound, reports "stopped" once that group is killed,
and refuses an empty group.
Follow-up recommendation, deliberately not implemented here.
worker_supervisor_shutdownreapswith TERM and KILL in the same pass. That is right for orphans, but the serving child is not an
orphan: it has its own TERM handler that publishes a shutdown quarantine, stops active execution,
then clears it. Killing it mid-sequence converts an orderly shutdown into a permanently quarantined
one, which is what every whole-group stop hits, including the fork's own
bin/fm-remote-job-reap-orphans.sh. A grace window for the supervisor's own recorded child, ahead ofthe generic descendant escalation, would keep the orphan guarantee while letting the child release
ownership. That is a change to signal-time supervision behaviour and must not ride inside a sync
round, where it would be reviewed as conflict resolution rather than as the behavioural change it is.
The
PR_CHECK_MIGRATION/.pr-check-migration*sweepPatterns grepped over the whole tree excluding
.git, after resolution:Every hit and its disposition:
bin/fm-pr-check-migrate.sh(1159 lines)bin/fm-bootstrap.shheader:"PR_CHECK_MIGRATION: <private remediation>"diagnostic lineHOME_SUMMARY:line added in its placebin/fm-bootstrap.shheader: "eleven MUTATING sweeps (PR-check migration, ...)"bin/fm-bootstrap.shheader: "never race-mutates PR-check artifacts, ..."bin/fm-bootstrap.shlocked-boundary call"$SCRIPT_DIR/fm-pr-check-migrate.sh" || truefm-endpoint-binding-migrate.shandfm-run-attribution-legacy-transition.shcalls immediately below are kept unchangedbin/fm-session-start.shheader, four sites (sweep count, sweep enumeration, read-only skip list,--reemitskip list)bin/fm-session-start.shtwo runtimeprintflines naming PR-check migrationbin/fm-teardown.shheader quarantine sentence,validate_pr_poll_cleanup,remove_pr_poll_artifactsbin/fm-pr-lib.shregistration-parse comment naming the migrationbin/fm-watch.sh,bin/fm-pr-check.sh,bin/fm-x-lib.shAGENTS.mdstate layout:.pr-check-quarantine/and.pr-check-migration.log .pr-check-migration-scan-v1 .pr-check-migration-v1rowsAGENTS.mdsection 13bootstrap-diagnosticstrigger listPR_CHECK_MIGRATION:removed,HOME_SUMMARY:added in the same position.agents/skills/bootstrap-diagnostics/SKILL.mddescription trigger list.agents/skills/bootstrap-diagnostics/SKILL.mdsixPR_CHECK_MIGRATION:handling bulletsHOME_SUMMARY:bullet placed where they weredocs/scripts.mdfm-pr-check-migrate.shinventory rowtests/fm-watcher-lock.test.shmark_pr_check_migration_completehelper plus its five call sitestests/fm-pr-check-security.test.sh,tests/fm-secondmate-safety.test.sh,tests/fm-remote-job.test.sh,tests/fm-tool-update-check.test.sh,tests/fm-wake-queue.test.sh,tests/fm-watch-arm.test.sh,tests/fm-watch-checkpoint.test.sh,tests/fm-watch-triage.test.sh,tests/fm-x-mode.test.shtests/fm-run-attribution-legacy-transition.test.sh:73comment naming "the legacy PR-check migration" as a consumer of the metadata identity parserTwo hits are left standing on purpose, and both are correct:
tests/fm-pr-check-security.test.sh:1014,1016are upstream's own new regression asserting that areal bootstrap emits no
PR_CHECK_MIGRATIONdiagnostic. Removing them would remove the proof.docs/adr/0002-stow-session-end.md:117names the retired routing script inside a dated reviewrecord; see the C1 section above.
Final state:
grep -rIover the whole tree for all seven patterns returns only those two files.Divergence survival, demonstrated by behaviour
Every active entry in
docs/fork-divergence.mdwas checked. Behaviour first: for the entries thisround's upstream changes actually landed on, the named regression case is quoted from the
merge-result run. For entries whose carrying files this round never touched, the evidence is that
absence plus the suite that pins them still passing, which is what the ledger asks for.
Divergences this round's changes landed on
Each of these carries a fork behaviour that one of this round's five upstream changes landed on. The
named case is quoted from the merge-result sweep, so the evidence is the behaviour running, not the
file still being present.
Watcher live declared-wait routing and self-widening recheck cadence - collided with change 17,
which made the away daemon advance a recheck marker only when the escalation was actually buffered.
Adopted whole with
pause_streak_bumpmoved inside that gate.Run-progress wedge hold - change 17 rewrote the daemon's stale/wedge arm the fork's hold sits in.
Parked-decision marker reconciliation - carried into upstream's rewritten
mark_surfaced, whichnow commits an offset and identity instead of comparing a last line.
Fleet snapshot per-task timeout and abandoned child work - change 16 reintroduced upstream's
second timeout name. The fork's single contract was kept and the bounded-read fixture repointed.
Remote job worker descendant reaping - change 20's incidental fixture churn; see "The remote job
worker stop" above.
Bounded remote job stdin capture - same file, same round.
Agy crew adapter - change 18 retired the layout its contract lived in. The adapter is now reached
through upstream's routing artifact, and its executable guards are unchanged.
The routing case is what proves the re-homing rather than the file's presence: it parses the
router's JSON object and requires every target it names, including the
agyrow added here, to bereadable.
Fleet dashboard and agent-event instrumentation - change 18 re-homed its per-task hook prose into
references/common/primary-hooks.md; the additive-wiring property is unchanged.Watcher stop-signal disposition and Watcher restart hand-over - change 20 removed the
migration helper from the suite that pins both.
Default per-script bound on every test sweep - change 18 and change 19 both edited the runner.
Divergences whose carrying files this round did not touch
The round's diff was checked against every file each remaining entry names, and none of them
changed between the fork parent and this branch:
Their pinning suites still pass on the merge result:
Three entries record decisions and postures rather than executable behaviour, so their evidence is
documentary and was re-read rather than executed:
caught up to;
bin/fm-pr-merge.shis unchanged by this round and the entry's warning againstsilently resolving the collision toward upstream is intact.
bin/fm-upstream-status.shand.no-mistakes.yamlare unchanged, and this PR is itself thetracking mechanism operating as the entry describes.
Baseline versus final
Three complete
bin/fm-test-run.sh --allsweeps plus three full canonicalbin/fm-lint.shruns, onone host. The two parent baselines ran in isolated temporary clones so this branch and its merge
structure stayed untouched, and all three test sweeps ran sequentially, never concurrently: the
suite drives real tmux and a real Herdr install through shared host state, so two sweeps on one
machine would have produced a baseline nobody could trust.
Tests
bb2689329e3df47bThe two parents fail different tests because they are different trees: the fork carries 45 test
scripts upstream does not have, and several upstream fixtures model a host this one is not.
Failures are therefore recorded separately, and the merge result is judged against the fork parent,
which is the tree being merged into.
Fork-parent failure (1).
tests/fm-calm-pi-extension.test.sh-could not render calm-mode HTML export DOM. Headless Chrome dies with aTrace/breakpoint traprendering the export DOM on thishost. Reproduced in isolation on the untouched fork parent, so it is neither load flake nor merge
damage. It is a pre-existing host failure and it is expected to persist on the merge result.
Merge-result failure (1).
tests/fm-calm-pi-extension.test.sh, the identicalTrace/breakpoint trapin headless Chrome, with the same missingexport.txtand the samecould not render calm-mode HTML export DOMline as the fork parent. Same test, same assertion,same mechanism, and it also fails on the upstream parent. It is carried in, not caused here.
Read the two numbers together: the fork parent was 215 tests with 1 failure, the merge result is 217
with the same 1 failure. The count moves by two because this round adds upstream's
tests/fm-harness-adapter-references.test.sh,tests/fm-harness-adapter-instructions-live-e2e.test.sh,and
tests/fm-test-fixtures.test.sh, and removestests/fm-harness-adapter-doc.test.shwith therouting script it pinned. No test that passed on the fork parent fails on the merge result.
Upstream-parent failures (7). None of these reach the merge result: five of the seven pass on
the fork parent, because the fork's own version of that file or fixture is what the merge keeps.
fm-calm-pi-extension/export did not complete while calm mode was onfm-bootstrapthe unsplit run lost its local diagnostic (missing: 'MISSING: node (install:')nodeto be absent; this host has itfm-session-startMISSING diagnostic did not appear at allfm-oncomposed child PATH did not match the portable contract/nix/store/...entry; this host is a Nix profilefm-remote-doctor--fix did not create the first needed harness wrapperfm-test-runcomm: file 2 is not in sorted orderfm-watcher-lockarm did not exit with HUP status (got 124)trap 'exit 1' HUP INT TERM; the fork deliberately does not, which is the "Watcher stop-signal disposition" divergenceThat last row is the strongest single piece of survival evidence in this PR, and it is worth
separating from everything else here because it is not our evidence.
tests/fm-watcher-lock.test.shis upstream's own test, run against upstream's own parenttree, with no fork content in it. It asserts that a stopped watcher exits with HUP status, which is
true only when the
trap 'exit 1' HUP INT TERMthat upstream installs is in place. It fails there,timing out at 124. That handler is precisely what this fork's "Watcher stop-signal disposition"
divergence exists to NOT install, because a trap handler is a string bash parses at signal time and
that parse can fail inside a command substitution, leaving the watcher deaf to its own stop
(
HelloWorldSungin/firstmate#242).Every other survival claim in this PR is one of our own tests passing, which a reader has to take on
trust. This one is upstream's test, on upstream's tree, failing on the exact behaviour we document a
deliberate difference from - so it makes the case without our authorship and without our fixtures.
Lint
bin/fm-lint.shwith the full canonical file set (CI=true), pinned ShellCheck 0.11.0 andactionlint 1.7.12:
bb2689329e3df47bThe merge result initially failed lint in four places that lint clean on both parents. This is
worth stating precisely because it is easy to misread as sloppiness in the resolution: not one of
the four lines was written or edited by this merge. ShellCheck's extended dataflow analysis is
whole-source-graph sensitive, and the merged graph differs from either parent's - for
bin/fm-bootstrap.shthe trigger was upstream deleting sixteen lines of dead shim helpers from alib it sources, which changed nothing about the flagged code itself.
bin/fm-control.sh:439proof=agent-aliveraised SC2100, reading the dash as arithmetic. Quoted.Zero behaviour change and the reported proof token is unchanged. Upstream made the same class of
fix in this very round by renaming its own
note-filesentinel tonote_file, but this token isreported and asserted on, so it is quoted rather than renamed.
SC2030infos onexport FM_TIMEOUT_KILL_GRACE=5andexport FM_WRITE_BACK_BUDGET=$budgetin
bin/fm-bootstrap.shandbin/fm-teardown.sh. Those exports are deliberately subshell-local,as the comments already above them say, so each carries a
# shellcheck disable=SC2030namingthat reason.
Determinism was checked rather than assumed: the pre-fix findings reproduced identically across
repeated runs and under
FM_LINT_JOBS=1, so they were a real gate failure to fix and not analysisnoise to wait out.
CI
CI is independent confirmation on a clean runner rather than this host.
On head
1eb341ce5c3f5688c6571e5f1d75ac05e7e8493a: 16 passed, 1 failed, 17 total. The singlefailure is
PR must be raised via no-mistakes, which is red by design for this round; see "Expectedred check" below. Every other required check passes: Lint, Test coverage guard, Repo invariants,
both portable parallel shards, all eight portable serial shards, Behavior tests (Herdr), Stock macOS
Bash snapshot compatibility, and Behavior timing aggregate.
CI is worth reading beside the local sweeps rather than instead of them, because it runs on a clean
Ubuntu runner that has neither this host's Nix profile nor its Chrome, which is what makes the local
fork-parent
fm-calm-pi-extensionfailure legible as a host fact rather than a code one.An earlier head,
c2232595, failedBehavior portable serial 8on the remote job worker stopdescribed above. That is the CI half of the 3-of-3 local reproduction, and it passes on the current
head with the Option B correction in place.
Per-file reasoning for every changed contract file
Twenty paths conflicted textually. Each row below states the decision and why. Every other changed
file merged with no decision to make; the two lists after the table account for those.
The twenty conflicted paths
AGENTS.md.pr-check-quarantine/and.pr-check-migration*were dropped with the machinery they describe, keeping the fork's.lease-<task>row. The section 13bootstrap-diagnosticstrigger keeps the fork's longer list minusPR_CHECK_MIGRATION:plus upstream'sHOME_SUMMARY:in the same position upstream gives it. The session-start digest block keeps the fork's condensed prose: upstream's only edit there deletes one item from a seven-item enumeration the fork no longer carries, so nothing false survives and nothing was lost..agents/skills/afk/SKILL.md.agents/skills/bootstrap-diagnostics/SKILL.mdPR_CHECK_MIGRATIONis removed with its six handling bullets, and upstream'sHOME_SUMMARY:trigger and bullet are placed where the retired ones sat, which is also where upstream places it relative to the secondmate block..agents/skills/harness-adapters/SKILL.md"agy"routing row and agy's crew-only/Herdr-only boundary added. See the C1 section.CONTRIBUTING.mdbin/fm-launch-lib.shas the launch-command owner is kept because that ownership split is real here and upstream has no equivalent.bin/fm-bootstrap.shHOME_SUMMARY:; the sweep count drops from eleven to ten. In the code, the deletedfm-pr-check-migrate.shcall goes and the fork'sfm-endpoint-binding-migrate.shandfm-run-attribution-legacy-transition.shcalls immediately below it stay. Upstream'sFM_FLEET_PRUNEheader line was not re-added: the fork deliberately pruned that duplicate, andbin/fm-fleet-sync.showns it.bin/fm-fleet-snapshot.shFM_SNAPSHOT_CREW_STATE_TIMEOUT, which the fork already implements asFM_SNAPSHOT_TASK_TIMEOUTwith a floor, an inner no-mistakes hand-down, a parallel fan-out, and an explicitsource:"timeout"record. The ledger requires this file to end a round with exactly one of those contracts, so upstream's second name was not introduced.bin/fm-push-transition-lib.shmark_surfacedfrom a last-line comparison to an offset-and-identity presentation-marker commit, and addedhb_surfaced_offsetandmark_surface_reported. All three taken whole. The fork's_reconcile_surfaced_open_decisioncall was carried into the newmark_surfacedbecause that marker keys on the task's endpoint rather than on the status log's position, so it is orthogonal to what upstream changed and would otherwise have been silently retired.bin/fm-session-start.shprintfsites naming the migration merged without a conflict.bin/fm-supervise-daemon.shescalate_addactually buffered the escalation. The stale/wedge arm carries the fork's run-progress hold, whose three escalation branches all shared onestale_marker_removebelow them, so anescalatedflag carries upstream's gating across all three without duplicating the removal. In the declared-wait arm, the fork'spause_streak_bumpmoved inside upstream'sif, because a recheck that was never recorded must not widen the window it never sent.bin/fm-teardown.shbin/fm-test-run.shfm-pointer-check,fm-run-progress,fm-agy-smoke,fm-gbrain-*, andfm-cmux-claude-composer-live-e2eentries and upstream'sfm-harness-adapter-referencesandfm-harness-adapter-instructions-live-e2eentries all survive. The serial weight-hint table was merged row-wise: fork values win where both sides measured, 32 upstream rows for scripts the fork had not hinted were added, and the one row naming a script that no longer exists after a rename,fm-cursor-agy-adapter.test.sh, was dropped. The changed-file family map keeps the fork'sstowarm and its.agents/skills/*/*.mdreach, and adds upstream'sharness-adaptersarm.--check-coveragepasses:total=217 parallel=24 serial=155 serial_shards=8 herdr=12 optin=26.bin/fm-watch.shmark_all_captain_relevant_surfaced. The fork had not changed this function, so upstream's endpoint-driven rewrite was taken whole. Every other upstream hunk in this file, including the removal of the migration reference, merged cleanly beside the fork's run-progress and declared-wait code.docs/configuration.mdFM_SNAPSHOT_CREW_STATE_TIMEOUTrow was removed for the same ledger reason as the script; itsFM_HOME_SUMMARY_FAILURE_REPORTrow was kept.docs/documentation-audiences.jsonharnesses/*.mdentries replaced by upstream's twelvereferences/**entries, withreferences/harness/agy.mdinserted in order. Valid JSON, 123 surfaces, andbin/fm-doc-audience-check.shpasses.docs/scripts.mdfm-pr-check-migrate.shrow removed with the script. Thefm-harness-adapter-doc.shrow was removed in the follow-up commit for the same reason. The fork'sfm-endpoint-binding-migrate.shandfm-run-attribution-legacy-transition.shrows are kept.docs/verification/muse.mdharnesses/path.tests/fm-spawn-dispatch-profile.test.shfm_test_spawn_brief's third argument, and the fork's Claude-config resolution recording moved intotests/fixtures.shas a second env-gated recording on the samesend-keyspayload, inert wheneverFM_FAKE_RESOLVED_CLAUDE_CONFIG_LOGis unset. The fork'stimeout -kpass-through shim and its comment stay in the suite because they are specific to this suite's bounded calls.tests/fm-test-run.test.sh.agents/skills/example/template.mdcase, which pins the.agents/skills/*/*.mdreach, and upstream's two harness-adapters files both exist, so all three selection cases run.tests/fm-watcher-lock.test.shmark_pr_check_migration_completehelper and its five call sites removed. The fork'sbeacon_stamphelper and its TERM-resistant peer fixture, including the widened readiness poll and the comment explaining why it exists, are kept; upstream did not change that fixture this round, it only sat next to a deleted line.Deliberate changes to files that did not conflict
tests/fixtures.sh(new, from upstream)tests/fm-spawn-dispatch-profile.test.shcould adopt the shared builder instead of keeping a second stub. The addition is env-gated the same wayFM_FAKE_LAUNCH_LOGandFM_FAKE_DUPLICATE_WINDOWalready are, so every other suite is unaffected.tests/fm-home-summary-refresh.test.sh(from upstream)FM_SNAPSHOT_CREW_STATE_TIMEOUT=2, a name this fork does not have, which would have left the case named "producer bounds each per-task current-state read" no longer bounding what it names. Repointed toFM_SNAPSHOT_TASK_TIMEOUT=2, at that variable's documented floor. Upstream's assertion, message, and exit code are untouched. This is a fixture repair, not a divergence.tests/fm-remote-job.test.sh(from upstream)tests/fm-run-attribution-legacy-transition.test.sh(fork-only)bin/fm-control.shproof=agent-aliveis quoted. Zero behaviour change, and the proof token is unchanged; in the merged source graph ShellCheck's dataflow reads the unquoted literal as arithmetic and raises SC2100, which failsbin/fm-lint.sh. Upstream made the same class of change in this very round by renaming its ownnote-filesentinel tonote_file, but the reported proof token here must stayagent-alive, so it is quoted instead of renamed.bin/fm-bootstrap.sh,bin/fm-teardown.sh# shellcheck disable=SC2030directives, each naming the reason. The subshell-scopedexport FM_TIMEOUT_KILL_GRACE=5andexport FM_WRITE_BACK_BUDGET=$budgetare deliberately subshell-local, as the comments directly above them already say. They lint clean on both parents and only fire in the merged graph, where ShellCheck's dataflow reaches the outsidefm_run_timedcalls that correctly keep the default.docs/fork-divergence.mdFiles that merged with no decision
Sixty-nine paths took upstream's change with no fork content adjacent, or took the fork's with no
upstream content adjacent. Every upstream-added line in the round was checked mechanically against
the merged tree: of 3,803 added lines across 69 files, 35 are absent, and all 35 are the deliberate
resolutions listed above. The same check in the other direction over the fork's own additions since
the merge base, restricted to files upstream also touched, finds 114 fork lines absent from 9,297,
and all 114 are the same set: the fork's retired split-mechanism prose, the corrected sweep counts
and enumerations, the retired migration references, the two daemon lines that now end in
&& escalated=1, the moved dispatch-profile fixture code, and the repointed audience paths.Ledger changes in this round
docs/fork-divergence.md:Added a retired-divergence entry, "Fork-local harness-adapters split and its routing script -
retired 2026-09-04", recording C1 as the sixth capability collision resolved by the remote-doctor
precedent, what was taken, what was re-homed and where, and why the runtime refusal did not need
porting. Fork PR
HelloWorldSungin/firstmate#191had never been recorded in the ledger; it is now,as the retired side of this collision.
Changed "Agy crew adapter": its contract link moves from
harnesses/agy.mdtoreferences/harness/agy.mdand now names the routing artifact that reaches it.Changed "Fleet snapshot per-task timeout and abandoned child work": records that upstream
reintroduced
FM_SNAPSHOT_CREW_STATE_TIMEOUTa second time withkunchenguid/firstmate#3273, thatthe fork's single contract was kept again, and that
tests/fm-home-summary-refresh.test.sh'sbounded-read case was repointed so it still bounds the read it names.
Changed "Watcher live declared-wait routing and self-widening recheck cadence": records the
kunchenguid/firstmate#3268collision and thatpause_streak_bumpmoved inside upstream'sescalation gating, so a recheck that was never recorded no longer widens the window it never sent.
Changed "Remote job worker descendant reaping": a note added under the existing entry, as a
consequence of that divergence rather than a new one, recording that a whole-group stop of this
worker deliberately leaves ownership quarantined, what that forces on any fixture that stops the
worker, and that whether the reap should grant its own child time to finish is deliberately not
decided here.
No active divergence was retired by this round, and none was created. The ledger's active-entry
count is unchanged.
Parked branches
docs/fork-divergence.md"Parked branches outside the fork baseline" lists five deliberatelyunlanded branches:
fm/fm-afk-injection-wedge,fm/fm-crew-state-blind-during-fix-round,fm/fm-parked-decision-stale-noise,fm/fm-subagent-model-routing-guard, andfm/fm-vault-drift-check. None entered this round; each was checked against this branch's history:Nothing was merged from, rebased onto, resurrected from, or cherry-picked out of any of them.
Pushed head and mergeability
Exact pushed head:
1eb341ce5c3f5688c6571e5f1d75ac05e7e8493aLocal
HEADandorigin/fm/fm-upstream-sync-2026-09-02-round-3are the same commit, so what wasreviewed is what was pushed:
Mergeability:
mergeable: truemeans there is no conflict withmain.mergeable_state: unstablemeans exactlyone required check is red, which is the by-design no-mistakes signature check below - not a conflict
and not a second failure.
The merge parentage that must survive landing:
Two parents: the fork base and the round endpoint. That second parent is the entire point of the
round, and it exists only if this lands as a merge commit.
Expected red check
This round ships
direct-PR, not through the no-mistakes pipeline: that pipeline rebases ontoorigin/main, which would replay and linearize this merge-only branch and destroy the upstreamparentage the whole sync strategy depends on. The fork's compliance workflow still requires a
no-mistakes signature, so
PR must be raised via no-mistakesis red by design. Every otherrequired check must pass.
Landing
Do not squash. This must land with a merge commit:
bin/fm-pr-merge.shdefaults to squash, and squashing would lose the upstream parent, keep themerge base from advancing, and make every future round re-present these same five commits.