Repository navigation
feat: set afk spend cap from live ordinary workers at entry - #7308
Merged
kunchenguid merged 2 commits intoOct 15, 2026
Merged
Conversation
added 2 commits
October 14, 2026 22:21
Ohne ausdrückliches --spend nimmt der Eintritt in den Away-Modus die Zahl der gerade im Home stehenden gewöhnlichen Worker als Obergrenze, damit der Modus laufende Parallelität nicht einengt. Der bisherige Default bleibt Untergrenze, 0 bleibt ausgeschlossen, und ein ausdrückliches --spend gewinnt weiterhin. Die Zählung bekommt mit `live-workers` genau eine Implementierung in bin/fm-afk-contract.sh. bin/fm-spawn.sh liest sie dort statt mit einer eigenen Schleife, sodass Eintritt und spätere Sperre nicht auseinanderlaufen können.
Intent
erhoehe die parallelitaet in afk modus auf die Zahl, die beim Einschalten des Modus gerade vorliegt.
What Changed
--spend, AFK/quiet entry now recordsspend_max_concurrent_workersfrom the home's live ordinary worker count at entry time, floored at the existing default so idle homes still keep normal headroom and never record 0.fm-afk-contract.sh(live-workers/fm_afk_contract_live_ordinary_workers) and hasfm-spawn.sh's away spend-cap refusal read the same helper instead of counting.metafiles itself.--spendstill winning.Risk Assessment
✅ Low: Bounded, well-owned change that lifts the AFK spend cap to the live ordinary-worker count at entry (floor 4), reuses one counter for spawn refusal, and keeps explicit --spend authoritative.
Testing
Targeted AFK contract, launch, and spend-cap spawn tests all passed; a product-level CLI transcript plus the written
.afk-contractshow entry taking the live ordinary worker count as the spend cap, spawn refusing past that shared counter, the default floor of 4 on idle/low homes, and explicit --spend still winning.Evidence: CLI transcript: AFK spend cap from live worker count at entry
Source: CLI transcript: AFK spend cap from live worker count at entry
Evidence: Persisted away record with spend_max_concurrent_workers: 6 from live count
Source: Persisted away record with spend_max_concurrent_workers: 6 from live count
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.
bash tests/fm-afk-contract.test.sh(includes live-count entry cases)bash tests/fm-afk-launch.test.shtest_away_record_relocates_main_owned_actions_to_the_branch/test_away_branch_spawn_requires_queued_dispatchable_work/test_away_spend_cap_is_rechecked_under_the_task_set_lock/test_quiet_record_never_caps_a_present_captains_spawnfromtests/fm-branch-supervision.test.shManual CLI demo: enter with 6 live ordinary workers → cap 6; spawn of 7th refused; below-floor/empty homes keep floor 4; explicit--spend 2wins over live 6✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.