fix: 保证 Web observer 有界收尾

复用 stop-once 生命周期覆盖成功、失败、部分启动与异常兜底路径。\n\n将 YAML 派生的 maxRun/maxSamples 投影到 manifest 和 heartbeat,并补齐聚焦回归测试。
This commit is contained in:
Codex
2026-07-12 12:59:30 +02:00
parent 3056a2b343
commit 95bf0b7de6
4 changed files with 229 additions and 10 deletions
@@ -57,7 +57,17 @@ async function writeManifest(extra = {}) {
navigation: { maxAttempts: navigationMaxAttempts, valuesRedacted: true },
pageAuthority: { browser: "chromium", context: "shared-auth", pageMode: "dual-control-observer", controlPageId: pageId, observerPageId, continuityBreaksRecorded: true },
pageProvenance: compactPageProvenance(currentPageProvenance),
sampling: { mode: "passive", sampleIntervalMs, screenshotIntervalMs, maxSamples, observerRefreshIntervalMs, observerInitiatedDefault: false, responseBodyReadDefault: false },
sampling: {
mode: "passive",
sampleIntervalMs,
screenshotIntervalMs,
maxSamples,
maxRunMs,
maxRunSeconds: maxRunMs > 0 ? Math.ceil(maxRunMs / 1000) : 0,
observerRefreshIntervalMs,
observerInitiatedDefault: false,
responseBodyReadDefault: false,
},
alertThresholds,
browserFreezePolicy,
projectManagement,
@@ -84,6 +94,12 @@ async function writeHeartbeat(extra = {}) {
currentUrl: currentPageUrl(),
observerUrl: pageUrl(observerPage),
observerRefreshIntervalMs,
observerLifecycle: {
maxSamples,
maxRunMs,
maxRunSeconds: maxRunMs > 0 ? Math.ceil(maxRunMs / 1000) : 0,
valuesRedacted: true,
},
lastObserverRefreshAt: Number.isFinite(lastObserverRefreshAtMs) ? new Date(lastObserverRefreshAtMs).toISOString() : null,
pageProvenance: compactPageProvenance(currentPageProvenance),
sampleSeq,