feat: surface codex tool activity progress

This commit is contained in:
AI Bot
2026-06-01 18:04:39 +08:00
parent 2a5dccf5cb
commit 2ca2737520
11 changed files with 558 additions and 7 deletions

View File

@@ -642,6 +642,82 @@ test("codex app-server runner maps collab tool calls and context compaction with
}
});
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";
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-tool-activity-events",
taskType: "conversation_reply",
targetCodexThreadRef: "019d-app-server-thread",
targetCodexFolderRef: repoRoot,
executionPrompt: "检查 Codex 工具活动",
});
assert.equal(result.status, "completed");
assert.deepEqual(result.executionProgress.toolActivities, [
{
kind: "mcp",
name: "github/pull_request/list",
status: "failed",
detail: "token=[redacted] failed",
},
{
kind: "dynamic",
name: "browser.open",
status: "completed",
detail: "成功 · 1234ms",
},
{
kind: "web_search",
name: "openPage",
status: "running",
detail: "Codex App Server ThreadItem",
},
{
kind: "image_view",
name: "imageView",
status: "completed",
detail: "private-screenshot.png",
},
{
kind: "review",
name: "reviewMode",
status: "exited",
detail: "completed",
},
{
kind: "command",
name: "commandExecution",
status: "completed",
detail: "exit 0 · 2345ms",
},
]);
const serialized = JSON.stringify(result.executionProgress);
assert.equal(serialized.includes("sk-secret-should-not-leak"), false);
assert.equal(serialized.includes("/Users/kris"), false);
assert.equal(serialized.includes("internal tool result"), false);
assert.equal(serialized.includes("internal review prompt"), false);
assert.equal(serialized.includes("id_rsa"), false);
assert.equal(serialized.includes("https://example.com/private"), false);
} finally {
if (previous === undefined) {
delete process.env.BOSS_CODEX_APP_SERVER_FIXTURE_EMIT_TOOL_ACTIVITY_EVENTS;
} else {
process.env.BOSS_CODEX_APP_SERVER_FIXTURE_EMIT_TOOL_ACTIVITY_EVENTS = previous;
}
}
});
test("codex app-server runner bridges source thread context into target thread through inject_items", async () => {
const previous = process.env.BOSS_CODEX_APP_SERVER_FIXTURE_INTER_THREAD;
process.env.BOSS_CODEX_APP_SERVER_FIXTURE_INTER_THREAD = "1";