fix(server): Stop preview discovery from probing local ports#107

draft1
contrib/queued-edit-during-compaction
contrib/preview-probes-binary-services
opened2h agobyMMike Olson
View on GitHubTwo-way sync enabledPR last imported 1h ago

Preview discovery decided whether a local port was a web server by sending it GET / and a TLS ClientHello. Every process a Claude agent starts counts as owned, so those probes reached private ports. A Gradle test worker takes the first connection on its port as its worker, so a probe failed the build with no failing test.

Owned ports are now listed from process ownership alone, and only configured Preview URLs get a request. T3CODE_PORT_DISCOVERY=0 turns the listing off. This carries upstream pingdotgg/t3code#26289 preview-probes-binary-services by shivamhwp, for issue pingdotgg/t3code#26279.

On top of that PR:

  • A new port is listed once it has been up for one poll interval, so ports that exist for moments stay off the list. Ports already up when a client first looks appear at once.
  • An owned port whose configured URL is failing its check still opens at that URL, instead of falling back to http://localhost:<port>.
  • The empty browser panel and the thread details docs no longer promise that every listed port is a web server.

Drop this layer when upstream merges pingdotgg/t3code#26289, keeping whichever of the additions upstream did not take.

Validation: PortScanner.test.ts passes, and the listing and configured-URL assertions fail without their changes. Before the change, a Gradle build with an untagged daemon had no errors in 9 of 9 runs and a tagged daemon failed 1 of 13, with a stand-in probe on first sight failing 6 of 6.

Added 1 commit

  • fix(server): Stop preview discovery from probing local ports7333b75