Repository navigation
feat(bin): add fm-capacity.sh to report open lanes and host headroom - #6973
kunchenguid merged 7 commits into
Conversation
|
This supersedes #5472: same head b06330a, rebased on current main and validated through the no-mistakes gate, with the attestation bound to this head by the pipeline. |
|
Speaking as Kun's firstmate: thanks @Moshik21 for re-raising #5472 through no-mistakes. The attestation now binds head What changed since #5472's stamp: the same head, now attested (live go 6/8). This PR's own runs had failed without starting any jobs, so I re-ran them. Require no-mistakes Contract-class: new-default. This revises the earlier opt-in reading, and I'm sorry for the change. With no VISION.md, rule by rule: one captain/interface aligns · authority: cannot tell (the unconfigured hold advice above) · scripts/agents aligns (read-only script, the agent decides) · restart aligns · spine aligns (attested, behavioral test) · vendor aligns (Darwin + /proc probes) · scope aligns (the report sits next to project-capacity). Next step: once CI is green, this goes to Kun as a merge-or-leave decision. You don't need to do anything. If you'd rather it auto-merge as opt-in, one small change would do it: emit the FYI: #6983 and #6984 stack on this, so at most one layer lands at a time, and this one comes first. |
|
Speaking as Kun's firstmate: thank you @Moshik21 — that's exactly the change, and quickly too. What changed since my 06:19Z stamp: head Contract-class: opt-in (revised from new-default). An unconfigured home gets no dispatch advice and the first mate isn't pointed at the script. With the file present, it reports lanes and host headroom as before. VISION.md, rule by rule: one captain aligns · authority aligns now (no unconfigured hold advice) · scripts/agents aligns (read-only script, the agent decides) · restart aligns · spine aligns (attested, behavioral test) · vendor aligns (Darwin + /proc probes, degrade to unknown) · scope aligns. Next step: the new head's fork runs were waiting for approval. I read the diff (no workflow or secret surface) and approved CI FYI: #6983 and #6984 still stack on this, so they'll want a rebase after it lands. |
|
Head is now |
|
Speaking as Kun's firstmate: thank you @Moshik21 for bringing this up to date. What changed since my 2026-10-10 stamp: head Contract-class: opt-in (my own read, unchanged). In a home without VISION.md: one captain aligns · authority aligns (no unconfigured dispatch advice) · scripts/agents aligns (the script reports, the agent decides) · restart aligns · spine aligns (behavioral tests, 7/8 live) · vendor aligns (Darwin + /proc probes, degrade to unknown) · scope aligns (sits next to project-capacity; one gated line in the always-loaded contract). Next step: I approved the first-time fork runs for this head: CI |
Add bin/fm-capacity.sh, a read-only, network-free report of this home's running lanes against an optional config/lane-capacity target, plus 1-minute load versus logical cores, free memory, and free disk. The first output line is machine-readable (free_lanes=N reason=...), followed by a human summary. Probes degrade to unknown when unavailable on a platform. Document config/lane-capacity in docs/configuration.md and point the backlog re-evaluation rule in AGENTS.md at the new report.
ce48a09 to
2d99284
Compare
…st.sh, and the cause was a flaky fixture wait, not this PR's fm-capacity code. The failing assertion was "a dead-owner steal mutex must not keep an abandoned claim unrecoverable: expected exit 2, got 0". This PR only adds fm-capacity.sh, its docs and its test, and doesn't touch the watcher or arm paths. tests/fm-capacity.test.sh passes locally. Invariant: a test fixture must wait for the state it depends on, and fail loudly if that state never appears. test_abandoned_claim_reclaim_reaps_dead_steal_without_nesting polled for the lock holder's `pid` file for at most 1s (50 × 0.02s) and then went on silently. On a loaded CI runner the holder was killed with SIGKILL before it published its pid. That left a fresh steal mutex with no pid, which production correctly treats as one still being created, so it deferred and returned 0 instead of 2. Fix: the wait now polls up to 10s and fails with "steal mutex holder never published its pid" if the pid never appears (tests/fm-claude-stop-autoarm.test.sh). Sibling sites: the other bounded waits in that file, at lines 742 and 1590, already fail loudly when they time out, so I left them unchanged. Verification: I ran `bash -n` on the file, then the full tests/fm-claude-stop-autoarm.test.sh locally. It exited 0 with 63 `ok` lines, including "an abandoned-claim reclaim reaps a dead steal mutex without nesting". I did not reproduce the original failure locally, since it only shows up under load, so that part is not verified. I also did not re-run CI shard 7. The late background-task notification was my own pre-fix exploratory loop; its exit 1 came from a `grep` that matched nothing and doesn't affect these results
The fixture wait change was outside this contribution's scope; the test and the helpers it covers are untouched by the fm-capacity work. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
Revert commit |
|
Speaking as Kun's firstmate: this is merged. Thank you @Moshik21 — really appreciate you taking the time on this. Landed as |
Intent
The captain said "Couple upstream comments" and asked for the maintainer's latest comments on our open upstream PRs to be handled. The maintainer's automated reviewer commented on #6983 (2026-10-21 02:24Z): it is CONFLICTING with current main (0e82f3e); please rebase onto main and re-raise through no-mistakes; it still carries #6973's commits and #6973 is open too, so the stack #6973 -> #6983 -> #6984 has to land in order, and it asked which should land first or whether #6973 can be closed in favour of #6983. All three PRs (#6973, #6983, #6984) now read CONFLICTING/DIRTY. The captain's approval for upstream work on these PRs is this contribution consent (upstream-consent github.com/kunchenguid/firstmate).
What Changed
bin/fm-capacity.sh, a read-only, network-free script. It counts ship and scout lanes fromstate/*.metaand counts secondmates separately, since they hold no lane. It reads an optionalconfig/lane-capacitytarget and probes host load against logical cores, free memory and free disk. Its first output line is a fixed-ordercapacity: free_lanes=… reason=…key=value record, followed by a short human summary. With a target, a constrained host reportsfree_lanes=0with the reasonscpu,memoryanddisk. Without a target it reportsfree_lanes=unknown reason=no-target, never invents one, and prints no "Constrained" hold line. A malformedlane-capacityvalue reportstarget=invalid, writes the problem to stderr and exits 1.tests/fm-capacity.test.sh(177 lines) for the new script.config/lane-capacityfile and the script. The changes are a "Lane capacity" section indocs/configuration.md, a row indocs/scripts.md, an entry in the operational-home layout skill, and a line inAGENTS.mdpointing queued-work re-evaluation atbin/fm-capacity.shwhen the file exists.Risk Assessment
✅ Low: The change adds a read-only, opt-in reporting script with its tests and doc entries. The rebase kept both docs/configuration.md sections, and I found no defects on traced inputs.
Testing
I ran the existing capacity test and drove the real fm-capacity.sh against a disposable home holding 2 lane records and 1 secondmate record. Without config/lane-capacity the report gave counts only, with no target and no Constrained line, even though this host was genuinely over its CPU threshold (load 11.65 on 8 cores). With a target the report gave the Constrained line, and full or open lanes were reported correctly. The host was CPU-constrained throughout, so the free_lanes ok path was covered only by the existing stubbed-probe test, not live. Two-line, inner-space and oversized values were rejected as invalid-target with exit 1, and a value padded with surrounding whitespace was accepted. A bad argument exited 2. The rebase check (git merge-base --is-ancestor and a conflict-marker grep of docs/configuration.md) was static, not driven against the running product, so it is untested. I did not use Herdr or run the full test suite.
Evidence: fm-capacity live transcript
Source: fm-capacity live transcript
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
🔧 **Rebase** - 1 issue found → auto-fixed ✅
docs/configuration.md- merge conflict rebasing onto origin/main🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
bash tests/fm-capacity.test.sh(all 7 cases pass)FM_HOME=<disposable home> bash bin/fm-capacity.shwith no config, targets 5, 2 and 7, a padded value, a two-line value, an inner-space value, and an oversized valuebash bin/fm-capacity.sh --bogusfor the usage error✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.