Skip to content

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

Draft
mwolson wants to merge 1 commit into
contrib/queued-edit-during-compactionfrom
contrib/preview-probes-binary-services
Draft

mwolson wants to merge 1 commit into
contrib/queued-edit-during-compactionfrom
contrib/preview-probes-binary-services

Conversation

@mwolson

@mwolson mwolson commented Oct 30, 2026

Copy link
Copy Markdown
Owner

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.

Preview discovery decided whether a listener was a web server by sending
it GET and a TLS ClientHello. Owned listeners include every process a
Claude agent starts, since they inherit T3CODE_THREAD_ID, so the 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. Unity, Flutter's test loader and gcloud's OAuth callback fail the
same way.

Owned listeners are now listed from process ownership alone, and only
configured URLs get a request. T3CODE_PORT_DISCOVERY=0 turns the listing
off. This is upstream PR 26289 preview-probes-binary-services by
shivamhwp.

Without a probe the list would also show ports that exist for moments,
so a new listener appears once it has been up for one poll interval.
Listeners already up when a client first looks appear at once.
@mwolson
mwolson added this pull request to stack #108 October 30, 2026 18:15

This branch has not been deployed

No deployments
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