fix: compact web observe analyze and extend runner timeout

This commit is contained in:
Codex
2026-06-21 18:25:29 +00:00
parent 614df759c0
commit b0c99bcc52
3 changed files with 59 additions and 11 deletions
+33 -3
View File
@@ -7319,7 +7319,12 @@ function runNodeWebProbeObserveAnalyze(options: NodeWebProbeObserveOptions, spec
"set -eu",
nodeWebObserveResolveStateDirShell(options),
"analyzer=\"$state_dir/observer-analyzer.mjs\"",
`node -e "require('fs').writeFileSync(process.argv[1], Buffer.from(process.argv[2], 'base64'))" "$analyzer" ${shellQuote(analyzerB64)}`,
"analyzer_b64=\"$state_dir/observer-analyzer.mjs.b64\"",
"cat >\"$analyzer_b64\" <<'UNIDESK_WEB_OBSERVE_ANALYZER_B64'",
analyzerB64,
"UNIDESK_WEB_OBSERVE_ANALYZER_B64",
"node -e \"const fs=require('fs'); fs.writeFileSync(process.argv[1], Buffer.from(fs.readFileSync(process.argv[2], 'utf8').replace(/\\s+/g, ''), 'base64'))\" \"$analyzer\" \"$analyzer_b64\"",
"rm -f \"$analyzer_b64\"",
"chmod 700 \"$analyzer\"",
"UNIDESK_WEB_OBSERVE_STATE_DIR=\"$state_dir\" node \"$analyzer\"",
].join("\n");
@@ -7356,6 +7361,10 @@ function renderWebObserveAnalyzeTable(value: Record<string, unknown>): string {
const runtimeAlerts = record(analysis?.runtimeAlerts);
const pagePerformance = record(analysis?.pagePerformance);
const promptNetwork = record(analysis?.promptNetwork);
const rounds = webObserveArray(sampleMetrics?.roundItems ?? sampleMetrics?.rounds).map(record).filter((item): item is Record<string, unknown> => item !== null).slice(-8);
const turnColumns = webObserveArray(sampleMetrics?.turnColumns).map(record).filter((item): item is Record<string, unknown> => item !== null).slice(-12);
const roundCount = Array.isArray(sampleMetrics?.rounds) ? sampleMetrics.rounds.length : sampleMetrics?.rounds;
const turnColumnCount = Array.isArray(sampleMetrics?.turnColumns) ? sampleMetrics.turnColumns.length : sampleMetrics?.turnColumns;
const slowApis = Array.isArray(analysis?.pagePerformanceSlowApi) ? analysis.pagePerformanceSlowApi.map(record).filter((item): item is Record<string, unknown> => item !== null).slice(0, 8) : [];
const findings = Array.isArray(analysis?.findings) ? analysis.findings.map(record).filter((item): item is Record<string, unknown> => item !== null).slice(0, 8) : [];
const domDiagnostics = Array.isArray(analysis?.domDiagnosticGroups) ? analysis.domDiagnosticGroups.map(record).filter((item): item is Record<string, unknown> => item !== null).slice(0, 5) : [];
@@ -7391,8 +7400,8 @@ function renderWebObserveAnalyzeTable(value: Record<string, unknown>): string {
"",
"Turn timing:",
webObserveTable(["ROUNDS", "TURNS", "ROWS", "NON_MONO", "ELAPSED_DEC", "RECENT_JUMP", "MAX_RECENT_STEP"], [[
webObserveText(sampleMetrics?.rounds),
webObserveText(sampleMetrics?.turnColumns),
webObserveText(roundCount),
webObserveText(turnColumnCount),
webObserveText(sampleMetrics?.turnTimingRows),
webObserveText(sampleMetrics?.turnTimingNonMonotonicCount),
webObserveText(sampleMetrics?.turnTimingTotalElapsedDecreaseCount),
@@ -7400,6 +7409,27 @@ function renderWebObserveAnalyzeTable(value: Record<string, unknown>): string {
webObserveText(sampleMetrics?.turnTimingRecentUpdateMaxIncreaseSeconds),
]]),
"",
"Rounds:",
webObserveTable(["ROUND", "SAMPLES", "TOTAL_LAST", "RECENT_LAST", "DIAG", "TERMINAL", "PROMPT_HASH"], rounds.length > 0 ? rounds.map((item) => [
webObserveText(item.promptIndex),
webObserveText(item.sampleCount),
webObserveText(item.lastTotalElapsedSeconds),
webObserveText(item.lastRecentUpdateSeconds),
webObserveText(item.diagnosticSamples),
webObserveText(item.terminalSamples),
webObserveShort(webObserveText(item.promptTextHash), 24),
]) : [["-", "-", "-", "-", "-", "-", "-"]]),
"",
"Turn columns:",
webObserveTable(["TURN", "PROMPT", "TRACE", "FIRST_SEQ", "LAST_SEQ", "SOURCE"], turnColumns.length > 0 ? turnColumns.map((item) => [
webObserveText(item.label),
webObserveText(item.promptIndex ?? item.lastPromptIndex),
webObserveShort(webObserveText(item.traceId), 28),
webObserveText(item.firstSeq),
webObserveText(item.lastSeq),
webObserveShort(webObserveText(item.source), 24),
]) : [["-", "-", "-", "-", "-", "-"]]),
"",
"Runtime alerts:",
webObserveTable(["HTTP_ERR", "REQUEST_FAILED", "DOM_DIAG", "CONSOLE_ALERT", "PROMPT_SEGMENTS", "PROMPT_NETWORK"], [[
webObserveText(runtimeAlerts?.httpErrorCount),