An agentic browser harness: an AI side panel & orb in your own logged-in Chrome, Edge, Arc, Brave or even Firefox run by the agent/subscription you already use (Claude Code, Codex, Antigravity). Free, open source, no API key. Also an MCP server.
TypeScript agentic-browseragentic-browsingagy-cliaiai-agentai-browser-extensionai-toolsbrave-extensionbrowser-agentbrowser-automationbrowser-extensionbrowser-usebrowserskillchrome-extensionclaude-codecodexfirefox-addonmcp-servernanobrowserweb-automation
fix(extension): forget the reconnect backoff only once a link has held for 30 seconds, because resetting it on every welcome let two browsers take the link from each other each second
Shahriarc07fcceeaeb9
diff --git a/src/lib/bridge/socket.ts b/src/lib/bridge/socket.tsindex 4f86e83..7bbb04c 100644--- a/src/lib/bridge/socket.ts+++ b/src/lib/bridge/socket.ts@@ -37,6 +37,7 @@ const SESSION_KEY_STORE = 'browsentic/sessionKey';const BASE_DELAY_MS = 1_000;const MAX_DELAY_MS = 30_000;+const STABLE_AFTER_MS = 30_000;const HANDSHAKE_TIMEOUT_MS = 5_000;const PAIRING_TIMEOUT_MS = 20_000;@@ -79,6 +80,7 @@ export interface DaemonState {let socket: WebSocket | null = null;let attempts = 0;let reconnectTimer: ReturnType<typeof setTimeout> | undefined;+let stableTimer: ReturnType<typeof setTimeout> | undefined;let runListener: ((runId: string, event: RunEvent) => void) | null = null;const welcomeListeners = new Set<() => void>();let draftListener: ((runId: string, draft: SiteMapDraft) => void) | null = null;@@ -375,6 +377,7 @@ function disconnectSocket(): void {closing.onopen = null;closing.onmessage = null;closing.onclose = null;+ clearTimeout(stableTimer);try {closing.close(1000, 'client disconnecting');} catch {@@ -435,6 +438,7 @@ function dial(credential: Credential, portIndex: number, carried?: Refusal): voiws.onclose = (event) => {clearTimeout(handshakeTimer);+ clearTimeout(stableTimer);if (socket === ws) socket = null;// A daemon that refuses the handshake outright — a protocol mismatch above all — says why in// the close frame and never sends an `unauthorized`. Without this the walk ends on the generic@@ -515,7 +519,10 @@ async function handle(ws: WebSocket, raw: string, attempt: Attempt): Promise<voiif (!sessionKey && (sealed || attempt.credential.kind === 'pair')) return attempt.walk();attempt.done();- attempts = 0;+ // A link that is welcomed and then dropped at once has not recovered, and forgetting the+ // backoff on the welcome alone lets two peers take the link from each other every second.+ clearTimeout(stableTimer);+ stableTimer = setTimeout(() => (attempts = 0), STABLE_AFTER_MS);if (sessionKey) await browser.storage.local.set({ [SESSION_KEY_STORE]: sessionKey });settlePairing({ ok: true });await setState({