You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Honors allow_permanent=false across gateway approval delivery paths.
When Tirith or another pre-approval policy disallows permanent approval, gateway clients must not offer an always action in API events, button UIs, reactions, or text instructions.
Details
Builds API approval event choices dynamically.
Forwards allow_permanent through the gateway dispatcher while preserving compatibility with legacy adapters.
Omits approve always from the generic text fallback.
Hides permanent approval in Feishu, Telegram, Slack, Matrix, Teams, QQBot, and Discord.
Documents the optional adapter contract.
Adds direct dispatcher, API-choice, and fallback regression tests.
Adds platform-specific tests for every updated native approval surface.
WhatsApp Cloud is unchanged because its approval UI only exposes Approve and Deny and has no permanent action.
Related: gateway-side companion of the merged #44534 (which carried allow_permanent to TUI + desktop approval prompts). This PR does the equivalent for the gateway transports (API server events, text fallback, Feishu interactive cards). Not a duplicate — different surface. Also relevant to the allow_permanent/permanent-approval discussion in #39187 / #39212.
Thanks for carrying the allow_permanent contract into gateway delivery paths. The reported mismatch is real: tools/approval.py:2801-2803 emits allow_permanent=False for Tirith findings, while current API events (gateway/platforms/api_server.py:4315), the generic fallback (gateway/run.py:18553), and Feishu cards (plugins/platforms/feishu/adapter.py:2021) still expose permanent approval.
Problems
This is incomplete across native gateway approval surfaces. Telegram (plugins/platforms/telegram/adapter.py:4574-4582), Slack (plugins/platforms/slack/adapter.py:3281-3307), Matrix (plugins/platforms/matrix/adapter.py:2014-2018), Teams (plugins/platforms/teams/adapter.py:1122-1145), QQBot (gateway/platforms/qqbot/adapter.py:2656-2687), and Discord's ExecApprovalView still expose or advertise an always action.
The new Feishu test verifies card construction, but not the gateway/run.py forwarding path, API event choices, or text fallback behavior changed here.
Suggested changes
Carry the optional allow_permanent argument through each native approval UI that presents permanent approval, and hide its corresponding action/instruction when false.
Add dispatcher/API/fallback regression tests in addition to the Feishu card test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Honors
allow_permanent=falseacross gateway approval delivery paths.When Tirith or another pre-approval policy disallows permanent approval, gateway clients must not offer an
alwaysaction in API events, button UIs, reactions, or text instructions.Details
allow_permanentthrough the gateway dispatcher while preserving compatibility with legacy adapters.approve alwaysfrom the generic text fallback.WhatsApp Cloud is unchanged because its approval UI only exposes Approve and Deny and has no permanent action.
Validation
ruff checkon all changed Python filesgit diff --check