From 44d58aa6ee9e38b2f2a61b197fab8602f5ca5087 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Fri, 14 Aug 2026 16:00:58 -0700 Subject: [PATCH] fix(extension): delete the dead chat-queue client surface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The sidebar-command handler in background.js POSTed to a server endpoint that no longer exists (deleted with the chat queue) — ~35 lines of fully-wired dead code including error handling for the permanent 404, plus its allowlist entry. No sender in the extension ever emitted the message type. chatEnabled leaves the /health contract (server hardcoded false, background.js re-derived it, nothing consumed it — the chat input element it guarded is gone from sidepanel.html). BROWSE_SIDEBAR_CHAT env flag had zero readers. Co-Authored-By: Claude Fable 5 --- browse/src/cli.ts | 1 - browse/src/server.ts | 4 ---- browse/test/sidebar-tabs.test.ts | 5 ++-- extension/background.js | 40 ++------------------------------ 4 files changed, 5 insertions(+), 45 deletions(-) diff --git a/browse/src/cli.ts b/browse/src/cli.ts index 59327b792..2ef5be3f5 100644 --- a/browse/src/cli.ts +++ b/browse/src/cli.ts @@ -1085,7 +1085,6 @@ Refs: After 'snapshot', use @e1, @e2... as selectors: const serverEnv: Record = { BROWSE_HEADED: '1', BROWSE_PORT: '34567', - BROWSE_SIDEBAR_CHAT: '1', // Disable parent-process watchdog: the user controls the headed browser // window lifecycle. The CLI exits immediately after connect, so watching // it would kill the server ~15s later. Cleanup happens via browser diff --git a/browse/src/server.ts b/browse/src/server.ts index fe99cee65..a20f125be 100644 --- a/browse/src/server.ts +++ b/browse/src/server.ts @@ -1832,10 +1832,6 @@ export function buildFetchHandler(cfg: ServerConfig): ServerHandle { mode: browserManager.getConnectionMode(), uptime: Math.floor((Date.now() - startTime) / 1000), tabs: browserManager.getTabCount(), - // The chat queue is gone — Terminal pane is the sole sidebar - // surface. Keep `chatEnabled: false` so any older extension - // build still treats the chat input as disabled. - chatEnabled: false, // Security module status — drives the shield icon in the sidepanel. // Returns {status: 'protected'|'degraded'|'inactive', layers: {...}}. // The chat-path classifier no longer feeds this since diff --git a/browse/test/sidebar-tabs.test.ts b/browse/test/sidebar-tabs.test.ts index 6f813c136..f2820a4cf 100644 --- a/browse/test/sidebar-tabs.test.ts +++ b/browse/test/sidebar-tabs.test.ts @@ -205,8 +205,9 @@ describe('server.ts: chat / sidebar-agent endpoints are gone', () => { expect(slice).not.toContain('agentStatus'); expect(slice).not.toContain('messageQueue'); expect(slice).not.toContain('agentStartTime'); - // chatEnabled is hardcoded false now (older clients still see the field). - expect(slice).toMatch(/chatEnabled:\s*false/); + // chatEnabled is gone entirely — the chat pane no longer exists in any + // extension build, so /health stopped advertising a chat mode. + expect(slice).not.toContain('chatEnabled'); // terminalPort survives. expect(slice).toContain('terminalPort'); }); diff --git a/extension/background.js b/extension/background.js index 249bd9f05..5926eb3b2 100644 --- a/extension/background.js +++ b/extension/background.js @@ -81,8 +81,7 @@ async function checkHealth() { // already flips to disconnected on a 403. const gotToken = await loadAuthToken(); if (!gotToken && !authToken) return; - // Forward chatEnabled so sidepanel can show/hide chat tab - setConnected({ ...data, chatEnabled: !!data.chatEnabled }); + setConnected(data); } else { setDisconnected(); } @@ -297,7 +296,7 @@ chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => { const ALLOWED_TYPES = new Set([ 'getPort', 'setPort', 'getServerUrl', 'getToken', 'fetchRefs', - 'openSidePanel', 'sidebarOpened', 'command', 'sidebar-command', + 'openSidePanel', 'sidebarOpened', 'command', 'getTabState', // Inspector message types 'startInspector', 'stopInspector', 'elementPicked', 'pickerCancelled', @@ -447,41 +446,6 @@ chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => { return true; } - // Sidebar → Claude Code (file-based message queue) - if (msg.type === 'sidebar-command') { - const base = getBaseUrl(); - if (!base || !authToken) { - sendResponse({ error: 'Not connected' }); - return true; - } - // Capture the active tab's URL so the sidebar agent knows what page - // the user is actually looking at (Playwright's page.url() can be stale - // if the user navigated manually in headed mode). - chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => { - const activeTabUrl = tabs?.[0]?.url || null; - fetch(`${base}/sidebar-command`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${authToken}`, - }, - body: JSON.stringify({ message: msg.message, activeTabUrl }), - }) - .then(r => { - if (!r.ok) { - console.error(`[gstack bg] sidebar-command failed: ${r.status} ${r.statusText}`); - return r.json().catch(() => ({ error: `Server returned ${r.status}` })); - } - return r.json(); - }) - .then(data => sendResponse(data)) - .catch(err => { - console.error('[gstack bg] sidebar-command error:', err.message); - sendResponse({ error: err.message }); - }); - }); - return true; - } }); // ─── Side Panel ─────────────────────────────────────────────────