acpmux: an MDM-forced sessions.allowFullAccess off is an upper bound, decided by one predicate (#23322 a1)
Adopted, restructured and split (2026-10-26)
The lane that opened this is gone. Seven review rounds each found one more path into full access, so this is no longer a patch per path. It is rebuilt around one predicate. It is now split into five PRs that each land on their own:
- This PR (a1): the daemon's bound. The predicate, and every start and mode check under it.
- a3 (#25538, stacked on this): approve-all. The policy form of full access, capped only by MDM's off.
- b (#25539, stacked on this): agents already running in full access end when MDM turns it off.
- a2 (#25540, on base): the app's push and the mode menu. Swift and webview only.
- a4 (#25549, stacked on this): agents started outside any session. Model probes and pooled agents never run in full access under MDM's off.
It builds the decision on #23322, quoted word for word:
"#23322 (sessions.allowFullAccess under MDM), decided: an MDM-managed value is an upper bound the user can't override. If MDM sets allowFullAccess=false, Full access is unavailable and the mode menu says "Managed by your organization". If MDM is unset, nothing changes. This only narrows access, so it needs no call from Leo."
The predicate
hub/full_access_bound.rs decides "this agent runs in full access" in one place. runs_full_access(&FullAccessView) returns the form, or None. The view holds everything acpmux knows that can put an agent there:
- argv: the profile pins full access. It is read by the one existing parse,
subsession_guard::argv_full_access. - mode: the current mode is a full-access one.
- undeclared mode: a mode the harness reported without declaring modes (
RemoteFloor::undeclared_mode). - option: any config option holds a full-access value, including the
modeoption. A harness can keepmodes.currentModeIdat an asking mode while itsmodeoption says full access.
Each form is judged by the shared rule start_mode::is_full_access.
The bound (this PR)
- The forced value is kept.
server/chats.rsreadsallowFullAccessandallowFullAccessManagedfrom_acpmux/chat_settings.start_mode_state.rskeeps them instart-mode.json, so they hold across a daemon restart before the app pushes again. - One effective setting.
Hub::full_access_allowedis the settings file's answer under MDM's off. A forced on adds nothing, and with MDM unset it equals base'sstart_mode::full_access_allowed(). Every former call site now reads it.replay_configreads it at each step, as base does. - Starts.
- A profile the predicate flags is refused with
full_access_off(refuse_pinned_full_access), and so is a start that comes up in full access (cap_full_access). - A cold Claude start, which never reaches
cap_full_access, checks again after its process starts and before it is handed out (refuse_started_in_full_access): before a fork's priming turn, over the argv and mode it was spawned with, and before it returns, over what the session now reports (review 31). stop_full_access_agenttakes the child out of its slot first, so the slot's lock is not held while it ends, and bounds the terminate (twiceSHUTDOWN_GRACE); a host that never takes it is then ended by its nonce (review 31).- The pool (
spawn_pooled, every prewarm) starts no such profile either, and the push ends every pooled agent (drain_pool), so none started under the old bound is served. Model probes, and pooled agents that come up in full access, are a4's.
- A profile the predicate flags is refused with
- Mode and option switches.
- A switch into full access is refused before and after
child_for. - A switch the push overtakes, while it waits on the harness, is caught after it writes its mode: the agent ends (
stop_full_access_agent) and the switch answersfull_access_off. The mode is written before that read, and the push writes the off before it returns, so either the switch sees the off or it finished before the push. Agents already in full access at the push are b's.
- A switch into full access is refused before and after
- #25214's guard approval reads the setting at the ask, so under MDM's off a harness guard asks the person.
_acpmux/start_modeanswers"fullAccess": "managed"while MDM forces it off.
Past review findings, each now a case or a unit test of the predicate:
| Round | Finding | Where it is covered |
|---|---|---|
| 1 | A profile pinning full access in argv (--yolo) started anyway; the start_mode answer was stale | a1 BOUND "round 1 and 2: a profile pinning full access in argv does not start"; "the off holds across a restart" |
| 2 | Other argv spellings (--permission-mode=bypassPermissions, -sdanger-full-access, -csandbox_mode=..., -y, --approval-mode yolo); agents already running or adopted | a1 BOUND pinned profiles (all spellings); b RUNNING "round 2: an agent running in full access takes no more work" |
| 3 | Check-then-act races (#25214's guard approval; a forward after child_for) | a1: the guard approval reads the managed off again under the prompt's locks (full_access_guards); b: child_for and the start path call end_if_runs_full_access under the spawn lock |
| 4 | Startup adoption resumed a full-access host; a mode switch racing the push | b: adopt_agent_hosts ends it (durable_agents a_retained_full_access_host_ends_once_mdm_turns_full_access_off); a switch re-checks after it writes its mode |
| 5 | A mode the harness reports without declaring modes, and other config options; unadoptable hosts | predicate forms UndeclaredMode and Option; b RUNNING round 5 cases; durable_agents an_unadoptable_full_access_host_ends_once_mdm_turns_full_access_off |
| 6 | An approve-all decision outliving the push; an undeclared mode across a restart; an older webview probe | a1 full_access_turned_off waits on every session.permissions lock; b read_back_undeclared_mode (durable_agents a_retained_host_that_moved_itself_into_full_access_ends_once_mdm_turns_it_off); a2 probe tickets |
| 7 | The mode config option saying full access while modes.currentModeId asks | predicate Option includes the mode option; b RUNNING "round 8: a harness whose mode option says full access while its mode asks ends"; unit each_form_of_full_access_is_found |
| 8 (on the restructure) | Pooled and probe launches skipped the pinned-profile refusal; a switch the push overtook entered full access; replay_config read the setting once | a1 BOUND "round 9: a switch into full access that the push overtakes is refused"; spawn_pooled refuses and the push drains the pool; replay_config is base's per-step read again; the probe case "round 9: a profile pinning full access is not probed under the off" is a4's |
| 9 (review 25, on 7859e3f) | Claude live model lists bypassed the bound; an ACP probe's check went stale before its spawn; a pooled agent that came up in full access waited in the pool | a4 (PROBES cases, session_pool under_an_mdm_off_a_pooled_agent_that_came_up_in_full_access_is_not_kept) |
| 10 (review 31, on e70c3d8) | A cold Claude start passed the pinned check, then spawned after the push and never reached cap_full_access; stop_full_access_agent awaited an unbounded terminate under spawn_lock | a1 BOUND "round 10: a cold Claude start that the push overtakes does not run in full access"; durable_agents a_full_access_stop_is_bounded_when_the_host_never_takes_the_terminate (debug seam ACPMUX_TEST_STALL_HOST_TERMINATE) |
| 8 | Approve-all was capped under the person's own off too, with MDM unset | a3 "MDM unset: the person's own off leaves approve-all as it was" |
Tests
tests/full_access_managed.rs runs a BOUND case table and names every failing case. tests/hub_integration/full_access_guards.rs covers #25214 under MDM's off. The unit tests are each_form_of_full_access_is_found and a_forced_off_is_an_upper_bound_and_nothing_else_changes.
-
Red at cf6f44747d (the tests on base, run 40370561527). These
BOUNDcases fail:- "MDM off is an upper bound over the person's on";
- "a forced value that is not true is off";
- "round 1 and 2: a profile pinning full access in argv does not start";
- "the off holds across a restart, and unsetting it restores full access";
- "round 9: a profile pinning full access is not probed under the off" (since moved to a4);
- "round 9: a switch into full access that the push overtakes is refused".
a_full_access_off_mdm_forces_stops_full_access_approvalsfails too: the guard was approved without asking. -
Green at e70c3d8735 (run 40377257131; the head since review 25 moved the probe pieces to a4). fmt and clippy are clean, lib passes 1101/1102 with only the base red below, and
full_access_managedandhub_integrationfull_access(14/14) pass. 7859e3f81f, the same code with the probe check (run 40370561251), ran the full acpmux suite. The reds that fail the same way on base:agent_toolsown_servers_run_under_the_daemon_prefix;hermetic_daemon_guard's two tests;session_poolpooled_sessions_end_with_the_daemon_and_after_a_crash.
-
Review 31: red at 37058d00a5 (run 40388162921): the new
BOUNDcase fails ("Claude ran on": the start answered with no refusal) and the newdurable_agentstest fails ("the stop waited on a host that never takes the terminate"). Green at 4bf43ea0c6 (run 40388162879:durable_agents54/54,full_access_managedpasses; run 40388162830: fmt and clippy-D warningsclean). At b06386e2a9, the same code, lib passes 1101/1102 with only the base red below (run 40387411001). -
Old code: the pre-restructure head 1cd9210 with the full case table is 64e56625e3 (run 40365300783). There, only the round-8 case "a harness whose mode option says full access while its mode asks ends" fails. That is the finding the last round raised, which the per-path version missed.
No capture: no UI changes. The menu and the app push are in a2.
Review: a fresh Codex gpt-6-astra xhigh review passed (SHIP) at 4bf43ea0c69755c93fce03f0b8432346e6e3a2a1. The reds on this head are infrastructure (the merge-tree publish, which fails the same way on base, and two status posts refused by the installation rate limit), not this PR's.
Agent session: agent session
š¤ Generated with Claude Code