From cf5ae555727df74ff00ecbd4d063f9e56744fa11 Mon Sep 17 00:00:00 2001 From: DavertMik Date: Fri, 17 Jul 2026 01:03:53 +0300 Subject: [PATCH] fix: drop the >80%-broken-locators full re-research retry Researching a page could take twice as long as needed: when more than 80% of parsed locators failed validation, research() discarded the finished report and recursively re-ran the whole generation. A single imprecise container selector marks every child locator broken without testing it (the cascade in research()), so the ratio crossed 0.8 easily. In trace d9fd5d5a14aba27bc86cf925f57dc8a1 this turned one page into 67s: 28s report, 3s gate, 21s regenerated report, 13s fix. The regenerated report only corrected two container selectors -- which is exactly what fixBrokenSections already does, and it ran anyway. Broken locators now fall through to fixBrokenSections. The catastrophe guards (nothing parsed, every container broken) still retry. Co-Authored-By: Claude Opus 4.8 --- CHANGELOG.md | 1 + src/ai/researcher.ts | 8 -------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a8b3d7..bea21db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 2026-07-17 ### Changes +- Research is significantly faster on pages where the AI picks an imprecise container selector. Previously, if more than 80% of the researched locators failed validation, Explorbot threw away the finished UI map and regenerated it from scratch — roughly doubling the time spent on the page. Because a single bad container marks all of its child elements broken, this triggered easily, and the re-research usually just corrected the container anyway. Broken locators now go straight to the repair step that fixes them in place, cutting research on affected pages by about a third. - Fixed startup failing with `AI connection failed: Invalid 'max_output_tokens'` on models that reject a one-token response. The check that verifies your AI credentials at startup no longer caps the reply length, so it works with every provider regardless of their minimum. ## 2026-07-10 diff --git a/src/ai/researcher.ts b/src/ai/researcher.ts index 9236241..98239a2 100644 --- a/src/ai/researcher.ts +++ b/src/ai/researcher.ts @@ -226,14 +226,6 @@ export class Researcher extends ResearcherBase implements Agent { const toTest = result.locators.filter((l) => l.valid === null); await this.testLocators(toTest); - - const brokenCount = result.locators.filter((l) => l.valid === false).length; - const brokenRatio = result.locators.length > 0 ? brokenCount / result.locators.length : 0; - if (brokenRatio > 0.8 && retriesLeft > 0) { - tag('warning').log(`${Math.round(brokenRatio * 100)}% locators broken, waiting 3s and retrying research (${maxRetries - retriesLeft + 1}/${maxRetries})...`); - await new Promise((r) => setTimeout(r, 3000)); - return this.research(state, { ...opts, force: true, _retriesLeft: retriesLeft - 1 } as any); - } } // Stage 3: Fix broken sections via AI conversation continuation