Compare commits

...
@@ -0,0 +1,49 @@
import { mkdir, mkdtemp, rm } from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";
import pino from "pino";
import { expect, test } from "vitest";
import { CodexAppServerAgentClient } from "../agent/providers/codex-app-server-agent.js";
import { DaemonClient } from "../test-utils/daemon-client.js";
import { createTestPaseoDaemon } from "../test-utils/paseo-daemon.js";
import { canRunRealProvider } from "./real-provider-test-config.js";
test("continues an existing Codex chat after clearing the model preference", async (context) => {
if (!(await canRunRealProvider("codex"))) {
context.skip();
return;
}
const artifacts = fileURLToPath(new URL("../../../../../.artifacts/", import.meta.url));
await mkdir(artifacts, { recursive: true });
const cwd = await mkdtemp(path.join(artifacts, "codex-model-reset-"));
const logger = pino({ level: "silent" });
try {
const daemon = await createTestPaseoDaemon({
agentClients: { codex: new CodexAppServerAgentClient(logger) },
logger,
});
const client = new DaemonClient({ url: `ws://127.0.0.1:${daemon.port}/ws` });
try {
await client.connect();
const agent = await client.createAgent({ cwd, provider: "codex", modeId: "auto" });
await client.sendAgentMessage(agent.id, "Reply with exactly: BEFORE");
expect(await client.waitForFinish(agent.id, 60_000)).toMatchObject({
status: "idle",
lastMessage: "BEFORE",
});
await client.setAgentModel(agent.id, null);
await client.sendAgentMessage(agent.id, "Reply with exactly: AFTER");
expect(await client.waitForFinish(agent.id, 60_000)).toMatchObject({
status: "idle",
lastMessage: "AFTER",
});
} finally {
await client.close();
await daemon.close();
}
} finally {
await rm(cwd, { recursive: true, force: true });
}
}, 180_000);