fix(codex): preserve omitted resume effort

This commit is contained in:
Dallin Romney
2026-08-20 22:35:44 -07:00
parent 4ca6dcbac0
commit 34f50b4860
2 changed files with 37 additions and 1 deletions
@@ -285,7 +285,9 @@ export async function resumeExistingCodexThread(
boundAuthProfileId,
response.modelProvider ?? requestModelProvider ?? startModelProvider,
),
reasoningEffort: response.reasoningEffort,
...(response.reasoningEffort !== undefined
? { reasoningEffort: response.reasoningEffort }
: {}),
dynamicToolsFingerprint,
dynamicToolsContainDeferred,
webSearchThreadConfigFingerprint,
@@ -291,6 +291,40 @@ function createTwoCalendarAppPolicyContext() {
setupRunAttemptTestHooks();
describe("Codex app-server thread lifecycle bindings", () => {
it("preserves the stored reasoning effort when resume omits it", async () => {
const sessionFile = path.join(tempDir, "session-effort.jsonl");
const workspaceDir = path.join(tempDir, "workspace-effort");
const threadId = "thread-effort";
const request = vi.fn(async (method: string) => {
const response = threadStartResult(threadId);
if (method === "thread/start") {
return { ...response, reasoningEffort: "high" };
}
if (method === "thread/resume") {
const { reasoningEffort: _reasoningEffort, ...withoutReasoningEffort } = response;
return withoutReasoningEffort;
}
throw new Error(`unexpected method: ${method}`);
});
const common = {
client: { getInstanceId: () => "effort-client", request } as never,
params: createParams(sessionFile, workspaceDir),
cwd: workspaceDir,
dynamicTools: [],
appServer: createThreadLifecycleAppServerOptions(),
userMcpServersEnabled: false,
};
await startOrResumeThread(common);
await startOrResumeThread(common);
expect(request.mock.calls.map(([method]) => method)).toEqual(["thread/start", "thread/resume"]);
await expect(readCodexAppServerBinding(sessionFile)).resolves.toMatchObject({
threadId,
reasoningEffort: "high",
});
});
it("persists the native rollout path across thread start and resume", async () => {
const sessionFile = path.join(tempDir, "session.jsonl");
const workspaceDir = path.join(tempDir, "workspace");