-
Notifications
You must be signed in to change notification settings - Fork 13.1k
fix exit_plan_mode ignoring policy allow decision when scheduler skips confirmation #21806
Copy link
Copy link
Closed
Copy link
Labels
area/coreIssues related to User Interface, OS Support, Core FunctionalityIssues related to User Interface, OS Support, Core Functionalityhelp wantedWe will accept PRs from all issues marked as "help wanted". Thanks for your support!We 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 workstreamsLabel used to tag epics and features that are associated with one of the three primary workstreams🔒 maintainer only⛔ Do not contribute. Internal roadmap item.⛔ Do not contribute. Internal roadmap item.
Metadata
Metadata
Assignees
Labels
area/coreIssues related to User Interface, OS Support, Core FunctionalityIssues related to User Interface, OS Support, Core Functionalityhelp wantedWe will accept PRs from all issues marked as "help wanted". Thanks for your support!We 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 workstreamsLabel used to tag epics and features that are associated with one of the three primary workstreams🔒 maintainer only⛔ Do not contribute. Internal roadmap item.⛔ Do not contribute. Internal roadmap item.
Type
Fields
Give feedbackNo fields configured for Task.
Projects
Status
Closed
Problem
When a user policy grants
decision = "allow"forexit_plan_mode, the scheduler's_processToolCall()correctly skips the confirmation phase (no TUI dialog). However, this also meansshouldConfirmExecute()is never called, soapprovalPayloadremainsnull.When
execute()runs,approvalPayloadisnulland falls through to the rejection branch, returning "Rejected (no feedback)" — even though the policy explicitly allowed execution.The existing ALLOW handling inside
shouldConfirmExecute()(which setsapprovalPayload = { 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
allowforexit_plan_mode, the tool should approve the plan with DEFAULT mode — consistent with the ALLOW branch insideshouldConfirmExecute().Reproduction
~/.gemini/policies/plan-allow.toml:exit_plan_mode→ returns "Rejected (no feedback)" instead of approvingUse case
User policies that auto-allow
exit_plan_modeenable 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.