





















@@ -158,9 +158,10 @@ describe("createTaskFlowWebhookRequestHandler", () => {
158158expect(res.statusCode).toBe(401);
159159expect(res.body).toBe("unauthorized");
160160expect(target.taskFlow.list()).toEqual([]);
161+expect(hoisted.resolveConfiguredSecretInputStringMock).not.toHaveBeenCalled();
161162});
162163163-it("caches SecretRef resolution across requests for the same route", async () => {
164+it("re-resolves SecretRef-backed secrets across requests", async () => {
164165const runtime = createRuntimeTaskFlow();
165166const target: TaskFlowWebhookTarget = {
166167routeId: "cached",
@@ -176,7 +177,10 @@ describe("createTaskFlowWebhookRequestHandler", () => {
176177sessionKey: "agent:main:webhook-cached",
177178}),
178179};
179-hoisted.resolveConfiguredSecretInputStringMock.mockResolvedValue({ value: "shared-secret" });
180+hoisted.resolveConfiguredSecretInputStringMock
181+.mockResolvedValueOnce({ value: "shared-secret" })
182+.mockResolvedValueOnce({ value: "rotated-secret" })
183+.mockResolvedValueOnce({ value: "rotated-secret" });
180184const handler = createHandlerWithTarget(target);
181185182186const first = await dispatchJsonRequest({
@@ -195,10 +199,20 @@ describe("createTaskFlowWebhookRequestHandler", () => {
195199action: "list_flows",
196200},
197201});
202+const third = await dispatchJsonRequest({
203+ handler,
204+path: target.path,
205+secret: "rotated-secret",
206+body: {
207+action: "list_flows",
208+},
209+});
198210199211expect(first.statusCode).toBe(200);
200-expect(second.statusCode).toBe(200);
201-expect(hoisted.resolveConfiguredSecretInputStringMock).toHaveBeenCalledTimes(1);
212+expect(second.statusCode).toBe(401);
213+expect(second.body).toBe("unauthorized");
214+expect(third.statusCode).toBe(200);
215+expect(hoisted.resolveConfiguredSecretInputStringMock).toHaveBeenCalledTimes(3);
202216});
203217204218it("creates flows through the bound session and scrubs owner metadata from responses", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。