fix: correct web probe browser memory policy

This commit is contained in:
Codex
2026-06-30 13:05:24 +00:00
parent 37731f811c
commit edb3ad2d17
5 changed files with 189 additions and 52 deletions
@@ -3248,6 +3248,11 @@ function buildBrowserProcessReport(rows) {
cdpErrorCount: browserMetricNumber(cdp.errorCount),
heapUsedMb: page?.heapUsage ? bytesToMb(page.heapUsage.usedSize) : null,
heapTotalMb: page?.heapUsage ? bytesToMb(page.heapUsage.totalSize) : null,
effectiveHeapUsedMb: page?.effectiveMemory ? browserMetricNumber(page.effectiveMemory.effectiveHeapUsedMb) : null,
effectiveJsHeapUsedMb: page?.effectiveMemory ? browserMetricNumber(page.effectiveMemory.effectiveJsHeapUsedMb) : null,
heapUsedGrowthMb: page?.effectiveMemory ? browserMetricNumber(page.effectiveMemory.heapUsedGrowthMb) : null,
jsHeapUsedGrowthMb: page?.effectiveMemory ? browserMetricNumber(page.effectiveMemory.jsHeapUsedGrowthMb) : null,
baselineCapturedAt: page?.baseline?.capturedAt ?? null,
domNodes: page?.domCounters ? browserMetricNumber(page.domCounters.nodes) : null,
valuesRedacted: true,
};
@@ -3290,6 +3295,7 @@ function buildBrowserProcessReport(rows) {
growthRedMb: alertThresholds.browserRssGrowthRedMb,
growthWindowMs: alertThresholds.browserRssGrowthWindowMs,
responsivenessRedMs: alertThresholds.playwrightResponsivenessRedMs,
memoryRedPolicyScope: "per-page-effective-memory",
freezeBlockerCount: blockerEvents.length,
browserFreezePolicy,
valuesRedacted: true,
@@ -3334,6 +3340,10 @@ function compactBrowserFreezeBlockerEvent(item) {
processRssMb: numberOrNull(observed.processRssMb),
totalGrowthMb: numberOrNull(observed.totalGrowthMb),
processGrowthMb: numberOrNull(observed.processGrowthMb),
effectiveHeapUsedMb: numberOrNull(observed.effectiveHeapUsedMb),
effectiveJsHeapUsedMb: numberOrNull(observed.effectiveJsHeapUsedMb),
heapGrowthMb: numberOrNull(observed.heapGrowthMb),
jsHeapGrowthMb: numberOrNull(observed.jsHeapGrowthMb),
responsivenessLatencyMs: numberOrNull(observed.responsivenessLatencyMs),
responsivenessTimeout: observed.responsivenessTimeout === true,
cdpMetricsTimeoutCount: numberOrNull(observed.cdpMetricsTimeoutCount),
@@ -3370,6 +3380,11 @@ function compactBrowserFreezeBlockerEvent(item) {
responsivenessTimeout: page.responsivenessTimeout === true,
cdpTimeoutCount: numberOrNull(page.cdpTimeoutCount),
cdpErrorCount: numberOrNull(page.cdpErrorCount),
effectiveHeapUsedMb: numberOrNull(page.effectiveHeapUsedMb),
effectiveJsHeapUsedMb: numberOrNull(page.effectiveJsHeapUsedMb),
heapUsedGrowthMb: numberOrNull(page.heapUsedGrowthMb),
jsHeapUsedGrowthMb: numberOrNull(page.jsHeapUsedGrowthMb),
baselineCapturedAt: page.baselineCapturedAt ?? null,
valuesRedacted: true,
},
browserKill: {
@@ -3415,42 +3430,44 @@ function buildBrowserProcessFindings(report, runtimeAlerts = null) {
}
if (!summary || Number(summary.sampleCount ?? 0) <= 0) return findings;
const rootCauseSignals = browserRootCauseSignals(report, runtimeAlerts);
const maxTotalRssMb = Number(summary.maxTotalRssMb ?? 0);
const maxProcessRssMb = Number(summary.maxProcessRssMb ?? 0);
if (maxTotalRssMb >= alertThresholds.browserTotalRssRedMb || maxProcessRssMb >= alertThresholds.browserProcessRssRedMb) {
const pageEvents = Array.isArray(report.latestPageEvents) ? report.latestPageEvents : [];
const maxEffectiveHeapEvent = maxByNumber(pageEvents, (item) => Math.max(Number(item.effectiveHeapUsedMb ?? 0), Number(item.effectiveJsHeapUsedMb ?? 0)));
const maxEffectiveHeapMb = maxEffectiveHeapEvent ? Math.max(Number(maxEffectiveHeapEvent.effectiveHeapUsedMb ?? 0), Number(maxEffectiveHeapEvent.effectiveJsHeapUsedMb ?? 0)) : 0;
if (maxEffectiveHeapMb >= alertThresholds.browserProcessRssRedMb) {
findings.push({
id: "frontend-browser-memory-rss-red",
severity: "red",
summary: "Chromium RSS exceeded YAML red threshold during observation; browser memory growth is freeze evidence and must not be hidden by page refresh/fallback",
maxTotalRssMb,
maxProcessRssMb,
totalRssRedMb: alertThresholds.browserTotalRssRedMb,
summary: "Page effective memory exceeded YAML red threshold after subtracting page baseline; process RSS remains diagnostic evidence only",
maxEffectiveHeapMb,
processRssRedMb: alertThresholds.browserProcessRssRedMb,
memoryRedPolicyScope: "per-page-effective-memory",
maxEffectiveHeapEvent,
maxTotalRssSample: report.maxTotalRssSample,
maxProcessRssSample: report.maxProcessRssSample,
rootCause: "frontend_browser_process_memory_pressure",
rootCauseStatus: "confirmed-from-runner-process-rss",
rootCause: "frontend_browser_page_effective_memory_pressure",
rootCauseStatus: "confirmed-from-runner-page-effective-memory",
rootCauseConfidence: "high",
rootCauseSignals,
fallbackAllowed: false,
valuesRedacted: true,
});
}
const maxTotalRssGrowthMb = Number(summary.maxTotalRssGrowthMb ?? 0);
const maxProcessRssGrowthMb = Number(summary.maxProcessRssGrowthMb ?? 0);
if (maxTotalRssGrowthMb >= alertThresholds.browserRssGrowthRedMb || maxProcessRssGrowthMb >= alertThresholds.browserRssGrowthRedMb) {
const maxEffectiveGrowthEvent = maxByNumber(pageEvents, (item) => Math.max(Number(item.heapUsedGrowthMb ?? 0), Number(item.jsHeapUsedGrowthMb ?? 0)));
const maxEffectiveGrowthMb = maxEffectiveGrowthEvent ? Math.max(Number(maxEffectiveGrowthEvent.heapUsedGrowthMb ?? 0), Number(maxEffectiveGrowthEvent.jsHeapUsedGrowthMb ?? 0)) : 0;
if (maxEffectiveGrowthMb >= alertThresholds.browserRssGrowthRedMb) {
findings.push({
id: "frontend-browser-memory-growth-red",
severity: "red",
summary: "Chromium RSS grew beyond YAML window budget; this matches the reported freeze pattern of browser memory rapidly climbing",
maxTotalRssGrowthMb,
maxProcessRssGrowthMb,
summary: "Page effective memory grew beyond YAML window budget; this matches the reported freeze pattern without counting multi-page startup RSS",
maxEffectiveGrowthMb,
growthRedMb: alertThresholds.browserRssGrowthRedMb,
windowMs: alertThresholds.browserRssGrowthWindowMs,
memoryRedPolicyScope: "per-page-effective-memory",
maxEffectiveGrowthEvent,
maxGrowthSample: report.maxGrowthSample,
maxProcessGrowthSample: report.maxProcessGrowthSample,
rootCause: "frontend_browser_process_memory_leak_or_unbounded_render_growth",
rootCauseStatus: "confirmed-from-runner-process-rss-growth",
rootCause: "frontend_browser_page_memory_leak_or_unbounded_render_growth",
rootCauseStatus: "confirmed-from-runner-page-effective-memory-growth",
rootCauseConfidence: "high",
rootCauseSignals,
fallbackAllowed: false,