acpmux: admit a new session only while this host has room (1/3 of #24281)
Summary
Part 1 of 3 of #24281, split to stay under about 800 changed lines. The code and tests are #24281's at da7658bf (which had an independent Codex SHIP there), with only the cut points chosen.
About 25 Codex reviewers started with a raw acpmux new over reach went around lane-place's cap of 12, filled huge-blue's disk and pushed its load to 50-80. Every new session goes through the daemon's create, so the daemon now refuses one when:
~/.cache/worktree-reclaim/under-floorexists (the disk is under its free-space floor), or- this host's live sessions are at
lanes.max_lanesfor this machine in the fleet registry (FLEET_REGISTRY, else~/.ssh/config.d/fleet-registry.json, else leo-workspace'smachines/fleet-registry.json).
What is checked:
- In this part:
session/new(no adopt, or an adopt that may fork),session/forkand the composer's aside (_acpmux/ask). - Never checked: sends, resumes, restarts, side chats, handoff targets and adopts that never fork.
How it behaves:
- An admitted create counts as live until it ends, so concurrent creates at the cap cannot all pass.
- A create refused while another create holds its name says the name is taken, so
new --reusetakes the winner. _meta.acpmux.forceAdmit, from this host's socket or app only, admits past a refusal. So does the person's own new chat. Both are logged.- With no registry, or no
lanesentry for this machine, every create is admitted, so acpmux outside the fleet is unchanged.
What each later part adds:
- Part 2: the CLI side (
--force-admitonnew,forkandnew --parent, exit 5 on a refusal), sub-session starts, and the CLI integration tests (tests/admission.rs,tests/admission_subsessions.rs). - Part 3: adopts. An adopt of a conversation a session holds attaches and needs no room. One whose holder ends first asks for room. Concurrent adopts of one conversation converge (
admit_adopt,NewRequest::attach_only,tests/admission_adopt.rs).
Testing
Run on huge-blue with a scratch HOME, because this host's own under-floor flag is set and the daemon would otherwise read it:
cargo test -p acpmux --lib: 981 passed, 30 failed. Base 2815ee94 fails the same 30 here (temporary-folder, store-permission and TUI tests that depend on this host's TMPDIR) and passes 972. The 9 extra passes are the newhub::admissiontests.cargo test -p acpmux --test hub_integration: the same failures as base, plusstalled_turn::a_turn_counts_from_its_prompt_being_writtenonce. It then passed 4 of 4 reruns.subsessions,agent_tools,local_app_trust_gate,remote_guardandsession_envpass.send_attach_familyandremote_guard_modesfail the same way on base.cargo fmt --checkandcargo clippy -p acpmux --all-targets -- -D warningspass.
Observed / Not run
- Observed: the runs above.
- Not run here: the CLI integration tests of the refusal itself. They land with part 2, because they drive
--force-admitand exit 5.
Changelog
Added: acpmux refuses a new agent session while its host's disk is under its free-space floor or the host is at its fleet lane cap; --force-admit overrides
Proof
No capture: daemon-only change.
Checklist
- Behavior changes have added or updated tests, or Testing says why not
Risk: high (session admission policy). It lands on an independent review receipt at the head.
š¤ Generated with Claude Code
Agent session: agent session
![View with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3-3x.png)
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Need help on this PR? Tag @codesmith-bot with what you need.