feat: add controlled codex thread rollback
This commit is contained in:
@@ -1516,6 +1516,35 @@ test("codex app-server runner retries transient overloaded JSON-RPC requests", a
|
||||
}
|
||||
});
|
||||
|
||||
test("codex app-server runner rolls back a thread without starting a new turn or leaking history", async () => {
|
||||
const runnerConfig = getCodexAppServerRunnerConfig(process.env, {
|
||||
codexAppServerEnabled: true,
|
||||
codexAppServerCommand: process.execPath,
|
||||
codexAppServerArgs: ["tests/fixtures/codex-app-server-runtime.mjs"],
|
||||
codexAppServerWorkdir: repoRoot,
|
||||
codexAppServerTimeoutMs: 5000,
|
||||
});
|
||||
|
||||
const result = await executeCodexAppServerTask(runnerConfig, {
|
||||
taskId: "task-thread-rollback",
|
||||
taskType: "conversation_reply",
|
||||
intentCategory: "thread_rollback",
|
||||
targetCodexThreadRef: "019d-app-server-thread",
|
||||
targetCodexFolderRef: repoRoot,
|
||||
rollbackNumTurns: 2,
|
||||
executionPrompt: "回滚最近 2 轮 Codex 线程历史。",
|
||||
});
|
||||
|
||||
assert.equal(result.status, "completed");
|
||||
assert.equal(result.threadId, "019d-app-server-thread");
|
||||
assert.equal(result.turnControl, "rollback");
|
||||
assert.equal(result.rollback?.numTurns, 2);
|
||||
assert.match(result.replyBody, /已回滚 Codex 线程最近 2 轮/);
|
||||
assert.match(result.replyBody, /不会自动还原本地文件变更/);
|
||||
assert.doesNotMatch(result.replyBody, /private rollback turn text/);
|
||||
assert.equal(result.turnId, undefined);
|
||||
});
|
||||
|
||||
test("codex app-server runner stays disabled unless feature flag is explicit", () => {
|
||||
const runnerConfig = getCodexAppServerRunnerConfig(process.env, {
|
||||
codexAppServerCommand: process.execPath,
|
||||
|
||||
Reference in New Issue
Block a user