Repository navigation
Conversation
[High impact] The PR appears safe to merge; no new actionable defect was found. Reviews (14) · Last reviewed commit: "no-mistakes(document): Correct heartbeat..." · Reviewed by Greptile |
|
Filed the design discussion as #6757 so this change has an issue-first trail; the reproduction and expected behavior live there. |
|
Speaking as Kun's firstmate: thanks, @kesslerio. This is a careful change, and opening #6757 alongside it made the motivation easy to follow. I read the whole diff of head What I checked:
The no-mistakes attestation matches this head. CI is fully green, including "PR must be raised via no-mistakes", and the merge state is CLEAN. Contract-class: new-default. On main an unconfigured home never wakes MAIN or escalates on a heartbeat just because queued work is ready. The daemon force-self-handles heartbeats and the attended watcher absorbs them. This PR adds a readiness-driven wake and escalation to both by default. It also changes the away contract in Things Kun will weigh (no action needed from you unless you want to address them):
VISION.md, rule by rule
Next step: this is otherwise ready, so it now waits on Kun's merge-or-leave decision. That's on him, not on you. Related: #6757. |
a5dffea to
3eff668
Compare
|
Speaking as Kun's firstmate: thanks for the new round, @kesslerio. I re-reviewed head What changed, and it helps:
Why this isn't otherwise ready right now (waiting on you):
Contract-class: new-default (no change). On main, an unconfigured home never wakes MAIN or escalates on a heartbeat just because queued work is ready. With this PR, both the daemon and the attended watcher wake on ready (or unreadable) readiness by default, and the attended handoff rules change. The away widening is now gone, which narrows what Kun has to decide, but the heartbeat wake class is still a new default-on surface. VISION.md, rule by rule
Next step: you, for the rebase (and a serial 2 that finishes). Once it's otherwise ready again, it goes back to Kun for merge-or-leave. |
b884daa to
d09b0fe
Compare
|
Speaking as Kun's firstmate: thanks @kesslerio. The rebase kept both meanings in I re-read head State: the attestation matches this head. CI is fully green: run 37850896719, including serial 2, plus "PR must be raised via no-mistakes". The merge state is Since Contract-class: new-default (unchanged). On main, an unconfigured home never wakes MAIN or escalates on a heartbeat just because queued work is ready. With this PR, the daemon and the attended watcher both wake when ready work exists or readiness can't be read. That's a new default-on wake class, so it doesn't auto-merge. What Kun is weighing (nothing needed from you):
VISION.md, rule by rule
Next step: this is now with Kun for a merge-or-leave decision. It isn't waiting on you. Please hold the head where it is, since a new push would restart the review. |
|
@kunchenguid, field data on the open noise question, in case it helps the merge-or-leave call. Over the night of 2026-10-09 to 10-10, a secondmate home on this host kept its watcher alive the whole night. That watcher logged "absorbed heartbeat (no captain-relevant change)" at 03:16, 05:16 and 07:16, and its interval backed off toward the cap, while its backlog held ready units. One of them, a fix that had been ready since 22:58, was first dispatched at 07:32. The previous three nights show the same shape: quiet logs of 7 to 10 hours with ready work queued. That is the case this PR's (The root home's own gap that night had a different cause: its supervising session was stopped by the host app, so no watcher-side change would have helped there. That is tracked separately.) To measure the noise side, this branch is now running locally on that host at head |
|
Speaking as Kun's firstmate: thanks @kesslerio for the field data — the overnight secondmate log (heartbeats absorbed at 03:16/05:16/07:16 while a unit ready since 22:58 waited until 07:32) is a concrete instance of the gap Delta since my 2026-10-09 stamp: no new push; head is still This remains with Kun for a merge-or-leave decision, not waiting on you. One new note for that call: #7031 splits |
|
@kesslerio, two things that may help the merge-or-leave call: a noise measurement and a conflict resolution. Noise. I ran the watcher on a disposable home with 12 queued items, including items that only follow an external thread and carry no hold. The existing backoff still applies: 10, 20, 40, 80, then 120 minutes between heartbeats. Conflict. I made an unpublished merge of current main into this branch, without rebasing and without touching your remote branch. |
d09b0fe to
26d178e
Compare
|
Speaking as Kun's firstmate: thank you @kesslerio for bringing this current with main, and @tiago-peixoto for the noise measurement (two wakes in the first hour, settling at 0.5/hour under the existing backoff, with follow-up-only items still waking until they carry a structured hold). That's useful for Kun's call. Delta since my 2026-10-11 stamp ( What's blocking right now (waiting on you): "PR must be raised via no-mistakes" fails, because the attestation in the body still binds Contract-class: new-default (unchanged). This is a default-on, readiness-driven heartbeat wake class in both the daemon and the attended watcher. VISION.md: one captain aligns on motive, cannot tell on noise (it is now measured, see above) · authority aligns (away dispatch limited to recorded words or a standing grant) · scripts aligns · restart aligns · spine aligns · vendor aligns · scope aligns. Next step: once the attestation binds the head and CI stays green, this goes back to Kun as the standing merge-or-leave decision. Nothing else is needed from you. |
|
More field data on the noise question, from an attended Claude primary with the supervision host on. It adds two things to the wake-rate measurement above: what the missing ready-work trigger costs today, and how large each handoff would be on a home with a big backlog. Setup. One product-repository home on Claude Code 2.1.29x to 2.1.303, supervision host on by default, herdr backend, macOS, firstmate main as of The gap:
The noise side:
Two changes would keep the default-on wake cheap for homes like this:
|
|
Speaking as Kun's firstmate: thanks @kesslerio for re-raising. And thanks @WTF-Am-ID for the field data, which helps on both sides of the call. Delta since my 10-21 stamp: head What's blocking now (waiting on you): main has moved, and the branch now conflicts (33 behind) in Worth considering while you're in there (not a requirement from me): @WTF-Am-ID's numbers show a home with 405 ready units. Each due heartbeat would carry all of them into the primary's context. Bounding each handoff to free lanes (or a small fixed number, ordered by priority then age, plus a count of the rest) would keep a default-on wake cheap on big backlogs. That would make the merge-or-leave call easier. Contract-class: new-default (unchanged). It adds a default-on, readiness-driven heartbeat wake in both the daemon and the attended watcher. VISION: one captain aligns on motive, cannot tell on noise/handoff size · authority aligns · scripts aligns · restart aligns · spine aligns · vendor aligns · scope aligns. Next step: once it's rebased, re-attested and green, this goes back to Kun as a merge-or-leave decision. |
9011246 to
17dbc56
Compare
|
Speaking as Kun's firstmate: thanks @kesslerio for the new round on head A correction first: my 10-23 note asked you to rebase. Please ignore that. Merge conflicts are ours to fix, and we never ask contributors to rebase. One thing needed from you: live evidence. The attestation's live validation is inconclusive, 0 of 7, and every scenario is untested against the product. That includes the two that matter most: ready queued work reaching dispatch or a durable handoff under attended supervision, and away supervision staying inside the recorded authorization. Could you drive those on a real home, or re-raise with live validation allowed, and post the transcripts? If @WTF-Am-ID's handoff-size point from 10-23 applies to your design, a line on how a big backlog's handoff stays bounded would help too. contract-class: new-default, unchanged. This changes what heartbeat supervision does with ready queued work by default, so once the evidence is in and the full suite is green, it goes to Kun for a merge-or-leave decision. VISION: unchanged from my earlier stamps. Waiting on you, no rush. |
|
Live evidence for head How it was driven
A real Claude primary (sonnet, medium effort, auto mode), a real seeded second mate, and a real supervision host — no fixtures, no fake provider, no synthetic dispatch. Scenario: "A daemon heartbeat with ready queued work reaches dispatch or durable handoff before suppression or acknowledgement." — PASS, liveCreated one genuinely ready unit (no dependency, no hold, no time gate): The live primary was then asked to re-evaluate queued work per AGENTS.md section 10. It loaded The backlog moved Queued → In flight → Done on its own, carrying the report path: The dispatched worker's own report:
So the ready unit reached real dispatch, not just a handoff, with the transition gate satisfied rather than reported over. Scenario: "Empty, held, or unreadable queued work does not silently lose readiness or create an unnecessary dispatch wake." — PASS, liveThe heartbeat's own readiness predicate, in both directions against live backlog state:
The held row kept the wake suppressed and the release restored it, so neither a held unit produced a spurious wake nor did the hold silently swallow readiness. Not established by this runI want to be exact about the remaining gaps rather than overclaim again.
That is 2 of 7 driven fully live and 1 partially, which beats the previous 0 of 7. The lab is torn down; nothing was pushed and no project was modified. |
…and stale evidence
…tive owner pointers
…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
…e verification commands
The away dispatch instruction told the branch to reopen a unit whose spawn succeeded but whose startup it could not confirm. That leaves a queued row paired with a live worker record, and bin/fm-bootstrap.sh heals exactly that pair back to In flight as work this home already owns a worker for. A worker stuck at a trust prompt therefore left the queue without a confirmed starter and without a retry path. Keep the unit In flight, keep its endpoint and record, record the startup stop and retry condition on its note and outcome, and retry by inspecting or relaunching that same endpoint. tests/fm-watch-ready-queue.test.sh pins the emitted instruction and that the reopen guidance is gone.
…riage. The branch `afk_present || fm_ready_queue_needs_review` called `wake "heartbeat"`, so wake() treated it as a plain heartbeat and incremented `.heartbeat-streak`, doubling the interval up to FM_HEARTBEAT_MAX while ready queued work sat unreviewed. The invariant is that any heartbeat surfaced for actionable fleet work (ready/unknown backlog readiness) must reset idle backoff, while a heartbeat that exists only because the away daemon is present keeps plain heartbeat accounting. I split the branch to preserve the original afk short-circuit: an afk-only heartbeat still calls `wake "heartbeat"` (away daemon owns triage; `tests/fm-watch-triage.test.sh:test_afk_heartbeat_preserves_idle_accounting` requires 3 -> 4), while a ready-queue review now calls `wake "heartbeat" actionable`, matching the status backstop below it. No other watcher call site evaluates ready-queue readiness (the away daemon has its own path and was unchanged). Added a regression assertion to test_ready_heartbeat: seed `.heartbeat-streak=3` with an aged `.last-heartbeat`, then assert the ready-queue heartbeat leaves it at 0 (fails before the fix with 4, passes after, for both ready and unreadable queues). Verification: `timeout 300 bash tests/fm-watch-ready-queue.test.sh` all 18 cases pass (including the two ready-queue heartbeat cases exercising the new assertion); the fix was reverted temporarily to confirm the new assertion fails on the pre-fix code; the four heartbeat/afk triage cases run as a bounded subset pass, confirming absorb-increment, actionable-backstop reset, and unchanged afk accounting. Shellcheck reports only pre-existing informational findings on these files
…al defect: the merged tree's portable serial lane packs the largest shard at 1202675ms against the 1200000ms modeled budget. The lane partition is already near-optimal LPT (total weight / shard count), so no rebalance can recover headroom; the invariant is that the largest packed serial shard must stay within 1200000ms at the merge head. Fixed at the owning boundary: bin/fm-test-run.sh PORTABLE_SERIAL_SHARDS 11 -> 12, .github/workflows/ci.yml matrix [1..12] (lane names and job-total stay consistent), and docs/fm-test-portable-shards.md count/provenance lines updated (twelve serial shards, seventeen long-lived Linux jobs). No other of11 references exist; tests derive the count from the runner and CI matrix dynamically. Verification: bin/fm-test-run.sh --check-coverage exits 0 with serial_max_ms=1095694 (simulating main's three added serial members gives ~1106953), --list-lanes exposes exactly 12 shard lanes, and 11/13-shard lane names are refused (exit 2). The focused runner-contract functions for shard partition, coverage guard, hint bounds, exact-budget boundary, and lane refusals all pass; tests/fm-watch-ready-queue.test.sh also passes (18 cases, exit 0). tests/fm-ci-workflow.test.sh could not run here because ruby is absent (it exits with 'ruby is required'); it will run in CI, where the matrix/runner consistency check derives the count. (2) Full suite failed at its first step with FM_CI_FULL=false, the by-design gate requiring a maintainer to add the full-ci label on an outside PR; its FM_CI_LANES_FAILED=true was a consequence of the coverage-guard failure. That check is external to the code (label/attestation gate), so no code change was made for it; once the coverage guard passes, it still needs the maintainer label. code_change_needed is true for the coverage-guard fix
72c20c8 to
c967130
Compare
|
Another data point from a self-hosted fleet running a fork of firstmate: one project home had 171 backlog items that |
|
Speaking as Kun's firstmate: thanks @kesslerio, and thanks @m-moravcik for the second field data point (171 ready items, 2 of 19 lanes working). Head is now Nothing is needed from you. This stays with Kun for a decision. The PR edits |
What Changed
bin/fm-ready-queue-lib.shas the single backlog-readiness verdict shared bybin/fm-watch.shheartbeat triage and the away daemon'shandle_wake, so a heartbeat over ready or indeterminate queue readiness becomes actionable and resets idle backoff instead of being absorbed.Risk Assessment
✅ Low: The changes preserve the accepted dispatch contract, apply actionable heartbeat accounting across postures, retain upstream record hygiene, and consistently update the serial shard count; no material defects were substantiated.
Testing
Ran the shipped ready-queue suite, then independently drove the real watcher CLI in disposable lab homes: ready queued work surfaced an actionable heartbeat and reset
.heartbeat-streakfrom 3 to 0 in both attended and away postures, unreadable readiness escalated instead of being absorbed, an away heartbeat over a proven-empty queue kept plain accounting (3 to 4, wake still emitted for the daemon), and a held unit produced no dispatch wake. The real away daemon, running its own watcher child against a private tmux socket withFM_INJECT_SKIP=heartbeat, escalated ready work as "ready-queue fleet check" into the supervisor buffer while the same daemon stayed silent over an empty queue. The upstream record-hygiene heartbeat block still emitted its check wake, and the coverage guard passes with twelve serial shards while 11- and 13-shard lane names are refused. Verdict: go; every scenario on the derived list passed live. No UI surface exists for this change (shell/daemon CLI only), so evidence is CLI transcripts and state dumps rather than screenshots.heartbeat,.heartbeat-streak3 -> 0,.wake-queuer….wake-queue, streak 3 -> 4check: record hygiene: RECORD_HYGIENE: ...and queues the check row for a home with config/re…bash tests/fm-watch-ready-queue.test.sh20 cases, exit 0Evidence: Watcher posture matrix: streaks, wake rows, drain delivery
Source: Watcher posture matrix: streaks, wake rows, drain delivery
Evidence: Real away daemon with ready queue and FM_INJECT_SKIP=heartbeat escalates ready-queue fleet check
Source: Real away daemon with ready queue and FM_INJECT_SKIP=heartbeat escalates ready-queue fleet check
Evidence: Real away daemon over an empty queue stays self-handled (no escalation)
Source: Real away daemon over an empty queue stays self-handled (no escalation)
Evidence: Preserved record-hygiene heartbeat block emits its check wake
Source: Preserved record-hygiene heartbeat block emits its check wake
Evidence: Coverage guard passes with 12 serial shards
Source: Coverage guard passes with 12 serial shards
Evidence: Portable serial lane names 1of12..12of12
Source: Portable serial lane names 1of12..12of12
Evidence: 12of12 accepted, 11of11 and 13of13 refused
Source: 12of12 accepted, 11of11 and 13of13 refused
Evidence: Shipped tests/fm-watch-ready-queue.test.sh run (20 cases, exit 0)
Source: Shipped tests/fm-watch-ready-queue.test.sh run (20 cases, exit 0)
Evidence: Live driver script for the watcher posture matrix
Source: Live driver script for the watcher posture matrix
Evidence: Live driver script for the away daemon
Source: Live driver script for the away daemon
Evidence: Live driver script for the record-hygiene check wake
Source: Live driver script for the record-hygiene check wake
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
heartbeat,.heartbeat-streak3 -> 0,.wake-queuer….wake-queue, streak 3 -> 4check: record hygiene: RECORD_HYGIENE: ...and queues the check row for a home with config/re…bash tests/fm-watch-ready-queue.test.sh20 cases, exit 0bash tests/fm-watch-ready-queue.test.sh(20 cases, exit 0)bash drive-ready-heartbeat.shrunning the realbin/fm-watch.shfor attended-ready, away-ready, away-unreadable, away-empty, attended-held fixtures, reading.wake-queue,.heartbeat-streak, andbin/fm-wake-drain.shdeliverybash drive-daemon-heartbeat.sh readyrunning the realbin/fm-supervise-daemon.shwith its watcher child on a private tmux socket andFM_INJECT_SKIP=heartbeat, reading the daemon log and escalation bufferbash drive-daemon-heartbeat.sh empty(same daemon, proven-empty queue)bash drive-record-hygiene.shrunningbin/fm-watch.shwithconfig/record-hygieneand a reportable metadata findingbin/fm-test-run.sh --check-coverage(exit 0,serial_shards=12,serial_max_ms=1102468vsserial_budget_ms=1200000)bin/fm-test-run.sh --list-lanes(portable-serial-1of12 .. 12of12)bin/fm-test-run.sh --lane portable-serial-12of12 --list(exit 0, 27 scripts) and--lane portable-serial-11of11/--lane portable-serial-13of13(exit 2, refused)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.