























@@ -60,6 +60,7 @@ import {
60606161let tempDir: string;
6262let codexAppServerClientFactoryForTest: CodexAppServerClientFactory | undefined;
63+const fastWait = { interval: 1, timeout: 5_000 } as const;
63646465type RunCodexAppServerAttemptOptions = NonNullable<
6566Parameters<typeof runCodexAppServerAttemptImpl>[1]
@@ -1505,7 +1506,7 @@ describe("runCodexAppServerAttempt", () => {
15051506const run = runCodexAppServerAttempt(params, {
15061507pluginConfig: { appServer: { turnCompletionIdleTimeoutMs: 5 } },
15071508});
1508-await vi.waitFor(() => expect(handleRequest).toBeTypeOf("function"), { interval: 1 });
1509+await vi.waitFor(() => expect(handleRequest).toBeTypeOf("function"), fastWait);
1509151015101511const toolResult = (await handleRequest?.({
15111512id: "request-tool-1",
@@ -1831,7 +1832,7 @@ describe("runCodexAppServerAttempt", () => {
18311832],
18321833},
18331834});
1834-await vi.waitFor(() => expect(params.onBlockReply).toHaveBeenCalledTimes(1), { interval: 1 });
1835+await vi.waitFor(() => expect(params.onBlockReply).toHaveBeenCalledTimes(1), fastWait);
18351836await new Promise((resolve) => setTimeout(resolve, 60));
1836183718371838expect(harness.request.mock.calls.some(([method]) => method === "turn/interrupt")).toBe(false);
@@ -1959,7 +1960,7 @@ describe("runCodexAppServerAttempt", () => {
19591960turnCompletionIdleTimeoutMs: 5,
19601961turnTerminalIdleTimeoutMs: 60_000,
19611962});
1962-await vi.waitFor(() => expect(handleRequest).toBeTypeOf("function"), { interval: 1 });
1963+await vi.waitFor(() => expect(handleRequest).toBeTypeOf("function"), fastWait);
1963196419641965const toolResult = (await handleRequest?.({
19651966id: "request-tool-1",
@@ -2037,7 +2038,7 @@ describe("runCodexAppServerAttempt", () => {
20372038turnCompletionIdleTimeoutMs: 5,
20382039turnTerminalIdleTimeoutMs: 200,
20392040});
2040-await vi.waitFor(() => expect(handleRequest).toBeTypeOf("function"), { interval: 1 });
2041+await vi.waitFor(() => expect(handleRequest).toBeTypeOf("function"), fastWait);
2041204220422043const toolResult = (await handleRequest?.({
20432044id: "request-tool-1",
@@ -2129,7 +2130,7 @@ describe("runCodexAppServerAttempt", () => {
21292130turnCompletionIdleTimeoutMs: 5,
21302131turnTerminalIdleTimeoutMs: 200,
21312132});
2132-await vi.waitFor(() => expect(handleRequest).toBeTypeOf("function"), { interval: 1 });
2133+await vi.waitFor(() => expect(handleRequest).toBeTypeOf("function"), fastWait);
2133213421342135const toolResult = (await handleRequest?.({
21352136id: "request-tool-1",
@@ -2226,7 +2227,7 @@ describe("runCodexAppServerAttempt", () => {
22262227turnAssistantCompletionIdleTimeoutMs: 200,
22272228turnTerminalIdleTimeoutMs: 200,
22282229});
2229-await vi.waitFor(() => expect(handleRequest).toBeTypeOf("function"), { interval: 1 });
2230+await vi.waitFor(() => expect(handleRequest).toBeTypeOf("function"), fastWait);
2230223122312232const toolResult = (await handleRequest?.({
22322233id: "request-tool-1",
@@ -2318,7 +2319,7 @@ describe("runCodexAppServerAttempt", () => {
23182319turnAssistantCompletionIdleTimeoutMs: 5,
23192320turnTerminalIdleTimeoutMs: 500,
23202321});
2321-await vi.waitFor(() => expect(handleRequest).toBeTypeOf("function"), { interval: 1 });
2322+await vi.waitFor(() => expect(handleRequest).toBeTypeOf("function"), fastWait);
2322232323232324const toolResult = (await handleRequest?.({
23242325id: "request-tool-1",
@@ -2497,7 +2498,7 @@ describe("runCodexAppServerAttempt", () => {
24972498turnAssistantCompletionIdleTimeoutMs: 500,
24982499turnTerminalIdleTimeoutMs: 5,
24992500});
2500-await vi.waitFor(() => expect(handleRequest).toBeTypeOf("function"), { interval: 1 });
2501+await vi.waitFor(() => expect(handleRequest).toBeTypeOf("function"), fastWait);
2501250225022503const toolResult = (await handleRequest?.({
25032504id: "request-tool-1",
@@ -4736,7 +4737,7 @@ describe("runCodexAppServerAttempt", () => {
47364737() => expect(request.mock.calls.map(([method]) => method)).toContain("turn/start"),
47374738{ interval: 1 },
47384739);
4739-await vi.waitFor(() => expect(handleRequest).toBeTypeOf("function"), { interval: 1 });
4740+await vi.waitFor(() => expect(handleRequest).toBeTypeOf("function"), fastWait);
4740474147414742const response = handleRequest?.({
47424743id: "request-input-1",
@@ -4761,7 +4762,7 @@ describe("runCodexAppServerAttempt", () => {
47614762},
47624763});
476347644764-await vi.waitFor(() => expect(params.onBlockReply).toHaveBeenCalledTimes(1), { interval: 1 });
4765+await vi.waitFor(() => expect(params.onBlockReply).toHaveBeenCalledTimes(1), fastWait);
47654766expect(queueActiveRunMessageForTest("session-1", "2")).toBe(true);
47664767await expect(response).resolves.toEqual({
47674768answers: { mode: { answers: ["Deep"] } },
@@ -6190,7 +6191,7 @@ describe("runCodexAppServerAttempt", () => {
61906191});
6191619261926193const run = runCodexAppServerAttempt(createParams(sessionFile, workspaceDir));
6193-await vi.waitFor(() => expect(requests[1]).toContain("turn/start"), { interval: 1 });
6194+await vi.waitFor(() => expect(requests[1]).toContain("turn/start"), fastWait);
61946195await notify({
61956196method: "turn/completed",
61966197params: {
@@ -6239,7 +6240,7 @@ describe("runCodexAppServerAttempt", () => {
62396240});
6240624162416242const run = runCodexAppServerAttempt(createParams(sessionFile, workspaceDir));
6242-await vi.waitFor(() => expect(requests[2]).toContain("turn/start"), { interval: 1 });
6243+await vi.waitFor(() => expect(requests[2]).toContain("turn/start"), fastWait);
62436244await notify({
62446245method: "turn/completed",
62456246params: {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。