Skip to content

Commit efbe0ac

Browse files
committed
fix(bay): label reset-header observations accurately
1 parent 2fc9dcf commit efbe0ac

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

‎dashboard/bay-page.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,8 @@ dialog{border:0;padding:0;margin:0 0 0 auto;width:min(580px,94vw);height:100vh;m
404404
series.forEach(function(point){totals["403"]+=point["403"];totals["429"]+=point["429"];Object.keys(point.pools||{}).forEach(function(pool){pools[pool]=(pools[pool]||0)+point.pools[pool];});});
405405
var total=totals["403"]+totals["429"],peak=series.reduce(function(high,point){return Math.max(high,point.total||0);},0),poolCopy=Object.keys(pools).sort().map(function(pool){return bayThrottlePoolLabel(pool)+" "+pools[pool];}).join(" · "),rawHeaders=Array.isArray(payload.rate_limit_observations)?payload.rate_limit_observations:null,aggregateRates=payload.rate_limits&&typeof payload.rate_limits==="object"?payload.rate_limits:null,headerSummary="";
406406
if(bayEgressHours()<=24&&payload.completeness&&payload.completeness.rate_limit_rows_truncated===false&&payload.completeness.rate_limit_window_complete===true){
407-
if(rawHeaders){var authoritative=rawHeaders.filter(function(row){return row&&row.telemetry_complete===true&&["retry_after","rate_limit_reset"].indexOf(row.reset_authority_candidate)>=0;}).length;headerSummary=rawHeaders.length?" · "+authoritative+"/"+rawHeaders.length+" throttle observations carried authoritative reset headers":" · no reset-header observations";}
408-
else if(aggregateRates){var authorities=aggregateRates.by_reset_authority||{},rateTotal=Math.max(0,Number(aggregateRates.total)||0),authoritativeTotal=Math.max(0,Number(authorities.retry_after)||0)+Math.max(0,Number(authorities.rate_limit_reset)||0);headerSummary=rateTotal?" · "+authoritativeTotal+"/"+rateTotal+" throttle observations carried authoritative reset headers":" · no reset-header observations";}
407+
if(rawHeaders){var authoritative=rawHeaders.filter(function(row){return row&&row.telemetry_complete===true&&["retry_after","rate_limit_reset"].indexOf(row.reset_authority_candidate)>=0;}).length;headerSummary=rawHeaders.length?" · "+authoritative+"/"+rawHeaders.length+" 403/429 observations carried authoritative reset headers":" · no retained 403/429 observations";}
408+
else if(aggregateRates){var authorities=aggregateRates.by_reset_authority||{},rateTotal=Math.max(0,Number(aggregateRates.total)||0),authoritativeTotal=Math.max(0,Number(authorities.retry_after)||0)+Math.max(0,Number(authorities.rate_limit_reset)||0);headerSummary=rateTotal?" · "+authoritativeTotal+"/"+rateTotal+" 403/429 observations carried authoritative reset headers":" · no retained 403/429 observations";}
409409
}else if(bayEgressHours()>24)headerSummary=" · reset-header detail retained "+Math.max(0,Number(payload.retention&&payload.retention.rate_limit_detail_hours)||24)+"h";
410410
var boundary=compact&&compact.first_available_bucket_start&&!compact.coverage_complete?" · available from "+bayFormatTime(compact.first_available_bucket_start):"",excluded=Math.max(0,Number(compact&&compact.excluded_incomplete_count)||0),excludedCopy=excluded?" · "+excluded+" incomplete egress observation"+(excluded===1?"":"s")+" excluded":"",title="Actual GitHub wire responses classified as 403 or 429. This excludes circuit deferrals and avoided requests. Only closed time buckets are graphed; incomplete egress evidence never implies a zero-throttle interval.",status=(complete?"":"Incomplete / truncated evidence · ")+total+" observed wire throttle"+(total===1?"":"s")+" · 403 "+totals["403"]+" · 429 "+totals["429"]+" · peak "+peak+" / bucket"+bayThrottleHourlyCopy(series,payload,complete)+boundary+excludedCopy;
411411
return '<section class="bay-control-card" title="'+esc(title)+'"><h2>GitHub throttles</h2>'+bayThrottleChart(payload,series)+'<div class="bay-control-rate '+(complete?"":"collecting")+'">'+esc(status)+'</div><p class="bay-throttle-summary">'+esc((poolCopy||"No attributable closed-pool observations")+headerSummary)+'</p></section>';

‎docs/proof/openclaw-bay/run-proof.mjs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,7 @@ try {
960960
);
961961

962962
const initialCopy = await throttleCard.innerText();
963+
// oxfmt-ignore
963964
assertProof(
964965
"six-hour chart reports interval totals, peak, pool split, and header authority",
965966
/10 observed wire throttles/i.test(initialCopy) &&
@@ -969,7 +970,7 @@ try {
969970
/Actions 5/i.test(initialCopy) &&
970971
/target App 3/i.test(initialCopy) &&
971972
/public fallback 2/i.test(initialCopy) &&
972-
/1\/2 throttle observations carried authoritative reset headers/i.test(initialCopy),
973+
/1\/2 .* authoritative reset headers/i.test(initialCopy),
973974
{ range: "6h", text: initialCopy },
974975
);
975976
const firstThrottleTooltip =
@@ -1013,10 +1014,11 @@ try {
10131014
range,
10141015
);
10151016
const copy = await throttleCard.innerText();
1017+
// oxfmt-ignore
10161018
assertProof(
10171019
`${range} selector renders matching closed throttle buckets`,
10181020
/closed 60m buckets/i.test(copy) &&
1019-
(range === "7d" ? /reset-header detail retained 24h/i.test(copy) : /1\/2 throttle observations carried authoritative reset headers/i.test(copy)),
1021+
(range === "7d" ? /reset-header detail retained 24h/i.test(copy) : /1\/2 .* authoritative reset headers/i.test(copy)),
10201022
{ range, hours, text: copy },
10211023
);
10221024
await capture(

0 commit comments

Comments
 (0)