fix: reduce code queue commander CLI noise
This commit is contained in:
@@ -142,6 +142,97 @@ function noisyCommanderFixture(path: string, requests: RequestRecord[] = []): Js
|
||||
};
|
||||
}
|
||||
|
||||
function readyCommanderFixture(path: string): JsonRecord {
|
||||
if (path.includes("/summary")) {
|
||||
const taskId = decodeURIComponent(path.split("/api/tasks/")[1]?.split("/")[0] ?? "unknown");
|
||||
return {
|
||||
ok: true,
|
||||
status: 200,
|
||||
body: {
|
||||
ok: true,
|
||||
summary: {
|
||||
id: taskId,
|
||||
queueId: "default",
|
||||
status: "succeeded",
|
||||
currentAttempt: 1,
|
||||
maxAttempts: 1,
|
||||
prompt: "D601 Code Queue GPT-5.5 runner completed normal workflow with ready platform status.",
|
||||
lastAssistantMessage: {
|
||||
at: "2026-05-22T00:59:00.000Z",
|
||||
seq: 12,
|
||||
source: "finalResponse",
|
||||
text: "Completed routine workflow with ready platform status and no follow-up incident.",
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
assertCondition(path.startsWith("/api/microservices/code-queue/proxy/api/tasks/overview"), "unexpected ready fixture path", { path });
|
||||
const tasks = Array.from({ length: 12 }, (_, index) => task(
|
||||
`task-ready-${index + 1}`,
|
||||
"succeeded",
|
||||
`2026-05-22T00:${String(40 - index).padStart(2, "0")}:00.000Z`,
|
||||
index === 2
|
||||
? "D601 Code Queue GPT-5.5 runner commander audit: infrastructure.status=ready riskCounts.infrastructureBlocker=0; do not classify all history as infrastructure-blocker"
|
||||
: index % 3 === 0
|
||||
? "D601 Code Queue GPT-5.5 runner workflow fix for UniDesk#20 commander CLI behavior"
|
||||
: index % 3 === 1
|
||||
? "D601 Code Queue GPT-5.5 runner user-facing HWLAB workbench implementation"
|
||||
: "D601 Code Queue GPT-5.5 runner routine unknown historical task",
|
||||
"2026-05-22T01:00:00.000Z",
|
||||
"Routine final response.",
|
||||
));
|
||||
return {
|
||||
ok: true,
|
||||
status: 200,
|
||||
body: {
|
||||
ok: true,
|
||||
queue: {
|
||||
counts: {
|
||||
running: 0,
|
||||
judging: 0,
|
||||
queued: 0,
|
||||
retry_wait: 0,
|
||||
succeeded: tasks.length,
|
||||
failed: 0,
|
||||
canceled: 0,
|
||||
},
|
||||
unreadTerminal: 0,
|
||||
maxActiveQueues: 15,
|
||||
storage: {
|
||||
postgresReady: true,
|
||||
health: {
|
||||
status: "ready",
|
||||
degraded: false,
|
||||
signals: [],
|
||||
},
|
||||
},
|
||||
executionDiagnostics: {
|
||||
now: "2026-05-22T01:00:00.000Z",
|
||||
state: "ready",
|
||||
effectiveLiveness: "idle",
|
||||
recommendedAction: "continue-supervision",
|
||||
databaseActiveTaskCount: 0,
|
||||
schedulerActiveRunSlotCount: 0,
|
||||
activeHeartbeatCount: 0,
|
||||
heartbeatRiskTaskIds: [],
|
||||
staleRecoveryCandidateTaskIds: [],
|
||||
traceGapTaskIds: [],
|
||||
},
|
||||
},
|
||||
pagination: {
|
||||
limit: 200,
|
||||
returned: tasks.length,
|
||||
total: tasks.length,
|
||||
hasMore: false,
|
||||
nextBeforeId: null,
|
||||
includeActive: true,
|
||||
},
|
||||
tasks,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function runCodeQueueCommanderViewContract(): JsonRecord {
|
||||
const commanderRequests: RequestRecord[] = [];
|
||||
const commanderLimit8Requests: RequestRecord[] = [];
|
||||
@@ -153,6 +244,7 @@ export function runCodeQueueCommanderViewContract(): JsonRecord {
|
||||
const supervisor = codexTasksQueryForTest(["--view", "supervisor", "--limit", "260"], fetchNoisy);
|
||||
const full = codexTasksQueryForTest(["--view", "full", "--limit", "260"], fetchNoisy);
|
||||
const commanderLimit8 = codexTasksQueryForTest(["--view", "commander", "--limit", "8"], fetchCommanderLimit8);
|
||||
const readyCommander = codexTasksQueryForTest(["--view", "commander", "--limit", "120"], readyCommanderFixture);
|
||||
const fullLimit8 = codexTasksQueryForTest(["--view", "full", "--limit", "8"], fetchNoisy);
|
||||
const unreadLimit8 = codexTasksQueryForTest(["--unread", "--limit", "8"], fetchNoisy);
|
||||
const commanderBody = JSON.stringify(commander);
|
||||
@@ -164,6 +256,7 @@ export function runCodeQueueCommanderViewContract(): JsonRecord {
|
||||
const commanderView = asRecord(asRecord(commander).commander);
|
||||
const commanderTerminalAliasView = asRecord(asRecord(commanderTerminalAliases).commander);
|
||||
const commanderLimit8View = asRecord(asRecord(commanderLimit8).commander);
|
||||
const readyCommanderView = asRecord(asRecord(readyCommander).commander);
|
||||
const supervisorView = asRecord(asRecord(supervisor).supervisor);
|
||||
const filters = asRecord(commanderView.filters);
|
||||
const activeRunners = asRecord(commanderView.activeRunners);
|
||||
@@ -174,6 +267,10 @@ export function runCodeQueueCommanderViewContract(): JsonRecord {
|
||||
const highPriorityIssues = asRecord(commanderView.highPriorityIssues);
|
||||
const classification = asRecord(commanderView.classification);
|
||||
const byCategory = asRecord(classification.byCategory);
|
||||
const readyRiskCounts = asRecord(readyCommanderView.riskCounts);
|
||||
const readyClassification = asRecord(readyCommanderView.classification);
|
||||
const readyByCategory = asRecord(readyClassification.byCategory);
|
||||
const readyInfrastructure = asRecord(readyCommanderView.infrastructure);
|
||||
const commands = asRecord(commanderView.commands);
|
||||
const attention = asRecord(commanderView.attention);
|
||||
const attentionItems = asArray(attention.items).map(asRecord);
|
||||
@@ -204,13 +301,16 @@ export function runCodeQueueCommanderViewContract(): JsonRecord {
|
||||
assertCondition(activeItems.some((item) => item.id === "task-running-risk") && activeItems.some((item) => item.id === "task-running-watch"), "commander activeRunners should include compact active task items", activeRunners);
|
||||
assertCondition(attentionCounts.total === 4 && attentionCounts.returned === 4 && attentionCounts.omitted === 0, "commander attention counts should preserve non-terminal attention totals", attentionCounts);
|
||||
assertCondition(highPriorityIssues.present === true && highPriorityIssues.matchedCount === 7, "commander should surface tracked high-priority issues", highPriorityIssues);
|
||||
assertCondition(Number(byCategory["business-user-facing"] ?? 0) >= 1
|
||||
&& Number(byCategory["deployment-artifact"] ?? 0) >= 1
|
||||
&& Number(byCategory["ci-e2e-evidence"] ?? 0) >= 1
|
||||
&& Number(byCategory["diagnostics-gate-report"] ?? 0) >= 1
|
||||
&& Number(byCategory["docs-governance"] ?? 0) >= 1
|
||||
assertCondition(Number(byCategory["user-facing"] ?? 0) >= 1
|
||||
&& Number(byCategory["cd-artifact"] ?? 0) >= 1
|
||||
&& Number(byCategory["noise-report"] ?? 0) >= 1
|
||||
&& Number(byCategory["infra-governance"] ?? 0) >= 1
|
||||
&& Number(byCategory["infrastructure-blocker"] ?? 0) >= 1, "deterministic classifier should cover requested categories", byCategory);
|
||||
assertCondition(classification.deterministic === true, "classification metadata should be deterministic", classification);
|
||||
assertCondition(Number(readyRiskCounts.infrastructureBlocker ?? 0) === 0, "ready commander page should not report infrastructure blocker risk", readyRiskCounts);
|
||||
assertCondition(readyInfrastructure.infrastructureBlocker === false && readyInfrastructure.status === "ready", "ready commander page should surface ready infrastructure", readyInfrastructure);
|
||||
assertCondition(Number(readyByCategory["infrastructure-blocker"] ?? 0) === 0, "runner/governance boilerplate must not classify historical tasks as infrastructure-blocker", readyByCategory);
|
||||
assertCondition(Number(readyByCategory["workflow"] ?? 0) + Number(readyByCategory["user-facing"] ?? 0) + Number(readyByCategory["infra-governance"] ?? 0) + Number(readyByCategory["unknown"] ?? 0) === 12, "ready fixture tasks should be split without blocker overreporting", readyByCategory);
|
||||
assertCondition(String(commands.refresh ?? "").includes("--view commander"), "commander refresh command should preserve explicit commander view", commands);
|
||||
assertCondition(String(commands.supervisor ?? "").startsWith("bun scripts/cli.ts codex tasks") && !String(commands.supervisor ?? "").includes("--view commander"), "commander should keep supervisor drilldown command", commands);
|
||||
assertCondition(String(commands.full ?? "").includes("--view full"), "commander should keep full drilldown command", commands);
|
||||
@@ -266,6 +366,7 @@ export function runCodeQueueCommanderViewContract(): JsonRecord {
|
||||
"attention rows expose active, queued/retry_wait and blocker signals",
|
||||
"high-priority issue refs are surfaced",
|
||||
"deterministic classifier emits requested categories",
|
||||
"ready infrastructure pages do not classify all historical runner tasks as infrastructure-blocker",
|
||||
"drilldown commands are present without prompt/final-response flood",
|
||||
"commander --limit 8 omits terminal unread details and prompt previews",
|
||||
"codex tasks --status completed,cancelled aliases normalize to succeeded,canceled",
|
||||
|
||||
Reference in New Issue
Block a user