Repository navigation
Conversation
A browser an agent tool launches inherits T3CODE_THREAD_ID, so its --remote-debugging-port listener was listed as the thread's server. Skip processes started with that flag on Linux and macOS.
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Agent browser DevTools listeners are excluded from agent-owned preview discovery on macOS and Linux. The change is limited to discovery attribution, preserves terminal ownership, and does not modify running processes or stored data. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Problem
When an agent's tool launched a browser for automation (for example, a headless Chrome), the thread's Servers list showed that browser's DevTools port, such as
localhost:34613, as if it were a dev server. The browser inheritsT3CODE_THREAD_IDfrom the agent's shell, so the port scanner treated its--remote-debugging-portlistener as an agent server. The DevTools port does not serve a page, so it should not appear in the list.Change
In
readAgentThreads, a process started with--remote-debugging-port=is no longer counted as an agent's process./proc/<pid>/cmdlineonly for pids that already have an agent thread, so untagged listeners cost nothing extra.ps -Eline it already reads.The agent's real servers still appear in the list.
Scope
This is a small fix for an obvious bug, so I did not open an issue first: an agent's automation browser showed up as a preview server.
Verification
vp test run src/preview/PortScanner.test.ts: 33/33 pass. The new test fails without the fix.vp lint,vp fmt --check, and the server typecheck pass.vp run devand a Replay thread. Two listeners, both started with that thread'sT3CODE_THREAD_ID::5173--remote-debugging-port=9333Before, the list showed both ports. After, the agent's Chrome is still running:
http://localhost:9333/json/versionreturnsHeadlessChrome/156. At the same moment, the list shows onlylocalhost:5173. I tested on Linux only. Unit tests cover the macOSps -Epath, but I did not run it on a Mac.Made with Claude Opus 5.5 in Claude Code, running in T3 Code.