Skip to content

fix: harden browser automation pipeline#251

Merged
jackwener merged 1 commit intomainfrom
fix/browser-automation-robustness
Mar 22, 2026
Merged

fix: harden browser automation pipeline#251
jackwener merged 1 commit intomainfrom
fix/browser-automation-robustness

Conversation

@jackwener
Copy link
Owner

Summary

Fixes #249Cannot access a chrome-extension:// URL of different extension

Root Cause

resolveTabId() skipped URL validation when an explicit tabId was provided. Extensions like "New Tab Override" could hijack tab URLs to chrome-extension://, causing chrome.debugger.attach() to fail.

Changes (12 issues fixed)

P0 — Extension layer

  • resolveTabId: validate URL even for explicit tabId
  • handleNavigate: wait for URL change before checking complete status (race condition fix)
  • ensureAttached: pre-check tab URL, verify cached attach with probe

P1 — Resilience

  • daemon-client: recognize transient extension errors as retryable (1.5s delay)
  • Increase automation window idle timeout 30s → 120s
  • Navigate timeout now logs warning instead of silent success

P2 — Improvements

  • selectTab/newTab/closeTab properly update/invalidate _tabId
  • Pipeline executor: per-step retry for browser steps + cleanup on failure
  • WebSocket ping/pong heartbeat (15s interval)
  • Fix timeout param edge cases, remove unused imports

Testing

  • ✅ 306 unit tests pass
  • ✅ CLI build + extension build both succeed

- resolveTabId: validate URL even for explicit tabId, fall through to
  auto-resolve when tab is not debuggable or has been closed
- handleNavigate: wait for URL change before checking 'complete' status
  to avoid race condition with stale about:blank
- ensureAttached: pre-check tab URL, verify cached attach with probe,
  invalidate cache on URL change via onUpdated listener
- daemon-client: recognize transient extension errors (disconnected,
  attach failed) as retryable with 1500ms delay; fresh command ID per attempt
- pipeline executor: add per-step retry for browser steps (up to 2 retries
  on transient errors); cleanup automation window on pipeline failure
- page.ts: selectTab/newTab/closeTab properly update/invalidate _tabId
- daemon.ts: add WebSocket ping/pong heartbeat (15s interval, 2-miss disconnect)
- Increase automation window idle timeout from 30s to 120s
- Fix timeout param edge cases in BrowserBridge._ensureDaemon
- Remove unused chalk import; fix trailing import placement

Closes #249
@jackwener jackwener merged commit 71b2c39 into main Mar 22, 2026
11 checks passed
@jackwener jackwener deleted the fix/browser-automation-robustness branch March 22, 2026 13:23
This was referenced Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Cannot access a chrome-extension:// URL of different extension

1 participant