

























@@ -3,7 +3,7 @@ import fs from "node:fs/promises";
33import os from "node:os";
44import path from "node:path";
55import {
6-abortAgentHarnessRun,
6+abortAndDrainAgentHarnessRun,
77type EmbeddedRunAttemptParams,
88} from "openclaw/plugin-sdk/agent-harness";
99import { AUTH_PROFILE_RUNTIME_CONTRACT } from "openclaw/plugin-sdk/agent-runtime-test-contracts";
@@ -65,10 +65,9 @@ const DISABLED_CODEX_WEB_SEARCH_THREAD_CONFIG_FINGERPRINT = JSON.stringify({
6565"features.standalone_web_search": false,
6666web_search: "disabled",
6767});
68+const APP_SERVER_START_WAIT = { interval: 1, timeout: 5_000 } as const;
686969-function writeCodexAppServerBinding(
70- ...args: Parameters<typeof writeRawCodexAppServerBinding>
71-) {
70+function writeCodexAppServerBinding(...args: Parameters<typeof writeRawCodexAppServerBinding>) {
7271const [sessionFile, binding, lookup] = args;
7372return writeRawCodexAppServerBinding(
7473sessionFile,
@@ -176,7 +175,7 @@ function createCodexAuthProfileHarness(params: { startMethod: "thread/start" | "
176175 seenAgentDirs,
177176async waitForMethod(method: string) {
178177await vi.waitFor(() => expect(requests.map((entry) => entry.method)).toContain(method), {
179-interval: 1,
178+...APP_SERVER_START_WAIT,
180179});
181180},
182181async completeTurn() {
@@ -202,7 +201,13 @@ describe("Auth profile runtime contract - Codex app-server adapter", () => {
202201203202afterEach(async () => {
204203vi.useRealTimers();
205-abortAgentHarnessRun(AUTH_PROFILE_RUNTIME_CONTRACT.sessionId);
204+await abortAndDrainAgentHarnessRun({
205+sessionId: AUTH_PROFILE_RUNTIME_CONTRACT.sessionId,
206+sessionKey: AUTH_PROFILE_RUNTIME_CONTRACT.sessionKey,
207+settleMs: 1_000,
208+forceClear: true,
209+reason: "test_cleanup",
210+});
206211resetCodexAppServerClientFactoryForTest();
207212await fs.rm(tmpDir, { recursive: true, force: true });
208213});
@@ -220,7 +225,7 @@ describe("Auth profile runtime contract - Codex app-server adapter", () => {
220225expect(harness.seenAuthProfileIds).toEqual([
221226AUTH_PROFILE_RUNTIME_CONTRACT.openAiCodexProfileId,
222227]),
223-{ interval: 1 },
228+APP_SERVER_START_WAIT,
224229);
225230expect(harness.seenAgentDirs).toEqual([tmpDir]);
226231await harness.waitForMethod("turn/start");
@@ -246,7 +251,7 @@ describe("Auth profile runtime contract - Codex app-server adapter", () => {
246251expect(harness.seenAuthProfileIds).toEqual([
247252AUTH_PROFILE_RUNTIME_CONTRACT.openAiCodexProfileId,
248253]),
249-{ interval: 1 },
254+APP_SERVER_START_WAIT,
250255);
251256await harness.waitForMethod("turn/start");
252257await harness.completeTurn();
@@ -271,7 +276,7 @@ describe("Auth profile runtime contract - Codex app-server adapter", () => {
271276expect(harness.seenAuthProfileIds).toEqual([
272277AUTH_PROFILE_RUNTIME_CONTRACT.openAiCodexProfileId,
273278]),
274-{ interval: 1 },
279+APP_SERVER_START_WAIT,
275280);
276281await harness.waitForMethod("turn/start");
277282await harness.completeTurn();
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。