acpmux: under MDM's off, a full-access option a bare answer took ends its agent (#23322 b4)

Merged
TE
25d ago
+185-5

What (part b4 of #23322, split out of #25539)

The decision on #23322: "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."

A harness may answer session/set_config_option without its options ({}, or configOptions: null) and still take the value asked. A full-access value it took so was not in the chat's options, so under MDM's off its agent ran on.

Now a bare answer's value is kept (FloorState::asked_options, by option id) and the predicate reads it with the chat's options (FullAccessView::of_session). The answer's options are saved as before, a null included. The kept values change only in answer order: a later answer that reports an option's value replaces it, and they go when the agent exits or ends. The harness's own option reports never clear them, as one sent just before an answer may be applied after it; under the off such a kept value can only end an agent, never keep one. A left host's log read back (#26054) merges a bare answer's value the same way. With MDM unset nothing changes: the value is read only by the full-access bound.

Base: feat-cmux-next, with #26057 (b3) merged.

Tests (durable_agents):

  • a_full_access_option_answered_without_options_ends_under_mdm_off: a bare and a null answer, the off pushed live or found by the next daemon (fake FAKE_BARE_OPTION_ANSWER).
  • an_older_option_report_does_not_hide_a_bare_answer_under_mdm_off: the harness reports its options just before a bare answer (fake FAKE_OPTION_REPORT_FIRST) and the inbound loop applies that report after it (ACPMUX_TEST_UPDATE_DELAY_MS).
  • a_null_options_answer_is_saved_as_before: with MDM unset, a null options answer still replaces the chat's saved options, so a full-access option reported earlier is not replayed to the next agent.

Green at 57f893249d (on feat-cmux-next 9718d92f75, with #26057 merged), run 40569264620: fmt, clippy clean, durable_agents 102/102, full_access_managed 2/2, session_pool 33/33, web_mode_current 13/13, hub_integration 510/510, lib only base's red agent_tools::tests::own_servers_run_under_the_daemon_prefix. Earlier: green at 143fa29f11, run 40541903703.

Red at 18814a90b3, run 40484076402: the first two fail (the third is a guard and passes on the base). On the previously reviewed code (fb4ea7a988 with these tests, 296b1365d1), run 40484076526: the second and third fail, which reproduces both findings of review 1. Green at 244f4d384d (the same diff, before its base moved): run 40484076580, durable_agents 85/85; run 40481755681 at the code before the test change: fmt, clippy, full_access_managed 2/2, web_mode_current 13/13, hub_integration 508/508, session_pool 26/26, lib only base's red agent_tools::tests::own_servers_run_under_the_daemon_prefix.

Review 1 (Codex, at fb4ea7a988) blocked on two findings, both fixed above: (1) an older config_option_update applied after a bare answer cleared what the answer took; (2) dropping a null configOptions changed what MDM-unset chats save. Its out-of-scope finding (lifecycle.rs config replay ignores bare answers) is tracked in #26340.

Follow-up: b5 (agents whose host link stopped).

Risk: low. Size: about 190 changed lines, 120 of them tests.

No capture: no UI changes.

Review: review 3 (Codex gpt-6-astra xhigh) passed (SHIP) at 143fa29f11; the same patch was restacked onto the merged #26057, and review 4 (short, restack) passed (SHIP) at 57f893249d.

Agent session: agent session

šŸ¤– Generated with Claude Code