acpmux: under an MDM off, family messages are written or cut before the push returns (#23322 a3 fence, part 4 of 5)
What (#23322 a3 fence, part 4 of 5: family messages)
It builds on 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."
#25538 (#23322 a3) landed as 3e72956265. The transport parts landed too: part 1 (#25804) as 9cd4a013e3, part 2 (#26176) as e519622e1a, and part 3 (#26184) as c06aa23e7a. Review 40 on it found that its family gate was released before the write (3) and that a blocked transport could stall an MDM off push forever (4). This stack of five PRs closes both. Each one lands on its own, in order:
- the fence for a direct agent;
- the fence for a hosted agent;
- host protocol 2 receipts;
- family messages;
- ancestor answers.
This PR closes review 40's findings (3) and (4) for family messages: prompts, failover resends and steers.
hold_until_written(hub/full_access_bound.rs) holds the family gate until the message's fence (parts 1 to 3) settles.- An MDM off push waits for the gate at most
FAMILY_WRITE_BUDGET(5 s). - Then it cuts every held message with
Fence::cut_or_end. A message still queued is never written after that. One the writer already has ends its agent first, by an identity the cut proves. - So a push returns in bounded time, and nothing it waited for reaches the agent after it.
- An MDM off push waits for the gate at most
- One MDM snapshot per family check. It is taken once at the check's entry (
MdmSnapshot: the off state and its generation). Both sessions are ranked under that same snapshot, which is passed down (family_dispatch_check,receiver_check_under,effective_policy_under). - A fence nothing took is cut. Each prompt, resend and steer arms
CutOnDropon its fence, so an error before the hand-off never holds a later push (review 86). - Rebased onto base's new prompt path and #26034 (#23322 b1). The off push keeps b1's teardown after the bounded gate wait.
- The prompt's model-sized copies are made before the fence.
- A Stop meanwhile drops the fence cut.
- A turn acpmux already ended gets no prompt, as on base.
With MDM unset, nothing changes. Only an off push cuts. Without one, a held message is simply written.
Risk: an off push now waits up to 5 s for a family message whose transport is stuck. After that the message is cut, and if its writer already had it, its agent ends. That turn fails with "an MDM push turned full access off before this message reached the agent, so it was not sent".
Tests
full_access_bound unit tests, red first:
an_off_push_waits_for_a_queued_family_message_until_it_is_writtenandan_off_push_cuts_a_family_message_its_transport_never_takes(review 40, run 40406720270);an_off_push_returns_in_time_while_a_cut_message_is_being_writtenandan_off_push_waits_until_a_cut_messages_agent_is_ended(review 81);a_family_prompt_that_fails_before_its_write_holds_no_push(review 86);a_family_check_ranks_both_sessions_under_the_bound_it_read_once.
Green at 96c4e3685b (run 40503119436), the same patch on base before part 3 landed:
- fmt and clippy clean;
- lib 1428/1429, with only base's
own_servers_run_under_the_daemon_prefix; - agent_host 21/21, durable_agents 70/70 and hub_integration 510/510; full_access_managed passes;
- session_pool 25/26, with only base's
pooled_sessions_end_with_the_daemon_and_after_a_crash.
Rerun at this head (028e8c9694, on feat-cmux-next 7f5ab81740), run 40512310098: fmt clean except base's unformatted claude_stdio/inbound.rs; clippy clean; agent_host 21/21; durable_agents 81/81; session_pool 27/28 (only base's pooled_sessions_end_with_the_daemon_and_after_a_crash); lib 1450/1452 (base's own_servers_run_under_the_daemon_prefix, and a cli::host_approvals flake that passes in the stacked part 2's run 40512925245); hub_integration 509/510 (the known prompt_supersede::a_prompt_queued_before_a_restart_is_still_replaced flake).
The last commit is test-only. The prepush gate refused a literal .cmux root in a_family_prompt_that_fails_before_its_write_holds_no_push. The agent's cwd is now a file, so the attachment folder still cannot be made.
Review
An independent Codex reviewer (gpt-6-astra, xhigh) gave SHIP at 028e8c9694 (review 88, round 7), after SHIPs at 83e426f25d (round 6), 2d58bf7390, 72b8ce034c, 5004e62f7c and dbc2629d2b. Its first commit is the round-6 patch, unchanged, rebased onto feat-cmux-next.
No capture: no UI changes.
Agent session: agent session
š¤ Generated with Claude Code