feat: surface codex hook lifecycle progress

This commit is contained in:
AI Bot
2026-06-01 18:48:45 +08:00
parent 32a9c9a26a
commit b0a778ee68
9 changed files with 163 additions and 6 deletions

View File

@@ -770,6 +770,52 @@ test("codex app-server runner maps image generation as a safe activity and artif
}
});
test("codex app-server runner maps hook lifecycle events without leaking hook internals", async () => {
const previous = process.env.BOSS_CODEX_APP_SERVER_FIXTURE_EMIT_HOOK_EVENTS;
process.env.BOSS_CODEX_APP_SERVER_FIXTURE_EMIT_HOOK_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-hook-events",
taskType: "conversation_reply",
targetCodexThreadRef: "019d-app-server-thread",
targetCodexFolderRef: repoRoot,
executionPrompt: "检查 Codex hook 生命周期",
});
assert.equal(result.status, "completed");
assert.deepEqual(result.executionProgress.toolActivities, [
{
kind: "hook",
name: "postToolUse/command",
status: "completed",
detail: "project · async · 42ms",
},
]);
const serialized = JSON.stringify(result.executionProgress);
assert.equal(serialized.includes("hook-secret-should-not-leak"), false);
assert.equal(serialized.includes("sk-secret-should-not-leak"), false);
assert.equal(serialized.includes("/Users/kris"), false);
assert.equal(serialized.includes("private-hook.toml"), false);
assert.equal(serialized.includes("internal hook output"), false);
assert.equal(serialized.includes("private hook result"), false);
} finally {
if (previous === undefined) {
delete process.env.BOSS_CODEX_APP_SERVER_FIXTURE_EMIT_HOOK_EVENTS;
} else {
process.env.BOSS_CODEX_APP_SERVER_FIXTURE_EMIT_HOOK_EVENTS = previous;
}
}
});
test("codex app-server runner maps item plan and reasoning summary without leaking raw reasoning", async () => {
const previous = process.env.BOSS_CODEX_APP_SERVER_FIXTURE_EMIT_REASONING_PLAN_EVENTS;
process.env.BOSS_CODEX_APP_SERVER_FIXTURE_EMIT_REASONING_PLAN_EVENTS = "1";