Files
openclaw/extensions/codex/src/app-server/dynamic-tool-execution.owner-timeout.test.ts
Jason (Json) bccbb8a0c7 fix(memory): make persistence promises receipt-backed (#120989)
* fix: require memory persistence receipts

* fix(memory): bind persistence failures to tool owners

* fix(memory): preserve Codex persistence ownership

* test(plugin-sdk): account for owner metadata export

* test(codex): split owner timeout regression

* fix(memory): cover durable deletes across runtimes

* test(codex): type dynamic mutation fixtures

* fix(agents): fail closed ambiguous side-effect owners

* fix(memory): fail zero-row delete receipts
2026-08-16 00:50:10 -06:00

47 lines
1.4 KiB
TypeScript

import { afterEach, describe, expect, it, vi } from "vitest";
import { handleDynamicToolCallWithTimeout } from "./dynamic-tool-execution.js";
describe("dynamic tool owner timeout", () => {
afterEach(() => {
vi.restoreAllMocks();
vi.useRealTimers();
});
it("retains the concrete tool owner when timeout wins before a snapshot", async () => {
vi.useFakeTimers();
const ownerKey = '["memory-lancedb","memory_store"]';
const observeToolTerminal = vi.fn(() => ({
executionStarted: true,
sideEffectEvidence: true,
}));
const response = handleDynamicToolCallWithTimeout({
call: {
threadId: "thread-1",
turnId: "turn-1",
callId: "call-owner-timeout",
namespace: null,
tool: "memory_store",
arguments: { text: "Tuesday 09:00 release window" },
},
toolBridge: {
handleToolCall: vi.fn(() => new Promise<never>(() => {})),
consumeToolExecutionSnapshot: vi.fn(() => undefined),
sideEffectOwnerKeyForTool: vi.fn(() => ownerKey),
},
signal: new AbortController().signal,
timeoutMs: 1,
observeToolTerminal,
});
await vi.advanceTimersByTimeAsync(1);
await expect(response).resolves.toMatchObject({ success: false });
expect(observeToolTerminal).toHaveBeenCalledWith(
expect.objectContaining({
ownerMutation: { ownerKey },
outcome: "failure",
}),
);
});
});