Repository navigation
feat(bin): report underused spend-lane capacity at heartbeat review - #316
Merged
Merged
Conversation
Add bin/fm-underused-capacity.sh, a read-only deterministic comparison of each spend lane's quota windows and live workers against the pool's free slots and the dispatchable queue count. It prints one idle capacity line per lane whose fresh five-hour window is at or above a configurable threshold and whose weekly window is not behind pace, and never dispatches. Expose the queue's full-set dispatchable count from fm-queue-snapshot.sh and wire the report into the heartbeat review with a docs line and fixture tests for idle, saturated, quota-tight, and empty-queue cases.
sKeLe100
pushed a commit
that referenced
this pull request
Nov 23, 2026
…he upstream catch-up Fork main moved from 397c859 to 968740b while the catch-up branch was in validation, leaving the PR in conflict with its base. This is a true merge of origin/main into the branch, never a rebase, so the 221-commit upstream merge and its resolution commits stay intact. Three conflicts, each an additive same-spot insertion kept on both sides: - .agents/skills/operational-home-layout/SKILL.md: the branch's ready-after-green, record-export-root and status-archive rows plus main's underused-capacity-threshold row (#316), in sorted order. - bin/fm-test-run.sh: the branch's fm-capacity.sh and fm-lane-vitals-lib.sh mapping arms plus main's fm-dispatch-calibration.sh and fm-llm-usage-lib.sh arms (#318). - tests/fm-tool-update-check.test.sh: upstream's test_a_failing_probe_still_reports_its_version plus main's test_windows_interop_copy_is_never_a_candidate (#319), both run.
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
Session gap 2026-11-21: file every gap from this session as priority 0, PC01, within resources. At bearings and each heartbeat, compare /fleet's per-account windows with standing orders (e.g. the order to keep an account's workers filled) and act or report when capacity idles; the captain had to ask. On 2026-11-22 the same gap recurred: the fleet sat nearly idle with Claude #2 at 98% and OpenCode Go at 100% while queued work waited.
What Changed
bin/fm-underused-capacity.sh, a read-only script that combines per-lane quota windows, the pool's free slots and the queue's dispatchable count. It printsidle capacity: <lane> <pct>%, <n> free slots, <m> dispatchable, live=<k>for each lane whose five-hour window has headroom, whose weekly window is not ahead of pace, while a free slot and dispatchable work both exist. It exits 1 if a required source can't be read, so a broken read is never reported as "nothing idle". The threshold defaults to 50% and can be set throughconfig/underused-capacity-threshold,FM_UNDERUSED_FIVE_HOUR_MINor--threshold.bin/fm-queue-snapshot.shnow emits adispatchable: <n>line. It counts dispatchable items across the full queued set before--limittrims the rows.docs/configuration.md,docs/architecture.md,AGENTS.mdand the operational-home-layout skill. Addedtests/fm-underused-capacity.test.shand extendedtests/fm-queue-snapshot.test.shfor the new line.Risk Assessment
✅ Low: The fix round correctly inverted the weekly-pace filter to skip only
aheadlanes, the fixtures and the threshold-precedence test now exercise the right cases, and the new script is read-only with loud failure exits.Testing
The baseline suite passed. I ran the focused test and drove the real script on synthetic snapshots. Weekly-behind lanes were reported, the weekly-ahead lane was silenced, and an empty queue gave no output. The test's threshold-precedence case now sets FM_HOME, and the script and its test cover the corrected pace rule.
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 2 issues found → auto-fixed ✅
bin/fm-underused-capacity.sh:238- The weekly-window filter is inverted. quota-axi'space.statusisaheadwhen the lane is burning faster than the clock (a live reading showsaheadwith burnMultiple 1.13 and a negative reserve), andbehindwhen it is under-spending with positive reserve. fm-resource-snapshot.sh:734 passes that status through aspace. The script drops a lane whose weekly window readsbehind, so it silences the lanes with the most unused capacity, and it reports lanes that areaheadand overspending. This defeats the intent, because the 2026-11-22 incident was OpenCode Go at 100% and Claude fix(pending-reply): force bounded remote-reply poll before escalating #2 at 98% sitting idle, and those lanes would most likely read weeklybehind. The same inverted rule is restated in the header (bin/fm-underused-capacity.sh:21-26), in AGENTS.md:293 (weekly window is not behind pace) and in the test fixtures. tests/fm-underused-capacity.test.sh:51-62 and the test 1 expectation at lines 83-86 encode it: claude#1 weeklyaheadis reported, while opencode-go (rolling 99%, weeklybehind) and claude#2 are silenced. The tests only mirror the implementation's rule and have no independent oracle. Fix: skip the lane when the weekly pace isahead, or drop the weekly gate. Then flip the fixtures so a lane with a weeklybehindreading is reported, which is the case that would have caught the incident.tests/fm-underused-capacity.test.sh:125- The final--threshold 70run in test 6 omitsFM_HOME="$d", so the config file is never consulted in that run. The case passes regardless of whether the flag actually beats the config file, which is the precedence the comment says it checks. Set FM_HOME for that run, with a config value that would otherwise silence the lane, so the test can fail if the flag stopped winning.🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
bin/fm-test-run.sh --changed --exclude-family real-herdr-gated --exclude-quarantined --pc02-if-idlebash tests/fm-underused-capacity.test.shbin/fm-underused-capacity.sh run against a synthetic snapshot with free slots and dispatchable worksame run with zero dispatchable items✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.