fix(approvals): interpolate request id in fallback command · openclaw/openclaw@beb499b
itsuzef
·
2026-06-01
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -602,7 +602,7 @@ describe("exec approval forwarder", () => {
|
602 | 602 | expect(text).toContain("🔒 Exec approval required"); |
603 | 603 | expect(text).toContain("Command: `echo hello`"); |
604 | 604 | expect(text).toContain("Expires in: 5s"); |
605 | | -expect(text).toContain("Reply with: /approve <id> allow-once|allow-always|deny"); |
| 605 | +expect(text).toContain("Reply with: /approve req-1 allow-once|allow-always|deny"); |
606 | 606 | }); |
607 | 607 | |
608 | 608 | it("includes command analysis warnings in fallback delivery text", () => { |
@@ -639,7 +639,7 @@ describe("exec approval forwarder", () => {
|
639 | 639 | ).resolves.toBe(true); |
640 | 640 | await Promise.resolve(); |
641 | 641 | const text = getFirstDeliveryText(deliver); |
642 | | -expect(text).toContain("Reply with: /approve <id> allow-once|deny"); |
| 642 | +expect(text).toContain("Reply with: /approve req-1 allow-once|deny"); |
643 | 643 | expect(text).not.toContain("allow-once|allow-always|deny"); |
644 | 644 | expect(text).toContain("Allow Always is unavailable"); |
645 | 645 | }); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -286,7 +286,7 @@ export function buildExecApprovalRequestMessage(request: ExecApprovalRequest, no
|
286 | 286 | ? "Background mode note: non-interactive runs cannot wait for chat approvals; use pre-approved policy (allow-always or ask=off)." |
287 | 287 | : "Background mode note: non-interactive runs cannot wait for chat approvals; the effective policy still requires per-run approval unless ask=off.", |
288 | 288 | ); |
289 | | -lines.push(`Reply with: /approve <id> ${decisionText}`); |
| 289 | +lines.push(`Reply with: /approve ${request.id} ${decisionText}`); |
290 | 290 | if (!allowedDecisions.includes("allow-always")) { |
291 | 291 | lines.push( |
292 | 292 | "Allow Always is unavailable because the effective policy requires approval every time.", |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -190,7 +190,7 @@ describe("plugin approval forwarding", () => {
|
190 | 190 | expect(result).toBe(true); |
191 | 191 | await flushPendingDelivery(); |
192 | 192 | const payload = firstDeliveredPayload(deliver); |
193 | | -expect(payload?.text).toContain("Reply with: /approve <id> allow-once|deny"); |
| 193 | +expect(payload?.text).toContain("Reply with: /approve plugin-req-1 allow-once|deny"); |
194 | 194 | expect(payload?.text).not.toContain("allow-always"); |
195 | 195 | expect(payload?.presentation).toEqual({ |
196 | 196 | blocks: [ |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -108,9 +108,9 @@ export function buildPluginApprovalRequestMessage(
|
108 | 108 | const expiresIn = Math.max(0, Math.round((request.expiresAtMs - nowMsValue) / 1000)); |
109 | 109 | lines.push(`Expires in: ${expiresIn}s`); |
110 | 110 | lines.push( |
111 | | -`Reply with: /approve <id> ${resolvePluginApprovalRequestAllowedDecisions(request.request).join( |
112 | | - "|", |
113 | | - )}`, |
| 111 | +`Reply with: /approve ${request.id} ${resolvePluginApprovalRequestAllowedDecisions( |
| 112 | + request.request, |
| 113 | + ).join("|")}`, |
114 | 114 | ); |
115 | 115 | return lines.join("\n"); |
116 | 116 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -142,7 +142,7 @@ describe("plugin-sdk/approval-renderers", () => {
|
142 | 142 | nowMs: 1_000, |
143 | 143 | }), |
144 | 144 | textExpected: (text: string) => |
145 | | -expect(text).toContain("Reply with: /approve <id> allow-once|deny"), |
| 145 | +expect(text).toContain("Reply with: /approve plugin-approval-123 allow-once|deny"), |
146 | 146 | presentationExpected: { |
147 | 147 | blocks: [ |
148 | 148 | { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。