












@@ -659,6 +659,27 @@ describe("resolvePermissionRequest", () => {
659659expect(res).toEqual({ outcome: { outcome: "selected", optionId: "reject-always" } });
660660});
661661662+it("cancels auto-approved requests when no allow option is available", async () => {
663+const prompt = vi.fn(async () => true);
664+const log = vi.fn();
665+const res = await resolvePermissionRequest(
666+makePermissionRequest({
667+toolCall: {
668+toolCallId: "tool-read-no-allow",
669+title: "read: src/index.ts",
670+status: "pending",
671+kind: "read",
672+},
673+options: [{ kind: "reject_once", name: "Reject", optionId: "reject" }],
674+}),
675+{ prompt, log },
676+);
677+678+expect(prompt).not.toHaveBeenCalled();
679+expect(log).toHaveBeenCalledWith("[permission cancelled] read: missing allow option");
680+expect(res).toEqual({ outcome: { outcome: "cancelled" } });
681+});
682+662683it("prompts when tool identity is unknown and can still approve", async () => {
663684const prompt = vi.fn(async () => true);
664685const res = await resolvePermissionRequest(
此內容由慣性聚合(RSS閱讀器)自動聚合整理,僅供閱讀參考。 原文來自 — 版權歸原作者所有。