diff --git a/extensions/codex/src/app-server/models.test.ts b/extensions/codex/src/app-server/models.test.ts index 2af3aa5df76..f1d94e83579 100644 --- a/extensions/codex/src/app-server/models.test.ts +++ b/extensions/codex/src/app-server/models.test.ts @@ -4,10 +4,25 @@ import { listCodexAppServerModels } from "./models.js"; import { resetSharedCodexAppServerClientForTests } from "./shared-client.js"; import { createClientHarness } from "./test-support.js"; +const mocks = vi.hoisted(() => ({ + bridgeCodexAppServerStartOptions: vi.fn(async ({ startOptions }) => startOptions), + resolveOpenClawAgentDir: vi.fn(() => "/tmp/openclaw-agent"), +})); + +vi.mock("./auth-bridge.js", () => ({ + bridgeCodexAppServerStartOptions: mocks.bridgeCodexAppServerStartOptions, +})); + +vi.mock("openclaw/plugin-sdk/provider-auth", () => ({ + resolveOpenClawAgentDir: mocks.resolveOpenClawAgentDir, +})); + describe("listCodexAppServerModels", () => { afterEach(() => { resetSharedCodexAppServerClientForTests(); vi.restoreAllMocks(); + mocks.bridgeCodexAppServerStartOptions.mockClear(); + mocks.resolveOpenClawAgentDir.mockClear(); }); it("lists app-server models through the typed helper", async () => { @@ -15,6 +30,7 @@ describe("listCodexAppServerModels", () => { const startSpy = vi.spyOn(CodexAppServerClient, "start").mockReturnValue(harness.client); const listPromise = listCodexAppServerModels({ limit: 12, timeoutMs: 1000 }); + await vi.waitFor(() => expect(harness.writes.length).toBeGreaterThanOrEqual(1)); const initialize = JSON.parse(harness.writes[0] ?? "{}") as { id?: number }; harness.send({ id: initialize.id, diff --git a/src/agents/sandbox/fs-bridge-mutation-helper.test.ts b/src/agents/sandbox/fs-bridge-mutation-helper.test.ts index 597fa66f702..fe634529750 100644 --- a/src/agents/sandbox/fs-bridge-mutation-helper.test.ts +++ b/src/agents/sandbox/fs-bridge-mutation-helper.test.ts @@ -126,29 +126,7 @@ describe("sandbox pinned mutation helper", () => { const result = runWritePlan( ["write", workspace, "nested/deeper", "note.txt", "1"], "hello", - ); - - expect(result.status).toBe(0); - await expect( - fs.readFile(path.join(workspace, "nested", "deeper", "note.txt"), "utf8"), - ).resolves.toBe("hello"); - }); - }, - ); - - it.runIf(process.platform !== "win32" && hasAbsolutePythonCandidate)( - "finds an absolute python when the write plan runs with an empty PATH", - async () => { - await withTempDir({ prefix: "openclaw-mutation-helper-" }, async (root) => { - const workspace = path.join(root, "workspace"); - await fs.mkdir(workspace, { recursive: true }); - - const result = runWritePlan( - ["write", workspace, "nested/deeper", "note.txt", "1"], - "hello", - { - PATH: "", - }, + hasAbsolutePythonCandidate ? { PATH: "" } : undefined, ); expect(result.status).toBe(0);