From c9d1605b1e3b8dbe88cd3674a9256aa0465f3e6d Mon Sep 17 00:00:00 2001 From: amankumarsingh77 Date: Sat, 2 May 2026 16:53:34 +0530 Subject: chore: address final-review minors — surface event-consumer crashes, document IIFE-wrap heuristic, log shutdown failures, fix CHANGELOG file-size claim MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Five tweaks from the whole-implementation review: - session.ts: log unexpected event-consumer rejections instead of silent swallow - client.ts: comment the return-substring IIFE-wrap false-positive case - transport.ts: comment that ws.onclose post-open settle is no-op-by-design - index.ts: log client.stop() failures during shutdown - CHANGELOG.md: correct largest-file claim (transport.ts and client.ts are ~220 each, not "client.ts at ~180") Co-Authored-By: Claude Opus 4.7 (1M context) --- src/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/index.ts') diff --git a/src/index.ts b/src/index.ts index f5c7676..ee59f10 100644 --- a/src/index.ts +++ b/src/index.ts @@ -115,7 +115,13 @@ export default function browserHarnessExtension(pi: ExtensionAPI): void { pi.on("session_shutdown", async () => { persistState(pi, state); if (client) { - try { await client.stop(); } catch { /* best-effort */ } + try { + await client.stop(); + } catch (e) { + // Shutdown is best-effort, but a stuck stop() points at a transport + // bug worth surfacing for debugging. + console.warn("[pi-browser-harness] client.stop() failed during shutdown:", e); + } client = null; } toolsRegistered = false; -- cgit v1.2.3