Perplexity research queue + always-on browser-bridge keeper + reliability fixes#53
Merged
Merged
Conversation
…eeper + reliability fixes Adds infrastructure so concurrent Claude sessions serialize Perplexity runs and the browser-bridge Chrome stays alive for remote automation, plus two failure-taxonomy fixes verified against a 3-day log audit. Queue (research_queue.py + council_browser.run wiring): - Global FIFO via atomic ticket files (ordering/visibility) + single active.lock (correctness) so up to N sessions serialize on the shared keeper Chrome instead of colliding (BROWSER_BUSY / keystroke races). - Kill-switch RESEARCH_QUEUE_ENABLED=0; RESEARCH_QUEUE_MAX_WAIT timeout. - Central log council-logs/perplexity-activity.jsonl + queue snapshot. Monitoring (queue_monitor.py + research_queue_status server tool): - Polling sidecar: pure evaluate() alert fn (stalled active, deep queue, long run, error/timeout) + Pushover + rate-limited keeper self-heal. - New stalled-near-empty detector: completed runs with elapsed_wall_s>300 AND extracted_synthesis_chars<300 alert as stalled:empty:<id>, driving a keeper cookie-refresh (the root correlate). Browser-bridge keeper (browser_bridge_keeper.py + installer): - One-shot process-liveness keeper for the default-profile Chrome that hosts the bridge extension; Task Scheduler AtLogOn + 5-min watchdog. - --stop clears keeper PID state only; never force-closes the user's Chrome. Two-client fix (websocket-bridge.js + extension hello): - Single-target election (keeper-first via hello role) so mutation commands execute once, not on every connected browser client. Validator fix (council_browser._validate_result): - Gate rule (d) peak-regression to len<SUBSTANTIAL_SYNTHESIS_CHARS(2500) so complete large structured answers stop false-flagging as truncated; structural rules (unclosed fence / dangling token) stay unconditional. Tests: research_queue, queue_monitor(+stall), validate_result, wiring, stopgap serialization, submission_lock scope, target-selection. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XpuwG5kvGqBwZtCKTSdAK6
intellegix
force-pushed
the
feature/perplexity-research-queue
branch
from
July 14, 2026 14:56
19ec4e0 to
45a56a1
Compare
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.
Bundles the browser-bridge + Perplexity-automation infrastructure built over the last few sessions. All changes are additive and backward-compatible.
What's included
Perplexity research FIFO queue (earlier commits)
research_queue.py) so concurrent/research-perplexityruns serialize instead of colliding on the shared keeper Chrome, with a central activity log + live snapshot and aqueue_monitor.pysidecar. Kill-switchRESEARCH_QUEUE_ENABLED=0.Always-on browser-bridge keeper (this session)
browser_bridge_keeper.py+install_bridge_keeper_task.ps1: a Task Scheduler watchdog (AtLogOn + 5 min) that keeps the Chrome hosting the bridge extension running, so the browser-bridge MCP is always connectable for remote sessions.install_keeper_task.ps1: installer for the existingsession_keeper.py.Single-target command routing
lib/websocket-bridge.js: route each command to a single elected browser client (keeper-first via ahellorole message) instead of broadcasting to every connected extension — prevents mutation commands (navigate/click/switch_tab) double-executing when two Chromes both have the extension.extension/background.jsemits the hello.Reliability fixes (empirically driven, Perplexity-verified)
council_browser._validate_result: gate the peak-regression truncation heuristic to non-substantial outputs, so complete 6–13K-char structured answers are no longer false-flagged assuspect_truncated(this was ~24–29% of flags). Structural checks (unclosed fence / dangling token) stay unconditional.queue_monitor.py: detect stalled-near-empty runs (>300s wall-clock, <300 chars) and trigger a keeper cookie-refresh via the self-heal path.Tests
test_validate_result.py(7),test_queue_monitor_stall.py(11),test-target-selection.js(8).node --checkclean).Notes
phase5_query.txtis a stray leftover prompt from an earlier resync — harmless but could be pruned.🤖 Generated with Claude Code