Note
Grok responding on behalf of Julius.
Triage
Thanks @Vantrongs for the detailed code reading. It held up on both counts.
Confirmed on current main. This is one visibility gap with two separate causes.
The default sidebar never shows a per-thread server. legacySidebarEnabled is off by default, and the globe that opens localhost:PORT only exists on the legacy row (LegacySidebar.tsx, fed by useThreadDiscoveredPorts). SidebarThreadRow shows a terminal icon for T3 terminal sessions but doesn't read discovered ports at all. Turning the legacy sidebar on (Settings, then General, then Legacy features) only helps partly. It brings back the globe for servers started inside a T3 terminal, but not for your repro.
Servers an agent starts in the background aren't linked to any thread, even in the legacy sidebar. useThreadDiscoveredPorts keeps a listener only when terminal.threadId matches, and PortDiscovery sets terminal only from PIDs the terminal manager registers (registerTerminalProcesses in terminal/Manager.ts). A server started from Claude's background shell descends from the provider process, not a T3 terminal, so it's recorded with terminal: null. If it serves HTML it still appears in Preview's "Local servers" list, but that list doesn't name a thread, which matches the pile-up you described.
Likely fix area
Linking listeners through the provider's process tree is the right idea, but the diagnostics snapshot can't do it on its own. Resource telemetry labels those processes server-child and stores no thread id, and Claude's session isn't registered with PortDiscovery as a root PID. The options look like this:
- Register the provider's descendant PIDs the way terminals already do.
- Walk up from the listener PID to a provider root that maps to a thread.
Either way, some edge cases stay out of reach: detached or double-forked processes fall off the parent chain, listeners that don't serve HTML never get discovered, and the Windows fallback without lsof has no PID to work from. Showing the count and ports on the default sidebar row is a separate UI change.
A maintainer will decide on the fix direction.
Not a duplicate. Discussion #14822 is about showing already-linked servers on mobile, and Discussions #10089 and #11254 are about stopping terminals or project actions when a thread settles.