@@ -3157,6 +3157,18 @@ function exactReviewQueueStats(
31573157 publicationCapacity ,
31583158 publicationDispatchLeaseMs ,
31593159 ) ;
3160+ const lanes = {
3161+ review : exactReviewQueueLaneStats (
3162+ items . filter ( ( item ) => ! exactReviewQueueIsPublication ( item ) ) ,
3163+ now ,
3164+ capacity ,
3165+ ) ,
3166+ publication : exactReviewQueueLaneStats (
3167+ items . filter ( exactReviewQueueIsPublication ) ,
3168+ now ,
3169+ publicationCapacity ,
3170+ ) ,
3171+ } ;
31603172 return {
31613173 pending : handoffHealth . phases . pending . count ,
31623174 dispatching : handoffHealth . phases . dispatching . count ,
@@ -3168,6 +3180,7 @@ function exactReviewQueueStats(
31683180 oldest_leased_at : handoffHealth . phases . leased . oldest_at ,
31693181 oldest_leased_age_seconds : handoffHealth . phases . leased . oldest_age_seconds ,
31703182 handoff_health : handoffHealth ,
3183+ lanes,
31713184 next_wake_at : nextWakeAt === null ? null : new Date ( nextWakeAt ) . toISOString ( ) ,
31723185 dispatcher : {
31733186 state : state . dispatcher ?. state || "unknown" ,
@@ -3182,6 +3195,35 @@ function exactReviewQueueStats(
31823195 } ;
31833196}
31843197
3198+ function exactReviewQueueLaneStats ( items : ExactReviewQueueItem [ ] , now : number , capacity : number ) {
3199+ const pendingItems = items . filter ( ( item ) => item . state === "pending" ) ;
3200+ const dispatchingItems = items . filter ( ( item ) => item . state === "dispatching" ) ;
3201+ const leasedItems = items . filter ( ( item ) => item . state === "leased" ) ;
3202+ const active = dispatchingItems . length + leasedItems . length ;
3203+ const oldestPendingAt = pendingItems . reduce < number | null > (
3204+ ( oldest , item ) => ( oldest === null ? item . createdAt : Math . min ( oldest , item . createdAt ) ) ,
3205+ null ,
3206+ ) ;
3207+ const nextAttemptAt = pendingItems . reduce < number | null > (
3208+ ( next , item ) => ( next === null ? item . nextAttemptAt : Math . min ( next , item . nextAttemptAt ) ) ,
3209+ null ,
3210+ ) ;
3211+ return {
3212+ pending : pendingItems . length ,
3213+ ready : pendingItems . filter ( ( item ) => item . nextAttemptAt <= now ) . length ,
3214+ backoff : pendingItems . filter ( ( item ) => item . nextAttemptAt > now ) . length ,
3215+ dispatching : dispatchingItems . length ,
3216+ leased : leasedItems . length ,
3217+ capacity,
3218+ active,
3219+ available_slots : Math . max ( 0 , capacity - active ) ,
3220+ oldest_pending_at : oldestPendingAt === null ? null : new Date ( oldestPendingAt ) . toISOString ( ) ,
3221+ oldest_pending_age_seconds :
3222+ oldestPendingAt === null ? null : Math . max ( 0 , Math . floor ( ( now - oldestPendingAt ) / 1_000 ) ) ,
3223+ next_attempt_at : nextAttemptAt === null ? null : new Date ( nextAttemptAt ) . toISOString ( ) ,
3224+ } ;
3225+ }
3226+
31853227export function exactReviewQueueNextWakeAt (
31863228 state : ExactReviewQueueState ,
31873229 now : number ,
@@ -3894,6 +3936,7 @@ async function statusSnapshot(env) {
38943936 ] ) . sort ( newestWorkflowRunFirst ) ;
38953937 const workerRuns = activeRuns . filter ( ( run ) => ! isSupportWorkflowRun ( run ) ) ;
38963938 const supportRuns = activeRuns . filter ( ( run ) => isSupportWorkflowRun ( run ) ) ;
3939+ const controlPlane = controlPlaneSnapshot ( activeRuns ) ;
38973940 const operationalHealth = summarizeOperationalHealth (
38983941 activeRunCandidates . filter ( ( run ) => ! isSupportWorkflowRun ( run ) ) ,
38993942 generatedAt ,
@@ -3903,7 +3946,7 @@ async function statusSnapshot(env) {
39033946 ( run ) =>
39043947 run . status === "completed" &&
39053948 ! isSupportWorkflowRun ( run ) &&
3906- codexJobName ( ` ${ run . name || "" } ${ run . display_title || "" } ` ) &&
3949+ isCodexWorkflowFallback ( run ) &&
39073950 TERMINAL_BAD_CONCLUSIONS . has ( String ( run . conclusion ) ) ,
39083951 ) ;
39093952 const activeJobs = await activeWorkerSnapshot ( env , repo , workerRuns , github ) ;
@@ -4004,6 +4047,7 @@ async function statusSnapshot(env) {
40044047 worker_detail_runs : activeJobs . detailRuns ,
40054048 worker_detail_fallbacks : activeJobs . fallbacks ,
40064049 } ,
4050+ control_plane : controlPlane ,
40074051 health : publicWorkerHealth ,
40084052 operational_health : operationalHealth ,
40094053 averages : {
@@ -4960,24 +5004,21 @@ async function activeWorkerSnapshot(
49605004 for ( const result of results ) {
49615005 if ( result . error ) {
49625006 errors . push ( `workflow jobs ${ result . run . id } : ${ result . error } ` ) ;
4963- if ( codexJobName ( ` ${ result . run . name || "" } ${ result . run . display_title || "" } ` ) ) {
5007+ if ( isCodexWorkflowFallback ( result . run ) ) {
49645008 workers . push ( normalizeFallbackWorker ( result . run ) ) ;
49655009 fallbacks += 1 ;
49665010 }
49675011 continue ;
49685012 }
49695013 if ( result . workers . length ) {
49705014 workers . push ( ...result . workers ) ;
4971- } else if (
4972- ! result . hasWorkerJobs &&
4973- codexJobName ( `${ result . run . name || "" } ${ result . run . display_title || "" } ` )
4974- ) {
5015+ } else if ( ! result . hasWorkerJobs && isCodexWorkflowFallback ( result . run ) ) {
49755016 workers . push ( normalizeFallbackWorker ( result . run ) ) ;
49765017 fallbacks += 1 ;
49775018 }
49785019 }
49795020 for ( const run of runs . slice ( detailRunLimit ) ) {
4980- if ( ! codexJobName ( ` ${ run . name || "" } ${ run . display_title || "" } ` ) ) continue ;
5021+ if ( ! isCodexWorkflowFallback ( run ) ) continue ;
49815022 workers . push ( normalizeFallbackWorker ( run ) ) ;
49825023 fallbacks += 1 ;
49835024 }
@@ -5019,9 +5060,7 @@ async function recentWorkerHealth(
50195060 const completedRuns = runs
50205061 . filter (
50215062 ( run ) =>
5022- run . status === "completed" &&
5023- ! isSupportWorkflowRun ( run ) &&
5024- codexJobName ( `${ run . name || "" } ${ run . display_title || "" } ` ) ,
5063+ run . status === "completed" && ! isSupportWorkflowRun ( run ) && isCodexWorkflowFallback ( run ) ,
50255064 )
50265065 . sort ( newestWorkflowRunFirst )
50275066 . slice ( 0 , RECENT_WORKER_HEALTH_RUN_LIMIT ) ;
@@ -7662,8 +7701,40 @@ function workflowRunSummary(run) {
76627701 } ;
76637702}
76647703
7665- function codexJobName ( name ) {
7666- return / r e v i e w | c o d e x | r e p a i r | w o r k e r | c o m m i t / i. test ( name ) ;
7704+ function isCodexWorkflowFallback ( run ) {
7705+ const name = `${ run ?. name || "" } ${ run ?. display_title || "" } ` ;
7706+ if (
7707+ / r e p a i r c o m m e n t r o u t e r | c l a w s w e e p e r _ c o m m e n t | @ p u b l i s h : | p u b l i s h e x a c t r e v i e w a r t i f a c t | e x a c t .r e v i e w p u b l i c a t i o n | r e c o n c i l e e x a c t .r e v i e w l e a s e | s y n c c o d e x r e v i e w c o m m e n t s / i. test (
7708+ name ,
7709+ )
7710+ ) {
7711+ return false ;
7712+ }
7713+ return / r e v i e w c l a w s w e e p e r i t e m s | r e v i e w h o t (?: c l a w s w e e p e r i t e m s | t a r g e t r e p o ) | r e v i e w t a r g e t r e p o | r e v i e w e v e n t i t e m s ? | r e t r y f a i l e d c o d e x r e v i e w s | c o m m i t r e v i e w | r e p a i r c l u s t e r | a u t o m e r g e r e p a i r | i s s u e i m p l e m e n t a t i o n | a s s i s t \b / i. test (
7714+ name ,
7715+ ) ;
7716+ }
7717+
7718+ function controlPlaneSnapshot ( runs ) {
7719+ const snapshot = {
7720+ publishers : { running : 0 , waiting : 0 } ,
7721+ comment_routers : { running : 0 , waiting : 0 } ,
7722+ reconcilers : { running : 0 , waiting : 0 } ,
7723+ } ;
7724+ for ( const run of runs ) {
7725+ const name = `${ run ?. name || "" } ${ run ?. display_title || "" } ` ;
7726+ const lane = / @ p u b l i s h : | p u b l i s h e x a c t r e v i e w a r t i f a c t | e x a c t .r e v i e w p u b l i c a t i o n / i. test ( name )
7727+ ? snapshot . publishers
7728+ : / r e p a i r c o m m e n t r o u t e r | c l a w s w e e p e r _ c o m m e n t | s y n c c o d e x r e v i e w c o m m e n t s / i. test ( name )
7729+ ? snapshot . comment_routers
7730+ : / r e c o n c i l e e x a c t .r e v i e w l e a s e / i. test ( name )
7731+ ? snapshot . reconcilers
7732+ : null ;
7733+ if ( ! lane ) continue ;
7734+ if ( run . status === "in_progress" ) lane . running += 1 ;
7735+ else lane . waiting += 1 ;
7736+ }
7737+ return snapshot ;
76677738}
76687739
76697740function laneRank ( mode ) {
@@ -9088,6 +9159,14 @@ h2::before { content: ""; flex: 0 0 auto; width: 14px; height: 2px; border-radiu
90889159 line-height: 1.4;
90899160}
90909161.capacity-rail { margin-top: 30px; }
9162+ .overview-section-title {
9163+ margin: 28px 0 0;
9164+ color: var(--muted);
9165+ font-size: 10px;
9166+ font-weight: 700;
9167+ letter-spacing: 0.11em;
9168+ text-transform: uppercase;
9169+ }
90919170.capacity-bar {
90929171 display: flex;
90939172 height: 10px;
@@ -9099,6 +9178,33 @@ h2::before { content: ""; flex: 0 0 auto; width: 14px; height: 2px; border-radiu
90999178.capacity-bar .active { background: var(--claw); }
91009179.capacity-bar .waiting { background: var(--amber); }
91019180.capacity-meta { margin-top: 8px; color: var(--muted); font-size: 12px; }
9181+ .capacity-note { margin-top: 5px; color: var(--muted); font-size: 11px; }
9182+ .exact-lanes {
9183+ display: grid;
9184+ grid-template-columns: repeat(2, minmax(0, 1fr));
9185+ gap: 12px;
9186+ margin-top: 10px;
9187+ }
9188+ .exact-lane,
9189+ .control-plane {
9190+ padding: 14px;
9191+ border: 1px solid var(--line);
9192+ border-radius: 10px;
9193+ background: var(--panel);
9194+ }
9195+ .exact-lane-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
9196+ .exact-lane-head strong { font-size: 13px; }
9197+ .exact-lane-head span { color: var(--muted); font-size: 11px; }
9198+ .lane-counts { display: grid; gap: 6px; margin-top: 12px; }
9199+ .lane-count { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }
9200+ .lane-count strong { color: var(--text); font-weight: 600; }
9201+ .lane-bar { height: 6px; margin-top: 12px; overflow: hidden; border-radius: 999px; background: var(--track); }
9202+ .lane-bar i { display: block; height: 100%; background: var(--claw); }
9203+ .lane-foot { margin-top: 7px; color: var(--muted); font-size: 11px; }
9204+ .control-plane { display: grid; gap: 8px; margin-top: 10px; }
9205+ .control-plane-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; font-size: 12px; }
9206+ .control-plane-row span:last-child { color: var(--muted); }
9207+ .control-plane-note { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.45; }
91029208.exact-handoff {
91039209 margin-top: 18px;
91049210 padding: 14px;
@@ -9714,6 +9820,7 @@ a.pill:hover { color: var(--claw); text-decoration: none; }
97149820 .worker-progress { display: none; }
97159821 .exact-handoff-head, .handoff-foot { align-items: start; flex-direction: column; }
97169822 .handoff-phases { grid-template-columns: 1fr; }
9823+ .exact-lanes { grid-template-columns: 1fr; }
97179824 dialog { margin: 7px; max-height: calc(100vh - 14px); }
97189825}
97199826</style>
@@ -9753,7 +9860,13 @@ a.pill:hover { color: var(--claw); text-decoration: none; }
97539860 <span class="muted" id="overview-note">Live control-plane telemetry</span>
97549861 </div>
97559862 <div class="flow-map" id="flow-map"></div>
9863+ <h3 class="overview-section-title">Codex Capacity</h3>
97569864 <div class="capacity-rail" id="capacity-rail"></div>
9865+ <h3 class="overview-section-title">Exact Review</h3>
9866+ <div class="exact-lanes" id="exact-review-lanes" aria-live="polite"></div>
9867+ <h3 class="overview-section-title">Control Plane · GitHub Actions, not Codex</h3>
9868+ <div class="control-plane" id="control-plane" aria-live="polite"></div>
9869+ <h3 class="overview-section-title">Handoff Health</h3>
97579870 <div id="exact-review-handoff" aria-live="polite"></div>
97589871 <div id="apply-health"></div>
97599872 <div class="automatic-head">
@@ -10167,25 +10280,65 @@ function renderSystemMap(data) {
1016710280 document.getElementById("flow-map").innerHTML = nodes.map(node =>
1016810281 '<div class="flow-node"><span>' + esc(node[0]) + '</span><strong>' + fmt.format(node[1]) + '</strong><p>' + esc(node[2]) + '</p></div>'
1016910282 ).join("");
10283+ const budget = Math.max(0, fleet.worker_budget || 0);
1017010284 const running = workers.filter(worker => worker.status === "in_progress").length;
1017110285 const waiting = workers.length - running;
10172- const budget = Math.max(0, fleet.worker_budget || 0);
1017310286 const free = Math.max(0, budget - running - waiting);
10287+ const overflow = Math.max(0, running + waiting - budget);
1017410288 const share = value => budget ? Math.min(100, (value / budget) * 100) : 0;
1017510289 document.getElementById("capacity-rail").innerHTML =
1017610290 '<div class="capacity-bar"><i class="active" style="width:' + share(running) + '%"></i><i class="waiting" style="width:' + share(waiting) + '%"></i></div>' +
10177- '<div class="capacity-meta">' + fmt.format(running) + ' running · ' + fmt.format(waiting) + ' waiting · ' + fmt.format(free) + ' of ' + fmt.format(budget) + ' slots free</div>';
10291+ '<div class="capacity-meta">' + fmt.format(running) + ' running · ' + fmt.format(waiting) + ' waiting · ' + fmt.format(free) + ' of ' + fmt.format(budget) + ' Codex slots free' + (overflow ? ' · ' + fmt.format(overflow) + ' over budget' : '') + '</div>' +
10292+ '<div class="capacity-note">Only jobs that execute Codex count against this budget.</div>';
1017810293 const fallbacks = fleet.worker_detail_fallbacks || 0;
1017910294 document.getElementById("overview-note").textContent = fallbacks
1018010295 ? "Live jobs with " + fallbacks + " workflow fallback" + (fallbacks === 1 ? "" : "s")
1018110296 : "Live GitHub job and step telemetry";
1018210297}
10298+ function renderExactReviewLanes(queue) {
10299+ const target = document.getElementById("exact-review-lanes");
10300+ if (!target) return;
10301+ const lanes = queue?.lanes;
10302+ if (!lanes?.review || !lanes?.publication) {
10303+ target.innerHTML = '<div class="empty">Exact-review lane telemetry unavailable.</div>';
10304+ return;
10305+ }
10306+ target.innerHTML = [["Review admission", lanes.review], ["Result publication", lanes.publication]].map(([label, lane]) => {
10307+ const capacity = Math.max(0, lane.capacity || 0);
10308+ const active = Math.max(0, lane.active || 0);
10309+ const used = capacity ? Math.min(100, (active / capacity) * 100) : 0;
10310+ const oldest = Number.isFinite(lane.oldest_pending_age_seconds)
10311+ ? " · oldest " + elapsed(lane.oldest_pending_age_seconds * 1000)
10312+ : "";
10313+ return '<div class="exact-lane"><div class="exact-lane-head"><strong>' + esc(label) + '</strong><span>' + fmt.format(active) + ' of ' + fmt.format(capacity) + ' active</span></div>' +
10314+ '<div class="lane-counts">' +
10315+ '<div class="lane-count"><span>Pending</span><strong>' + fmt.format(lane.pending || 0) + '</strong></div>' +
10316+ '<div class="lane-count"><span>Ready</span><strong>' + fmt.format(lane.ready || 0) + '</strong></div>' +
10317+ '<div class="lane-count"><span>Backoff</span><strong>' + fmt.format(lane.backoff || 0) + '</strong></div>' +
10318+ '<div class="lane-count"><span>Dispatching</span><strong>' + fmt.format(lane.dispatching || 0) + '</strong></div>' +
10319+ '<div class="lane-count"><span>Leased</span><strong>' + fmt.format(lane.leased || 0) + '</strong></div></div>' +
10320+ '<div class="lane-bar"><i style="width:' + used + '%"></i></div>' +
10321+ '<div class="lane-foot">' + fmt.format(lane.available_slots || 0) + ' ' + esc(label.toLowerCase()) + ' slots open' + esc(oldest) + '</div></div>';
10322+ }).join("");
10323+ }
10324+ function renderControlPlane(controlPlane, workerBudget) {
10325+ const target = document.getElementById("control-plane");
10326+ if (!target) return;
10327+ const rows = [
10328+ ["Exact publishers", controlPlane?.publishers],
10329+ ["Comment routers", controlPlane?.comment_routers],
10330+ ["Lease reconcilers", controlPlane?.reconcilers]
10331+ ];
10332+ target.innerHTML = rows.map(([label, lane]) =>
10333+ '<div class="control-plane-row"><span>' + esc(label) + '</span><span>' + fmt.format(lane?.running || 0) + ' running · ' + fmt.format(lane?.waiting || 0) + ' waiting</span></div>'
10334+ ).join("") + '<div class="control-plane-note">These workflows consume GitHub runners but not the ' + fmt.format(workerBudget || 0) + '-slot Codex budget.</div>';
10335+ }
1018310336function renderExactReviewHandoff(queue) {
1018410337 const target = document.getElementById("exact-review-handoff");
1018510338 if (!target) return;
1018610339 const health = queue?.handoff_health;
1018710340 if (!health?.phases) {
10188- target.innerHTML = '<div class="exact-handoff"><div class="exact-handoff-head"><div class="exact-handoff-title"><strong>Exact-review handoff</strong><span>Queue telemetry unavailable in this snapshot.</span></div><span class="health-badge">unknown</span></div></div>';
10341+ target.innerHTML = '<div class="exact-handoff"><div class="exact-handoff-head"><div class="exact-handoff-title"><strong>Queue handoff health </strong><span>Queue telemetry unavailable in this snapshot.</span></div><span class="health-badge">unknown</span></div></div>';
1018910342 return;
1019010343 }
1019110344 const status = ["idle", "healthy", "degraded", "stalled"].includes(health.status) ? health.status : "unknown";
@@ -10203,7 +10356,7 @@ function renderExactReviewHandoff(queue) {
1020310356 }).join("");
1020410357 const slots = fmt.format(health.available_slots || 0) + " of " + fmt.format(health.capacity || 0) + " exact-review slots open";
1020510358 const threshold = "stalled after " + elapsed((health.stalled_after_seconds || 0) * 1000);
10206- target.innerHTML = '<div class="exact-handoff"><div class="exact-handoff-head"><div class="exact-handoff-title"><strong>Exact-review handoff</strong><span>' + esc(health.message || "Queue phase telemetry") + '</span></div><span class="health-badge ' + esc(status) + '">' + esc(status) + '</span></div><div class="handoff-phases">' + phases + '</div><div class="handoff-foot"><span>' + esc(slots) + '</span><span>' + esc(threshold) + '</span></div></div>';
10359+ target.innerHTML = '<div class="exact-handoff"><div class="exact-handoff-head"><div class="exact-handoff-title"><strong>Queue handoff health </strong><span>' + esc(health.message || "Queue phase telemetry") + '</span></div><span class="health-badge ' + esc(status) + '">' + esc(status) + '</span></div><div class="handoff-phases">' + phases + '</div><div class="handoff-foot"><span>' + esc(slots) + '</span><span>' + esc(threshold) + '</span></div></div>';
1020710360}
1020810361function renderWorkers(rows) {
1020910362 workerIndex = new Map(rows.map(worker => [String(worker.id), worker]));
@@ -10417,15 +10570,17 @@ function renderDashboard(data, note) {
1041710570 const fleet = data.fleet;
1041810571 const operational = data.operational_health || {};
1041910572 document.getElementById("metrics").innerHTML = [
10420- metric("Claw Workers", fmt.format(fleet.active_codex_jobs), "budget " + fleet.worker_budget, fleet.budget_used_percent, "var(--green)"),
10573+ metric("Codex Workers", fmt.format(fleet.active_codex_jobs), "Codex budget " + fleet.worker_budget, fleet.budget_used_percent, "var(--green)"),
1042110574 metric("Active Sweeps", fmt.format(fleet.active_workflow_runs), fmt.format(operational.running_over_threshold || 0) + " over 150m", Math.min(100, fleet.active_workflow_runs * 3), operational.running_over_threshold ? "var(--red)" : "var(--claw)"),
1042210575 metric("Queue Depth", fmt.format(fleet.queued_workflow_runs), fmt.format(operational.queued_over_threshold || 0) + " over 30m", Math.min(100, fleet.queued_workflow_runs * 10), operational.queued_over_threshold ? "var(--amber)" : "var(--green)"),
1042310576 metric("Error Rate", (data.health?.error_rate_percent || 0) + "%", fmt.format(data.health?.failed_attempts || 0) + " failed / " + fmt.format(data.health?.attempts || 0) + " attempts", Math.min(100, data.health?.error_rate_percent || 0), data.health?.failed_attempts ? "var(--red)" : "var(--green)"),
1042410577 metric("Recovery Rate", data.health?.recovery_rate_percent == null ? "n/a" : data.health.recovery_rate_percent + "%", fmt.format(data.health?.unresolved_failures || 0) + " unresolved", data.health?.recovery_rate_percent == null ? 100 : data.health.recovery_rate_percent, data.health?.unresolved_failures ? "var(--amber)" : "var(--green)"),
10425- metric("Capacity", fleet.budget_used_percent + "%", "fleet utilization", fleet.budget_used_percent, "var(--green)")
10578+ metric("Codex Capacity", fleet.budget_used_percent + "%", "Codex slot utilization", fleet.budget_used_percent, "var(--green)")
1042610579 ].join("");
1042710580 renderHealthHistory(data.operational_health);
1042810581 renderSystemMap(data);
10582+ renderExactReviewLanes(data.exact_review_queue);
10583+ renderControlPlane(data.control_plane, fleet.worker_budget);
1042910584 renderExactReviewHandoff(data.exact_review_queue);
1043010585 renderApplyHealth(data);
1043110586 renderAutomaticWork(data.automatic_work || []);
0 commit comments