From 0c72054fa8393dfdd554a7482175a16eaf994a76 Mon Sep 17 00:00:00 2001 From: Josh Mabry Date: Sun, 13 Sep 2026 02:06:49 -0700 Subject: [PATCH 1/2] fix: recover a wedged plugin tab; a search read must be our own search (0.3.3) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review round 2 on #3 (MERGE, no blockers) confirmed two gaps with stubs; closed here. - Wedged own tab: if the labelled tab exists but will not take focus (hung/crashed), `tab new --label` is refused "already used" and every navigation failed until the operator closed it by hand. Now: close OUR labelled tab (the only one carrying the label) and create a fresh one ("recreated"). - Wrong-search reads: the host check let an operator's own eBay search (a cmd-click in the shared window) answer ours — `ok: true` with prices for the operator's query. For a search request, the landed page must be the same host and, when it states search terms (`_nkw` on eBay /sch/, `k` on Amazon /s), the SAME terms (normalized: case, +/%20, spacing, parameter order). An item/product page answering a search is a hijack. Sign-in and challenge hops on subdomains, and search pages that state no terms (eBay rewrites), are not judged here. - The module docstring now states the residual sub-second race honestly (0.27.1's `open` cannot name a tab; the read-side check catches the result). - Tests: wedged-tab recovery closes only the labelled tab; reclaim through a blocked navigation with an operator Gmail and an operator eBay search in the list closes only the panel (locks in round 1's fix via the real path); 10 same-search cases. 168 host-free tests. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_011UQ33xXfygwEkzbbJx3YwZ --- browser.py | 16 +++++++-- protoagent.plugin.yaml | 2 +- pyproject.toml | 2 +- tests/test_plugin.py | 73 ++++++++++++++++++++++++++++++++++++++++++ tools.py | 42 +++++++++++++++++++----- 5 files changed, 123 insertions(+), 12 deletions(-) diff --git a/browser.py b/browser.py index 4a2527b..9d6a804 100644 --- a/browser.py +++ b/browser.py @@ -29,8 +29,11 @@ panel (Chrome refuses: ``net::ERR_BLOCKED_BY_CLIENT``) or one of the operator's tabs. So the launch step is ``tab