fix(research): prevent premature completion + security guardrails - #5
Merged
Conversation
…onfirmation Previous fix (45s guard + 10s confirm = 55s) matched the exact truncation point. Perplexity pauses 15-60s between research sections, so the 10s confirm passed during a pause. Now: 120s DOM guard, 30s growth-polling window (5s intervals), 3000 char minimum, stop button detection, and expanded streaming selectors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…bility thresholds Layer 3 (text stability) was triggering at 47-66s during Perplexity's "thinking" pauses between research sections. Root cause: stability had no minimum elapsed time guard, so 50s of stable text at 3000+ chars would declare completion while Perplexity was still processing. Changes: - BROWSER_STABLE_MS_RESEARCH: 50s → 120s (match DOM guard minimum) - BROWSER_STABLE_MS_LABS: 60s → 150s - Layer 3 now requires dom_min_elapsed before trusting stability - Earliest possible completion is now 120s (research) / 180s (labs) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
page.fill() and native value setters clobber React's internal state, deactivating /research or /council mode after activation. Replaced with keyboard.type() which dispatches real keystrokes through React's event pipeline, preserving the slash command mode flag. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… for modes Native setter is faster for plain queries. keyboard.type() only used when a slash command mode (research/labs/council) is active, since native setter and page.fill() clobber React's mode flag. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…re query The slash command mode (/research, /council, /labs) is activated and confirmed before submit_query runs. The native setter (fast paste) is safe because it only sets query text in an already-activated input. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…holds Vision path (_wait_vision_research) had zero min-elapsed guard — Haiku reported "complete" at ~51s and the 2x-consecutive check accepted it immediately, bypassing CSS fallback guards entirely. Fix: apply dom_min_elapsed guard to vision path (resets consecutive_complete counter if elapsed < threshold). Double all stability thresholds (2x) to prevent recurrence: DOM guard 240s/360s, stability 240s/300s. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan
council_config.pyandcouncil_browser.py🤖 Generated with Claude Code