acpmux: a peer counts an enrolled Mac's signed group Allow once (peer-route approvals 3/5)
Peer-route approvals, part 3 of 5: a peer counts an enrolled Mac's signed Allow once on a group of tool prompts. Parts 1 (#26131) and 2 (#26133) have landed; this PR is on feat-cmux-next.
The card answers tool prompts (execute, edit, read, …) in batches through _acpmux/permission_group_respond, not through permission_respond. Part 1 only covered the single-prompt answer. A peer refused every group allow that did not come from its own person. This Mac's daemon also marked every forwarded group read allowRefused, so a peer-route chat's card showed only Deny ("Only the cmux app can approve this"). A live capture on a fleet-built app confirmed it.
- The peer (B), gate (
hub/person.rs):- A non-person
allow_oncegroup answer passes only with_meta.acpmux.approverDecisions. That must hold, for every pending member of the group at the request'srevision,{decisionNonce, approverDecision}: the member's own part-1 signature over its single allow_once option, with no answers. - A missing member is refused, and so is an entry for anything else, a wrong nonce, a stale revision, or any signature that does not count.
- Deny passes as before.
- A non-person
- Only an enrolled Mac's signature counts for a group member, never a phone approver's (
PersonGate::macs_prove/macs_spend). A Mac's message binds the member's tool-call id, and itsmay_allowholds every member to a plain tool ask. - The peer, answer (
hub/permission_groups.rsrespond_permission_group): under the session's permission lock and one hold of the Mac set's lock (MacApprovers::all_verify_then), it verifies every member's proof and spends every nonce together (PersonGate::spend_decisions, all or none) before any member is answered. Anything else getspermission.person_required, nothing is answered and no nonce is spent. - The peer, read: a non-person
_acpmux/permission_groupsread saysmacAllowOnce: truebesideallowRefused. - Protocol:
AnswerMetadeclaresapproverDecisionandapproverDecisions(ApproverDecision,MemberApproverDecision), andPermissionGroupListdeclaresmacAllowOnce. The IR, spec and generated web types are regenerated. - This Mac's daemon (A), forward (
server/peer_forward.rs):- A forwarded group read drops
allowRefusedandallow_chatonly when all three hold: the reader is A's own person, A holds this Mac's approver key (thisMac, set by the app), and the peer saysmacAllowOnce. The card then draws Allow once and Deny, never Allow for this chat. - Every other reader still gets
allowRefused. - A refused group answer names the peer (
data.peer, part 2), so the app can say where to enroll.
- A forwarded group read drops
The five conditions
- Bound, short, single use. Only a Mac's signature counts. Each member's signature binds the peer's instance, the Mac id, the session, that member's permission id and tool-call id, its allow_once option, its decision nonce and an expiry of at most 300 s (part 1's message). Each entry is matched to its member by permission id and nonce, so one member's proof cannot answer another member, another group or another revision. Every nonce is spent before the answer, and a replay after it is refused.
- One-time only, no mode change. Only
allow_oncecounts.allow_chatfrom a non-person is still refused, and A never draws it for a peer-route chat. Every member needs a single allow_once option, and part 1'smay_allowrefuses plans, mode switches, folder trust and questions. Groups only ever hold plain tool asks (eligible). - Unsigned refused, Deny counts. An unsigned or partly signed group allow is refused with
person_required, and Deny from any client passes as before. - Unenrolling stops Allows at once. All members' proofs are checked, and all nonces spent, under one hold of the Mac set's lock. A
host approvals rm/unenrollreload takes that lock, so it lands before the whole answer (nothing spent, nothing answered, every member still answerable) or after it, never between two members. The integration test removes the Mac and shows the next allow refused. - No new signing path. The daemon signs nothing; only the app holds the key (parts 4 and 5). A's relaxation applies only to A's own person's read.
Tests (they fail before the fix and pass after)
They ran remotely through cmux-ci test.
Before (the gate arm, the forward condition and the proof match neutralised):
test server::peer_forward::tests::a_peers_group_read_draws_allow_once_only_for_a_mac_that_signs ... FAILED
test hub::permission_groups::approver_proofs_tests::every_pending_member_needs_its_own_entry_and_nothing_else ... FAILED
test a_peer_counts_an_enrolled_macs_signed_group_allow_for_every_pending_member ... FAILED
Before the review fix (a phone's proof accepted per member; members verified and spent one at a time):
test hub::mac_approvers::tests::a_groups_allow_takes_only_macs_and_spends_every_nonce_or_none ... FAILED
test hub::mac_approvers::tests::a_reload_during_a_groups_commit_waits_for_the_whole_answer ... FAILED
After (head of this PR):
test hub::mac_approvers::tests::a_groups_allow_takes_only_macs_and_spends_every_nonce_or_none ... ok
test hub::mac_approvers::tests::a_reload_during_a_groups_commit_waits_for_the_whole_answer ... ok
lib (mac_approvers permission_groups person peer_forward protocol host_approvals): 54 passed; 0 failed
--test peer_integration: 50 passed (a_peer_counts_an_enrolled_macs_signed_group_allow_for_every_pending_member ... ok)
--test person_allow: 25 passed; --test hub_integration permission: 31 passed
protocol_ir_is_current ok; webviews acpmux-protocol:check current; cargo fmt --check and clippy -D warnings clean
The integration test uses a 3-member group on two hubs. Each of these is refused with permission.person_required and data.peer, and the group stays pending at its revision: unsigned, a missing member, a wrong nonce, a stale revision, an expired signature, the other option, a Mac that is not enrolled, an extra entry, allow_chat, and a Mac unenrolled by a reload. A fully signed allow resolves all 3 members, and a replay is refused.
The webviews methods.ts drift (_acpmux/file_put_status / file_put_data missing) is on feat-cmux-next already; this PR regenerates only types.ts and changes no method.
No capture: daemon only. Part 5 carries the card's before and after captures from a fleet-built app of the whole stack.
Overlap (files only, not the same fix): #22030, #24797, #26127, #26093 and #25697 touch requests.rs/peer_forward.rs.
Agent session: agent session
🤖 Generated with Claude Code