acpmux: Claude's "Allow for this session" keeps a session rule
"Allow for this session" on a Claude Code permission ask now actually stops Claude asking again for the same command in that chat. Before, acpmux answered it with a plain allow, so Claude kept no rule and the option acted like "Allow once".
What changes
Claude Code keeps a permission only when the allow carries it back as updatedPermissions.
- What acpmux keeps: for each ask, acpmux keeps Claude's
permission_suggestions, but only theaddRulesentries with behaviorallow. Their destination is forced tosession. - What it sends back: on "Allow for this session", those rules are returned as
updatedPermissions. Claude then holds them for the rest of the session. - When the option appears: it is offered only when such a rule exists. Without one, it would be "Allow once" under another name.
Claude's suggestions for edits are setMode acceptEdits, so Edit/Write asks no longer offer the option. It never worked for them before. Passing setMode through would change Claude's mode without acpmux's mode state knowing.
Relation to #20407. #20407 (op-next-permission-card, "persist Claude permission suggestions") also hands Claude's suggestions back and offers the option only when there are any. This PR folds that in, with one deliberate difference. #20407 echoes the suggestions unchanged, so a localSettings destination writes the rule into the project's .claude/settings.local.json. That outlives the chat the option names. Here the rule lasts only for the session. I'm leaving #20407 open for its owner to close or rebase.
Evidence
Red, then green, with the same focused hosted command (scripts/verify-cmux-tui-hosted.sh --filter allow_for_this_session_stops_claude_asking_again):
- Red on the test-only commit
283e85f(38546492355) fails withClaude asked again after Allow for this session. - Green on the fix
6768e32: 38554022299.test (linux)passed the test. That run's clippy flagged.then(|| …)in the new code, and the autofix bot'se854434changed it tothen_some. - Exact head
e854434(compile, clippy and the test): 38570925945.
The test drives the hub with the fake Claude, under policy Ask. It answers the first ask with allow_always, then asserts that no second ask arrives and that the fake recorded exactly one rule with destination session. A correctness review found no bugs. The merged head passes the local god-file check and the crash ratchet.
Changelog
- Fixed: "Allow for this session" on a Claude Code permission ask now stops Claude asking again for that command in the chat.
🤖 Generated with Claude Code