Skip to content

fix exit_plan_mode ignoring policy allow decision when scheduler skips confirmation #21806

@backnotprop

Description

@backnotprop

Problem

When a user policy grants decision = "allow" for exit_plan_mode, the scheduler's _processToolCall() correctly skips the confirmation phase (no TUI dialog). However, this also means shouldConfirmExecute() is never called, so approvalPayload remains null.

When execute() runs, approvalPayload is null and falls through to the rejection branch, returning "Rejected (no feedback)" — even though the policy explicitly allowed execution.

The existing ALLOW handling inside shouldConfirmExecute() (which sets approvalPayload = { approved: true, approvalMode: DEFAULT }) only runs when the tool itself checks policy via the message bus. It does not run when the scheduler checks policy and skips confirmation entirely.

Expected behavior

When a user policy grants allow for exit_plan_mode, the tool should approve the plan with DEFAULT mode — consistent with the ALLOW branch inside shouldConfirmExecute().

Reproduction

  1. Create ~/.gemini/policies/plan-allow.toml:
[[rule]]
toolName = "exit_plan_mode"
decision = "allow"
priority = 100
  1. Enter plan mode, create a plan
  2. Model calls exit_plan_mode → returns "Rejected (no feedback)" instead of approving

Use case

User policies that auto-allow exit_plan_mode enable hook-driven plan approval workflows — e.g. routing plan review to a web UI via BeforeTool hooks (see plannotator). The policy bypasses the TUI dialog so the hook becomes the sole approval gate, but the tool itself doesn't honor the bypass.

Metadata

Metadata

Labels

area/coreIssues related to User Interface, OS Support, Core Functionalityhelp wantedWe will accept PRs from all issues marked as "help wanted". Thanks for your support!workstream-rollupLabel used to tag epics and features that are associated with one of the three primary workstreams🔒 maintainer only⛔ Do not contribute. Internal roadmap item.

Type

No fields configured for Task.

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions