From abf547bb2eecfcae875bef9715302549bbe32dd3 Mon Sep 17 00:00:00 2001 From: Codex Date: Sat, 27 Jun 2026 09:19:57 +0000 Subject: [PATCH] fix: widen observe navigation retry budget --- scripts/src/hwlab-node-web-observe-runner-source.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/src/hwlab-node-web-observe-runner-source.ts b/scripts/src/hwlab-node-web-observe-runner-source.ts index 8a421ba2..96aed6f0 100644 --- a/scripts/src/hwlab-node-web-observe-runner-source.ts +++ b/scripts/src/hwlab-node-web-observe-runner-source.ts @@ -29,6 +29,7 @@ const authLoginMaxAttempts = boundedInteger(process.env.UNIDESK_WEB_OBSERVE_AUTH const authLoginRequestTimeoutMs = boundedInteger(process.env.UNIDESK_WEB_OBSERVE_AUTH_LOGIN_REQUEST_TIMEOUT_MS, 30000, 1000, 120000); const authLoginInitialDelayMs = boundedInteger(process.env.UNIDESK_WEB_OBSERVE_AUTH_LOGIN_INITIAL_DELAY_MS, 500, 0, 60000); const authLoginMaxDelayMs = boundedInteger(process.env.UNIDESK_WEB_OBSERVE_AUTH_LOGIN_MAX_DELAY_MS, 10000, 0, 120000); +const navigationMaxAttempts = boundedInteger(process.env.UNIDESK_WEB_OBSERVE_NAVIGATION_MAX_ATTEMPTS, 4, 1, 10); const alertThresholds = parseAlertThresholds(process.env.UNIDESK_WEB_OBSERVE_ALERT_THRESHOLDS_JSON); const projectManagement = parseProjectManagementConfig(process.env.UNIDESK_WEB_OBSERVE_PROJECT_MANAGEMENT_JSON); const playwrightProxy = proxyConfigFromEnv(baseUrl); @@ -179,6 +180,7 @@ async function writeManifest(extra = {}) { baseUrl, targetPath, network: publicNetwork(playwrightProxy), + 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 }, @@ -1035,7 +1037,7 @@ async function gotoTarget(rawTarget) { const target = new URL(String(rawTarget || targetPath), baseUrl).toString(); const beforeUrl = currentPageUrl(); const attempts = []; - for (let attempt = 1; attempt <= 2; attempt += 1) { + for (let attempt = 1; attempt <= navigationMaxAttempts; attempt += 1) { try { const response = await page.goto(target, { waitUntil: "domcontentloaded", timeout: 45000 }); await page.waitForTimeout(1000).catch(() => {}); @@ -1060,7 +1062,7 @@ async function gotoTarget(rawTarget) { return { beforeUrl, afterUrl: currentPageUrl(), httpStatus: null, pageId, pageProvenance: compactPageProvenance(pageProvenance), readiness: lateReadiness, attempts }; } } - if (attempt >= 2 || !isRetryableNavigationError(message)) { + if (attempt >= navigationMaxAttempts || !isRetryableNavigationError(message)) { throw Object.assign(new Error(message), { attempts, target }); } if (!observerPage) {