fix(tui): make mode authority decide approval prompts#3795
Conversation
Remove the auto-review safety-floor paths that forced prompts past the selected mode, including publish-like shell and MCP action holds. Gate MCP/code-execution/hook ask approvals on auto_approve so YOLO follows the zero-prompt contract while hard deny/block rules still refuse work in every mode. Stamp mode auto-approvals separately from user approvals so tool results no longer claim the user approved a call they were never shown. Fixes #3790. Tested: cargo fmt; cargo test -p codewhale-tui --bin codewhale-tui --locked yolo_mode_does_not_prompt_for_mcp_action; cargo test -p codewhale-tui --bin codewhale-tui --locked yolo_mode_; cargo test -p codewhale-tui --bin codewhale-tui --locked auto_review; cargo test -p codewhale-tui --bin codewhale-tui --locked approval
|
Claude finished @Hmbown's task in 6m 16s —— View job PR Review: fix(tui): make mode authority decide approval prompts
SummaryThis PR correctly unifies the authority for approval prompts behind the selected mode. The logic is sound, the new honest-stamping distinction ( P1 — CorrectnessNon-bypassable tool stamping gap (
// main.rs:7372 – stamps ApprovedByUser even when auto-approving on mode authority
Event::ApprovalRequired { id, .. } => {
if auto_approve {
let _ = engine_handle.approve_tool_call(id).await; // should be approve_tool_call_by_mode
}
}This contradicts the PR's honest-stamping goal: the tool result would claim "approved by the user" when it was never shown to anyone. The TUI path correctly calls Headless fail-fast regression (design note, not a panic) Previously, P3 — Reuse / simplification
P4 — TestsWeak assertion in assert_ne!(
policy.evaluate(&action_ctx).action,
AutoReviewAction::HoldForReview,
"MCP actions are no longer held by the policy; the mode governs prompting"
);This passes even if the result is assert_eq!(policy.evaluate(&action_ctx).action, AutoReviewAction::AskUser);Coverage that's genuinely good:
P5 — Security / trust model noteRemoving the publish floor means YOLO now runs Block (deny) rules remain hard prohibitions in every mode — that invariant is preserved and tested. Overall: Well-structured change with solid test coverage. The two |
Why
Fixes #3790. The selected mode should be the single authority for permission prompts: YOLO means zero approval prompts, while Agent and Plan keep the normal prompt or block behavior. The old auto-review safety floor could force prompts past YOLO for publish-like shell and MCP actions, and MCP/code-execution/hook ask paths still had mode-blind approval gates.
Change
Validation