Compare commits

...
Author SHA1 Message Date
paseo-bot[bot] 6c3b213056 test(codex): verify the model stays cleared after a turn 2026-12-04 19:39:55 +00:00
paseo-bot[bot] 053c76ba93 fix(codex): continue chats after clearing the model preference
Clearing the preference on a loaded thread left collaboration settings without the model Codex requires. Resolve the default when building the next turn so the reset can stay in effect.
2026-12-04 19:28:32 +00:00
2 changed files with 56 additions and 4 deletions
@@ -4789,10 +4789,10 @@ export class CodexAppServerAgentSession implements AgentSession {
}
params.serviceTier = this.serviceTier ?? "default";
if (this.resolvedCollaborationMode) {
params.collaborationMode = {
mode: this.resolvedCollaborationMode.mode,
settings: this.resolvedCollaborationMode.settings,
};
const { mode, settings } = this.resolvedCollaborationMode;
// Codex requires a model in collaboration settings even after the preference is cleared.
const model = settings.model ?? (await this.resolveModelAndThinking()).model;
params.collaborationMode = { mode, settings: { ...settings, model } };
}
if (this.config.cwd) {
params.cwd = this.config.cwd;
@@ -0,0 +1,52 @@
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",
});
expect(await client.fetchAgent({ agentId: agent.id })).toMatchObject({
agent: { model: null, runtimeInfo: { model: null } },
});
} finally {
await client.close();
await daemon.close();
}
} finally {
await rm(cwd, { recursive: true, force: true });
}
}, 180_000);