mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 12:56:01 -06:00
fix(codex): preserve omitted resume effort
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user