Chief: its own tools never wait on an approval

Merged
LA
16d ago
+174-5

Summary

A Chief turn could hang forever on its own tool call ("Using optchat: control · 3m 42s", typing dots, no card).

Cause: a subagent spawned with policy ask reported into the owner's turn, so the turn ran as an ask turn. The host then answered its own mcp__optchat__send request with an allow, and acpmux refused it ("allowing a permission is accepted only from the cmux app"). The request stayed open and the turn waited until someone denied it.

Fix:

  • The turn's project settings (.claude/settings.json and settings.local.json) allow the Chief's own tools (approval::turn_allowed_tools), so they never make a permission request.
  • In a turn that carries another person's text, the same input rules (Brain::internal_allowed: no send attachments, profile reads only, control status/interrupt/deny, tell/control only to ask subagents) apply when the tool runs, through Orchestrator::turn_gate in tools.rs. If the brain does not answer, the call is refused.
  • If acpmux refuses an allow that the host sends itself, the host refuses the request, so the turn goes on.

The acpmux person rule is not changed.

Tests

cargo clippy --locked --all-targets -D warnings and cargo test --locked --test approval_gates --test harness pass on rbx at c0a4cd77ecf (approval_gates 8/8, harness 27/27). New tests:

  • a_chief_tool_request_whose_allow_acpmux_refuses_is_refused_and_never_holds_the_turn (the fake acpmux refuses allows like the real one)
  • another_persons_turn_is_held_to_the_input_rules_when_a_chief_tool_runs
  • the session settings test checks the allow list in both files

Observed / Not run

  • Observed: the live NIGHTLY Chief hung on this. With the allow list added to its live settings and the three open requests denied, the turn ended and the Chief is ready.
  • Not run: a red run of the new tests on the base (they need the new API); a tagged-app dogfood.

Changelog

Fixed: The Chief no longer hangs on its own reply after a subagent report.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes the Chief hanging forever on its own tool call after a subagent report.

A subagent report made the owner's turn an ask turn; the host answered its own mcp__optchat__send request with an allow, acpmux refused it, and the request stayed open until someone denied it.

  • The turn's project settings allow the Chief's own tools, so they never make a permission request.
  • If acpmux refuses a self-allow, the host refuses the request instead of leaving it open.
  • Turns that carry another person's text apply the input rules when a Chief tool runs, and the gate holds for late calls until the next turn starts; calls the brain does not answer are refused.