Skip to content

[Bug]: The discovery of local servers probes test listeners and cannot be turned off #30687

Closed

Description

@pr0ton11

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Connect a T3 Code client, and start an agent thread.

  2. From that agent, run two local servers for 9 seconds:

    timeout 9 python3 -m http.server 0 --bind 127.0.0.1 > with.log 2>&1 &
    env -u T3CODE_THREAD_ID timeout 9 python3 -m http.server 0 --bind 127.0.0.1 > without.log 2>&1 &
  3. Read the two logs.

Expected behavior

A user can turn the discovery of local servers off, or at least its probing. A test process that an agent starts gets no request that it did not ask for.

Any of these solves it. The first is the most useful:

  1. A setting in settings.json and an environment variable (for example T3CODE_DISCOVER_LOCAL_SERVERS=false) that turns off the scan.
  2. Probe only when the preview panel is open, not whenever a client is subscribed.
  3. Probe only a listener that has lived for some time, for example 30 seconds, so short test listeners stay untouched.
  4. Let a process opt out through an environment variable.

Actual behavior

with.log shows GET / HTTP/1.1 from 127.0.0.1, and without.log shows none. No setting turns this off.

While a client subscribes to subscribeDiscoveredLocalServers, PortDiscovery scans every 3 seconds. It finds each listener that a process with T3CODE_THREAD_ID in its environment owns, or that belongs to a T3 terminal, and sends GET / to it. We also saw a TLS client hello on such ports. A test process inherits the variable from the agent, so its short-lived fake servers count as servers to find.

Test fakes often count requests, or refuse a request they do not expect. The probe arrives about 2 seconds after the listener opens, so the result depends on timing. In Go test suites we saw:

  • the proxy got 2 connections, want none
  • A fake server failed the test because it got a GET / it does not answer.
  • A fake server recorded an unsigned call that no test code made.

One test failed in 5 of 20 runs and another in 1 of 20 on an unchanged commit. The failures looked like load-related flakes, and finding the real cause took a long time. A server under development also sees a request that nobody made.

Impact

Minor bug or occasional failure

Version or commit

t3 v0.1.5

Environment

Linux, t3 serve, Claude Code as the agent provider, a T3 Code client connected

Logs or stack traces

127.0.0.1 - - [04/Nov/2026 08:01:45] "GET / HTTP/1.1" 200 -

Workaround

Unset T3CODE_THREAD_ID before a test run. This works, but every test command of an agent needs it, and an agent does not know it has to.

Activity

  1. changed the title [-]Allow the discovery of local servers to be turned off: its probes break test suites that an agent runs[/-] [+][Bug]: The discovery of local servers probes test listeners and cannot be turned off[/+] on Nov 4, 2026
  2. juliusmarminge commented on Nov 4, 2026

    @juliusmarminge
    Member

    Thanks for the detailed report. Your version, 0.1.5, behaves as described: it sent http:// and https:// requests to every listener owned by an agent or a terminal. That is the GET / and the TLS client hello you saw.

    bf8e132 (#27893) fixed this, and the fix shipped in v0.1.6. Discovery now reads which process holds each port and never connects to it. The only addresses it requests are the Preview URLs that you configure on project scripts. The same change added T3CODE_PORT_DISCOVERY=0, which turns off listener discovery. Set it in the environment that starts the T3 Code server, for example in service.env for the background service.

    What I ran on current main (8b44f42), Linux, with a fresh database and the Browser panel open so a client was subscribed to discovery:

    1. Your steps word for word, from a Codex agent thread: with.log and without.log were both empty, so neither server got a request.
    2. The same two servers with timeout 40 and python3 -u: the panel listed python3 localhost:<port> for the server that inherited T3CODE_THREAD_ID. It did not list the one that ran with env -u. Over its 40 seconds (about 13 scan cycles), neither log showed a request.
    3. A server started from a T3 terminal (timeout 30 python3 -u -m http.server 0 --bind 127.0.0.1): the panel listed it, and its log shows no request.

    Closing this as fixed. Please reopen if you still see probes on 0.1.6 or later.

  3. pr0ton11 commented on Nov 4, 2026

    @pr0ton11
    Author

    Thanks Julius
    Great work on T3Code, it's awesome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions