acpmux: an MDM-forced sessions.allowFullAccess off is an upper bound, decided by one predicate (#23322 a1)

Merged
TE
1mo ago
+890-41

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:

  1. This PR (a1): the daemon's bound. The predicate, and every start and mode check under it.
  2. a3 (#25538, stacked on this): approve-all. The policy form of full access, capped only by MDM's off.
  3. b (#25539, stacked on this): agents already running in full access end when MDM turns it off.
  4. a2 (#25540, on base): the app's push and the mode menu. Swift and webview only.
  5. 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 mode option. A harness can keep modes.currentModeId at an asking mode while its mode option 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.rs reads allowFullAccess and allowFullAccessManaged from _acpmux/chat_settings. start_mode_state.rs keeps them in start-mode.json, so they hold across a daemon restart before the app pushes again.
  • One effective setting. Hub::full_access_allowed is the settings file's answer under MDM's off. A forced on adds nothing, and with MDM unset it equals base's start_mode::full_access_allowed(). Every former call site now reads it. replay_config reads 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_agent takes the child out of its slot first, so the slot's lock is not held while it ends, and bounds the terminate (twice SHUTDOWN_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.
  • 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 answers full_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.
  • #25214's guard approval reads the setting at the ask, so under MDM's off a harness guard asks the person.
  • _acpmux/start_mode answers "fullAccess": "managed" while MDM forces it off.

Past review findings, each now a case or a unit test of the predicate:

RoundFindingWhere it is covered
1A profile pinning full access in argv (--yolo) started anyway; the start_mode answer was stalea1 BOUND "round 1 and 2: a profile pinning full access in argv does not start"; "the off holds across a restart"
2Other argv spellings (--permission-mode=bypassPermissions, -sdanger-full-access, -csandbox_mode=..., -y, --approval-mode yolo); agents already running or adopteda1 BOUND pinned profiles (all spellings); b RUNNING "round 2: an agent running in full access takes no more work"
3Check-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
4Startup adoption resumed a full-access host; a mode switch racing the pushb: 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
5A mode the harness reports without declaring modes, and other config options; unadoptable hostspredicate forms UndeclaredMode and Option; b RUNNING round 5 cases; durable_agents an_unadoptable_full_access_host_ends_once_mdm_turns_full_access_off
6An approve-all decision outliving the push; an undeclared mode across a restart; an older webview probea1 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
7The mode config option saying full access while modes.currentModeId askspredicate 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 oncea1 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 poola4 (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_locka1 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)
8Approve-all was capped under the person's own off too, with MDM unseta3 "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 BOUND cases 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_approvals fails 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_managed and hub_integration full_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_tools own_servers_run_under_the_daemon_prefix;
    • hermetic_daemon_guard's two tests;
    • session_pool pooled_sessions_end_with_the_daemon_and_after_a_crash.
  • Review 31: red at 37058d00a5 (run 40388162921): the new BOUND case fails ("Claude ran on": the start answered with no refusal) and the new durable_agents test fails ("the stop waited on a host that never takes the terminate"). Green at 4bf43ea0c6 (run 40388162879: durable_agents 54/54, full_access_managed passes; run 40388162830: fmt and clippy -D warnings clean). 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