Repository navigation
feat(fm-capacity): add opt-in max_fleet_agents machine-wide ceiling - #55
Merged
Merged
Conversation
Add a max_fleet_agents setting to config/spawn-capacity, default off, that refuses a spawn when the machine-wide agent count is at or above it. The count is the same "across N agents" figure the fleet-memory signal reports, so the knob and the printed row agree on what an agent is. An unreadable count follows the existing on_unknown policy. Covered by colocated tests for absent/off, at-or-above refusal with the measured and wanted numbers, below-the-ceiling admission, unknown-policy behavior, and malformed values.
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.
Add
max_fleet_agentstoconfig/spawn-capacityWhat and why
The machine-capacity guard (
bin/fm-capacity-lib.sh) weighs the fleet by memoryfootprint, so a fleet of many small agents can sit well under the fleet-memory
limit. There is no knob for a machine-wide headcount ceiling, even though a home
may have a standing rule of that shape.
This adds one opt-in setting,
max_fleet_agents. It is default OFF: absent oroffmeans no agent-count ceiling, exactly as today. A positive integer makesthe guard refuse a spawn when the machine-wide agent count is at or above it.
The counted figure is the same
across N agentsmeasurement the fleet-memorysignal already prints, so the knob and the printed row can never disagree about
what an "agent" is. The setting is generic and per-home; no host-specific value
is baked in.
Because the counted total comes from the same probe, an unreadable count follows
the existing
on_unknownpolicy rather than silently passing.Changes
bin/fm-capacity-lib.sh- newmax_fleet_agentskey (parse, default,evaluation row), documented in the header that owns the config format.
docs/configuration.md- operator-facing table row under "Machine capacity(config/spawn-capacity)".
tests/fm-spawn-capacity.test.sh- colocated coverage for the new gauge.No existing gauge is disabled, loosened, or reordered.
Verification
Actions minutes are exhausted on this fork, so these local runs are the CI
evidence for this change.
tests/fm-spawn-capacity.test.shManual
bin/fm-capacity.shwith the key set both waysMeasurements injected so the reading is deterministic. Same fleet count (4) in
both runs; only
max_fleet_agentschanges.bin/fm-lint.shon the changed shell filesCode Review (Stage 1)
Code Review (Stage 2 - independent second-level review)
Independent second-level review by an OpenCode Go reviewer on a different model than the implementing worker (muse-spark reviewing deepseek), on branch commit 4b12144 against origin/main.
Verdict: PASS - correct, safe, minimal, well-tested, lint-clean; no defects; no changes requested.
Evidence: all 26
tests/fm-spawn-capacity.test.shtests pass (including the 6 new agent-ceiling tests and every pre-existing test, no regressions);bin/fm-lint.shexits 0 with pinned ShellCheck 0.11.0 and actionlint 1.7.12. The reviewer independently confirmed: the new gauge reuses the single fleet-agent measurement (no second definition of "agent"); the at-or-above boundary is correct; absent/offis identical to today; an unreadable count follows the existingon_unknownpolicy; no existing gauge is touched or reordered; the refusal leaves running work untouched; no host-specific value is baked in; the contract lives only in thebin/fm-capacity-lib.shheader and the singledocs/configuration.mdrow. Full report:data/fm-pr55-second-level-review/report.md.Code Review (Stage 2 - independent second-level review)
Independent second-level review by an OpenCode Go reviewer on a different model than the implementing worker (muse-spark reviewing deepseek), on the PR head against origin/main. Verdict: PASS - reviewed, no defects; full report:
data/fm-pr55-second-level-review/report.md.