feat: summarize codex stream progress events

This commit is contained in:
AI Bot
2026-06-03 12:53:43 +08:00
parent bc9a586e81
commit 142fb2a4b3
11 changed files with 419 additions and 3 deletions

View File

@@ -933,6 +933,56 @@ test("codex app-server runner maps collab tool calls and context compaction with
}
});
test("codex app-server runner summarizes stream deltas without leaking raw delta content", async () => {
const previous = process.env.BOSS_CODEX_APP_SERVER_FIXTURE_EMIT_STREAM_DELTA_EVENTS;
process.env.BOSS_CODEX_APP_SERVER_FIXTURE_EMIT_STREAM_DELTA_EVENTS = "1";
try {
const runnerConfig = getCodexAppServerRunnerConfig(process.env, {
codexAppServerEnabled: true,
codexAppServerCommand: process.execPath,
codexAppServerArgs: ["tests/fixtures/codex-app-server-runtime.mjs"],
codexAppServerWorkdir: repoRoot,
codexAppServerTimeoutMs: 5000,
masterAgentModel: "gpt-5.4",
});
const result = await executeCodexAppServerTask(runnerConfig, {
taskId: "task-app-server-stream-deltas",
taskType: "conversation_reply",
targetCodexThreadRef: "019d-app-server-thread",
targetCodexFolderRef: repoRoot,
executionPrompt: "检查 Codex 流式增量进度",
});
assert.equal(result.status, "completed");
assert.deepEqual(result.executionProgress.streamEvents, {
status: "completed",
agentDeltaCount: 1,
planDeltaCount: 1,
reasoningDeltaCount: 3,
toolProgressCount: 1,
commandOutputChunkCount: 1,
terminalInteractionCount: 1,
fileOutputChunkCount: 1,
});
const serialized = JSON.stringify(result.executionProgress);
assert.equal(serialized.includes("secret plan delta should not leak"), false);
assert.equal(serialized.includes("secret reasoning summary part should not leak"), false);
assert.equal(serialized.includes("secret reasoning summary delta should not leak"), false);
assert.equal(serialized.includes("secret raw reasoning delta should not leak"), false);
assert.equal(serialized.includes("secret mcp progress should not leak"), false);
assert.equal(serialized.includes("secret command output should not leak"), false);
assert.equal(serialized.includes("secret terminal input should not leak"), false);
assert.equal(serialized.includes("secret file output should not leak"), false);
} finally {
if (previous === undefined) {
delete process.env.BOSS_CODEX_APP_SERVER_FIXTURE_EMIT_STREAM_DELTA_EVENTS;
} else {
process.env.BOSS_CODEX_APP_SERVER_FIXTURE_EMIT_STREAM_DELTA_EVENTS = previous;
}
}
});
test("codex app-server runner maps tool, search, image, review, and command activities without leaking payloads", async () => {
const previous = process.env.BOSS_CODEX_APP_SERVER_FIXTURE_EMIT_TOOL_ACTIVITY_EVENTS;
process.env.BOSS_CODEX_APP_SERVER_FIXTURE_EMIT_TOOL_ACTIVITY_EVENTS = "1";