Skip to content

feat: browser tool router and external Playwright tier (phase 1, PR 1) - #121

Merged
chaodu-agent merged 2 commits into
mainfrom
feat/browser-tiers-p1
Nov 14, 2026
Merged

chaodu-agent merged 2 commits into
mainfrom
feat/browser-tiers-p1

Conversation

@chaodu-agent

Copy link
Copy Markdown
Contributor

Phase 1, PR 1 of the browser_* tiers work (design: #118, ADR docs/adr/browser-tiers.md, requirements docs/requirements/browser-tiers.md).

What changed

  • BrowserBackend interface, BrowserToolCatalog (32 names, Tier A table), BrowserRouter (R2 table, 30 min identity guard, no fallback, OAB-Browser-Backend header). tools/list shows only what the active backend serves; observe sees none and gets the unchanged unknown-tool error.
  • MCPServer.browser, forwarded by scoped(to:) and mappingTools(_:); connection key from the MCP session id or the attach session.
  • External Playwright backend for --upstream browser=URL: literal 127.0.0.1/::1 only (exit 64 otherwise), no redirects, fixed error classes, listener-owner uid must equal ours (libproc, fail closed), constructible only with an explicit BrowserTrust. Other --upstream names are unchanged.
  • No-tailscale guard under Sources/InstanceMCPCore/Browser/ in scripts/test-pw-mcp-check.sh and an XCTest.
  • Behavior change on macOS (R1.5): browser_* names not in the catalog are filtered; documented in README, docs/tool-profiles.md, docs/parity-checklist.md.

Phase order

The requirements doc defines no numbered phases. Order follows the task text and the doc's dependencies: interface and router, then the Playwright tier, then installer, wizard and Apple Events. This PR has no child process. Follow-up PR 2: StdioMCPClient, managed stdio child, sys_info backend line. Not included: wizard, installer, Apple Events tier, Linux (#119).

Tests (macmini, clone under /private/tmp)

swift build ok; swift test all green, including new BrowserRouterTests, BrowserServerWiringTests, BrowserToolCatalogTests, BrowserUpstreamURLTests, BrowserNoTailscaleTests, ExternalPlaywrightRedirectTests, ExternalPlaywrightErrorTests, PortOwnerProbeTests, BrowserSecretHygieneTests, and the updated BrowserProfileTests. check-no-private-identifiers.sh and test-pw-mcp-check.sh pass. test-packaging.sh not run (known macOS 27 pkgbuild issue; CI decides).

BrowserBackend interface, BrowserToolCatalog (32 names, Tier A table), BrowserRouter
(R2 table, 30 min identity guard, no fallback), MCPServer/scoped/mappingTools wiring,
OAB-Browser-Backend header, external Playwright backend (loopback-only URL, no redirects,
fixed error classes, listener uid check, explicit trust), no-tailscale guard, docs.
Managed stdio child is PR 2; Apple Events tier is Phase 2.

Ran on macmini (/private/tmp/oab-computer-p1): swift build ok; swift test all green incl.
new Browser*/PortOwner/ExternalPlaywright suites (31 tests); oab-computer --upstream
browser=http://localhost:8794/mcp exits 64; scripts/check-no-private-identifiers.sh ok;
scripts/test-pw-mcp-check.sh ok.
Ran: scripts/check-no-private-identifiers.sh (ok); swift test --filter Browser on macmini (24 tests, 0 failures).
@chaodu-agent
chaodu-agent merged commit 8037810 into main Nov 14, 2026
11 of 12 checks passed
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.

1 participant