fix: clarify codex supervisor active counts

This commit is contained in:
Codex
2026-05-23 02:49:09 +00:00
parent 982f21ec62
commit 8393bc531a
5 changed files with 233 additions and 11 deletions
@@ -82,6 +82,14 @@ function fixtureResponse(path: string): JsonRecord {
body: {
ok: true,
queue: {
counts: {
running: 15,
judging: 0,
queued: 4,
retry_wait: 1,
succeeded: 13,
},
maxActiveQueues: 12,
executionDiagnostics: {
state: "split-brain",
splitBrain: true,
@@ -112,7 +120,7 @@ function fixtureResponse(path: string): JsonRecord {
pagination: {
limit: 200,
returned: 15,
total: 15,
total: 33,
hasMore: false,
nextBeforeId: null,
includeActive: true,
@@ -152,6 +160,13 @@ function manyRunningFixtureResponse(path: string): JsonRecord {
body: {
ok: true,
queue: {
counts: {
running: 40,
judging: 0,
queued: 7,
retry_wait: 2,
},
maxActiveQueues: 50,
executionDiagnostics: {
state: "healthy",
databaseActiveTaskCount: 40,
@@ -227,7 +242,7 @@ function splitBrainLiveSupervisorFixtureResponse(path: string): JsonRecord {
}
export function runCodeQueueSupervisorDisclosureContract(): JsonRecord {
const supervisor = codexTasksQueryForTest(["--view", "supervisor", "--limit", "20"], fixtureResponse);
const supervisor = codexTasksQueryForTest(["--view", "supervisor", "--limit", "260"], fixtureResponse);
const full = codexTasksQueryForTest(["--view", "full", "--limit", "20"], fixtureResponse);
const runningFiltered = codexTasksQueryForTest(["--status", "running", "--limit", "40"], manyRunningFixtureResponse);
const unreadFiltered = codexTasksQueryForTest(["--unread", "--limit", "20"], fixtureResponse);
@@ -251,6 +266,13 @@ export function runCodeQueueSupervisorDisclosureContract(): JsonRecord {
const completedUnread = asRecord(supervisorView.completedUnread);
const fullTasks = asRecord(asRecord(full).tasks);
const diagnostics = asRecord(supervisorView.executionDiagnostics);
const filters = asRecord(supervisorView.filters);
const activeRunning = asRecord(supervisorView.activeRunning);
const activeRunningRowPage = asRecord(activeRunning.rowPage);
const activeRunningRedline = asRecord(activeRunning.redline);
const activeRunningCommands = asRecord(activeRunning.commands);
const counts = asRecord(supervisorView.counts);
const outputBudget = asRecord(asRecord(disclosure.outputBudget));
const listBudget = asRecord(diagnostics.listBudget);
const omittedCounts = asRecord(listBudget.omittedCounts);
const splitBrainLiveView = asRecord(asRecord(splitBrainLive).supervisor);
@@ -286,8 +308,13 @@ export function runCodeQueueSupervisorDisclosureContract(): JsonRecord {
assertCondition(fullItem.status === "running" && String(fullItem.statusLabel ?? "").includes("awaiting terminal/judge"), "full view should keep raw status while exposing derived closeout label", fullItem);
assertCondition(fullItem.awaitingTerminalJudge === true && fullItem.closeoutState === "awaiting-terminal-or-judge", "full view should expose awaiting terminal/judge state", fullItem);
assertCondition(fullTasks.returned === 15, "full view must not inherit supervisor recentCompleted cap", fullTasks);
const budget = asRecord(disclosure.outputBudget);
assertCondition(budget.recentCompletedReturnedLimit === 3 && budget.sectionReturnedLimit === 3, "supervisor must expose output budget metadata", disclosure);
assertCondition(filters.requestedLimit === 260 && filters.limit === 100 && filters.limitCapped === true, "supervisor filters should disclose requested vs effective limit", filters);
assertCondition(outputBudget.requestedLimit === 260 && outputBudget.effectiveLimit === 100 && outputBudget.sectionReturnedLimit === 3, "supervisor must expose output budget metadata", outputBudget);
assertCondition(activeRunning.count === 15 && activeRunning.exact === true && activeRunning.source === "queue-summary-counts", "activeRunning should expose exact running+judging count from queue summary", activeRunning);
assertCondition(activeRunningRowPage.returned === 1 && activeRunningRowPage.returnedLimit === 3 && activeRunningRowPage.distinction.includes("row page"), "activeRunning row page should distinguish returned rows from active count", activeRunningRowPage);
assertCondition(activeRunningRedline.countField === "supervisor.activeRunning.count" && activeRunningRedline.hardRedline === 15 && activeRunningRedline.state === "at-or-over-hard-redline", "activeRunning redline should name count field and interpretation", activeRunningRedline);
assertCondition(counts.activeRunningCount === 15 && counts.activeRunningExact === true && counts.activeRunningRowsReturned === 1, "supervisor counts should separate active count from returned running rows", counts);
assertCondition(String(activeRunningCommands.running ?? "").includes("--status running,judging"), "activeRunning should provide running drilldown", activeRunningCommands);
assertCondition(asArray(runningFilteredSection.items).length === 3, "running status filter should be locally paged below --limit", runningFilteredSection);
assertCondition(runningFilteredSection.count === 40 && runningFilteredSection.hasMore === true, "running status filter should preserve count and hasMore", runningFilteredSection);
assertCondition(String(asRecord(runningFilteredSection.commands).next ?? "").includes("--before-id task-running-03"), "running status filter should provide next page command", runningFilteredSection);
@@ -324,6 +351,8 @@ export function runCodeQueueSupervisorDisclosureContract(): JsonRecord {
"recentCompleted capped",
"running/unread locally paged",
"split-brain diagnostics capped",
"active running exact count exposed",
"requested/effective/returned limits disclosed",
"prompt/body previews bounded",
"running finalResponse rows labeled awaiting terminal/judge",
"drill-down commands preserved",