feat: add controlled codex thread compaction
This commit is contained in:
@@ -1545,6 +1545,34 @@ test("codex app-server runner rolls back a thread without starting a new turn or
|
||||
assert.equal(result.turnId, undefined);
|
||||
});
|
||||
|
||||
test("codex app-server runner starts thread compaction without starting a normal 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-compact",
|
||||
taskType: "conversation_reply",
|
||||
intentCategory: "thread_compact",
|
||||
targetCodexThreadRef: "019d-app-server-thread",
|
||||
targetCodexFolderRef: repoRoot,
|
||||
executionPrompt: "压缩当前 Codex 线程上下文。",
|
||||
});
|
||||
|
||||
assert.equal(result.status, "completed");
|
||||
assert.equal(result.threadId, "019d-app-server-thread");
|
||||
assert.equal(result.turnControl, "compact");
|
||||
assert.equal(result.compaction?.status, "completed");
|
||||
assert.match(result.replyBody, /已发起 Codex 线程上下文压缩/);
|
||||
assert.doesNotMatch(JSON.stringify(result), /context-compaction-secret-should-not-leak/);
|
||||
assert.doesNotMatch(JSON.stringify(result), /private compaction summary should not leak/);
|
||||
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