fix: 收敛 commander supervisor 噪声

This commit is contained in:
Codex
2026-06-10 12:14:31 +08:00
parent 90aab17146
commit 04afc05f95
3 changed files with 16 additions and 5 deletions
+6 -1
View File
@@ -97,7 +97,8 @@ function livenessSnapshot(run: RunRecord, command: CommandRecord | null, events:
const active = terminal === null && !runIsTerminal(run) && !commandIsTerminal(command);
const lastEvent = events.at(-1) ?? null;
const lastVisibleActivity = latestVisibleActivity(scopedEvents);
const lastCommandActivity = lastVisibleActivity ?? latestLivenessActivity(scopedEvents);
const lastBusinessActivity = latestBusinessActivity(scopedEvents);
const lastCommandActivity = lastBusinessActivity ?? latestLivenessActivity(scopedEvents);
const lease = leaseSummary(run, nowMs);
const transportDisconnect = latestTransportDisconnect(scopedEvents);
const lastActivity = livenessActivitySummary(lastCommandActivity, nowMs);
@@ -193,6 +194,10 @@ function latestVisibleActivity(events: RunEvent[]): RunEvent | null {
return [...events].reverse().find((event) => event.type === "assistant_message" || event.type === "tool_call" || event.type === "command_output" || event.type === "diff" || event.type === "error" || event.type === "terminal_status") ?? null;
}
function latestBusinessActivity(events: RunEvent[]): RunEvent | null {
return [...events].reverse().find((event) => event.type === "assistant_message" || event.type === "tool_call" || event.type === "command_output" || event.type === "diff") ?? null;
}
function isLivenessActivityEvent(event: RunEvent): boolean {
if (event.type === "assistant_message" || event.type === "tool_call" || event.type === "command_output" || event.type === "diff" || event.type === "error" || event.type === "terminal_status") return true;
if (event.type !== "backend_status") return false;
@@ -65,6 +65,7 @@ const selfTest: SelfTestCase = async (context: SelfTestContext) => {
const summaryItem = ((commanderSummary.items as JsonRecord[]) ?? []).find((item) => item.id === task.id) as JsonRecord;
assert.equal(((summaryItem.supervisor as JsonRecord).phase), "terminal");
assert.equal(JSON.stringify(commanderSummary).includes("hwpod workspace apply-patch"), false, "commander summary must stay compact and avoid dumping command bodies");
assert.equal(JSON.stringify(summaryItem.supervisor).includes("fullRecordBytes"), false, "commander supervisor must not add bookkeeping noise");
assertNoSecretLeak({ toolResult, assistantLive, inactiveLive, terminalResult, session, commanderSummary });
return { name: "timeout-liveness", tests: ["tool-in-flight-liveness", "assistant-progress-liveness", "stdio-inactive-timeout-budget", "terminal-timeout-recovery", "queue-commander-supervisor"] };