From 7fea8250fb0cbae1e2ea9bdea5b223986e17d5f6 Mon Sep 17 00:00:00 2001 From: James Cowan <112015792+jameslcowan@users.noreply.github.com> Date: Wed, 1 Apr 2026 16:14:58 -0300 Subject: [PATCH] fix(approvals): use canonical decision values in interactive button payloads --- extensions/telegram/src/exec-approvals-handler.test.ts | 2 +- src/infra/exec-approval-forwarder.test.ts | 6 +++--- src/infra/exec-approval-reply.test.ts | 8 ++++---- src/infra/exec-approval-reply.ts | 2 +- src/infra/plugin-approval-forwarder.test.ts | 2 +- src/plugin-sdk/approval-renderers.test.ts | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/extensions/telegram/src/exec-approvals-handler.test.ts b/extensions/telegram/src/exec-approvals-handler.test.ts index 438e84af3d8..21212bc8523 100644 --- a/extensions/telegram/src/exec-approvals-handler.test.ts +++ b/extensions/telegram/src/exec-approvals-handler.test.ts @@ -100,7 +100,7 @@ describe("TelegramExecApprovalHandler", () => { }, { text: "Allow Always", - callback_data: "/approve 9f1c7d5d-b1fb-46ef-ac45-662723b65bb7 always", + callback_data: "/approve 9f1c7d5d-b1fb-46ef-ac45-662723b65bb7 allow-always", style: "primary", }, { diff --git a/src/infra/exec-approval-forwarder.test.ts b/src/infra/exec-approval-forwarder.test.ts index bdd781a6bd9..ca4ee8230c1 100644 --- a/src/infra/exec-approval-forwarder.test.ts +++ b/src/infra/exec-approval-forwarder.test.ts @@ -95,7 +95,7 @@ function buildTelegramExecApprovalPendingPayloadForTest(params: { }, { label: "Allow Always", - value: `/approve ${params.request.id} always`, + value: `/approve ${params.request.id} allow-always`, style: "primary", }, { @@ -115,7 +115,7 @@ function buildTelegramExecApprovalPendingPayloadForTest(params: { buttons: [ [ { text: "Allow Once", callback_data: `/approve ${params.request.id} allow-once` }, - { text: "Allow Always", callback_data: `/approve ${params.request.id} always` }, + { text: "Allow Always", callback_data: `/approve ${params.request.id} allow-always` }, ], [{ text: "Deny", callback_data: `/approve ${params.request.id} deny` }], ], @@ -465,7 +465,7 @@ describe("exec approval forwarder", () => { }, { label: "Allow Always", - value: "/approve req-1 always", + value: "/approve req-1 allow-always", style: "primary", }, { diff --git a/src/infra/exec-approval-reply.test.ts b/src/infra/exec-approval-reply.test.ts index bd496488b07..2480094b865 100644 --- a/src/infra/exec-approval-reply.test.ts +++ b/src/infra/exec-approval-reply.test.ts @@ -119,7 +119,7 @@ describe("exec approval reply helpers", () => { }, { label: "Allow Always", - value: "/approve req-1 always", + value: "/approve req-1 allow-always", style: "primary", }, { @@ -236,7 +236,7 @@ describe("exec approval reply helpers", () => { decision: "allow-always", label: "Allow Always", style: "primary", - command: "/approve req-1 always", + command: "/approve req-1 allow-always", }, { decision: "deny", @@ -256,7 +256,7 @@ describe("exec approval reply helpers", () => { type: "buttons", buttons: [ { label: "Allow Once", value: "/approve req-1 allow-once", style: "success" }, - { label: "Allow Always", value: "/approve req-1 always", style: "primary" }, + { label: "Allow Always", value: "/approve req-1 allow-always", style: "primary" }, { label: "Deny", value: "/approve req-1 deny", style: "danger" }, ], }, @@ -270,7 +270,7 @@ describe("exec approval reply helpers", () => { approvalCommandId: "req-1", decision: "allow-always", }), - ).toBe("/approve req-1 always"); + ).toBe("/approve req-1 allow-always"); expect(parseExecApprovalCommandText("/approve req-1 deny")).toEqual({ approvalId: "req-1", diff --git a/src/infra/exec-approval-reply.ts b/src/infra/exec-approval-reply.ts index a5362c3d26e..9ef7a831cbd 100644 --- a/src/infra/exec-approval-reply.ts +++ b/src/infra/exec-approval-reply.ts @@ -67,7 +67,7 @@ export function buildExecApprovalCommandText(params: { approvalCommandId: string; decision: ExecApprovalReplyDecision; }): string { - return `/approve ${params.approvalCommandId} ${params.decision === "allow-always" ? "always" : params.decision}`; + return `/approve ${params.approvalCommandId} ${params.decision}`; } export function buildExecApprovalActionDescriptors(params: { diff --git a/src/infra/plugin-approval-forwarder.test.ts b/src/infra/plugin-approval-forwarder.test.ts index 79451d203a0..6fd37f282e3 100644 --- a/src/infra/plugin-approval-forwarder.test.ts +++ b/src/infra/plugin-approval-forwarder.test.ts @@ -106,7 +106,7 @@ describe("plugin approval forwarding", () => { }, { label: "Allow Always", - value: "/approve plugin-req-1 always", + value: "/approve plugin-req-1 allow-always", style: "primary", }, { diff --git a/src/plugin-sdk/approval-renderers.test.ts b/src/plugin-sdk/approval-renderers.test.ts index 7de464abd5b..1df2f1ea708 100644 --- a/src/plugin-sdk/approval-renderers.test.ts +++ b/src/plugin-sdk/approval-renderers.test.ts @@ -28,7 +28,7 @@ describe("plugin-sdk/approval-renderers", () => { }, { label: "Allow Always", - value: "/approve plugin:approval-123 always", + value: "/approve plugin:approval-123 allow-always", style: "primary", }, { @@ -75,7 +75,7 @@ describe("plugin-sdk/approval-renderers", () => { }, { label: "Allow Always", - value: "/approve plugin-approval-123 always", + value: "/approve plugin-approval-123 allow-always", style: "primary", }, {