feat: fork codex threads

This commit is contained in:
AI Bot
2026-06-03 14:49:43 +08:00
parent 5537fde7a6
commit 0c3437a36f
11 changed files with 393 additions and 1 deletions

View File

@@ -1714,6 +1714,36 @@ test("codex app-server runner syncs thread git metadata without starting a norma
assert.doesNotMatch(JSON.stringify(result), /thread-metadata-secret-should-not-leak/);
});
test("codex app-server runner forks a thread without starting a normal turn", 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-fork",
taskType: "conversation_reply",
intentCategory: "thread_fork",
targetCodexThreadRef: "019d-app-server-thread",
targetCodexFolderRef: repoRoot,
threadForkEphemeral: false,
executionPrompt: "分叉当前 Codex 线程。",
});
assert.equal(result.status, "completed");
assert.equal(result.threadId, "019d-app-server-thread");
assert.equal(result.turnControl, "fork");
assert.equal(result.threadFork?.sourceThreadId, "019d-app-server-thread");
assert.equal(result.threadFork?.forkedThreadId, "019d-app-server-thread-fork");
assert.equal(result.threadFork?.forkedThreadName, "Forked working thread");
assert.equal(result.threadFork?.ephemeral, false);
assert.equal(result.turnId, undefined);
assert.doesNotMatch(JSON.stringify(result), /thread-fork-secret-should-not-leak/);
});
test("codex app-server runner stays disabled unless feature flag is explicit", () => {
const runnerConfig = getCodexAppServerRunnerConfig(process.env, {
codexAppServerCommand: process.execPath,