Skip to content

Commit 7932668

Browse files
t3dotggclaude
andcommitted
fix(server,web): servers rows match the redesigned thread details
Rows use the subagent row layout: a ghost row control, and a stop button that shows on hover, on focus, and always on touch. Agent tracking moves into the shared Claude spawn wrapper, which main rewrote. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 67a2994 commit 7932668

3 files changed

Lines changed: 67 additions & 34 deletions

File tree

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ export const layerQueryRunner: Layer.Layer<
941941
);
942942
// Send MCP credentials over stdin to keep them out of SDK argv and inherited command environments.
943943
const { mcpServers, ...sdkOptions } = input.options;
944-
// Jobs the agent starts inherit the thread, so port discovery lists them after the CLI exits.
944+
// Jobs the agent starts inherit the thread, so port discovery can attribute their servers.
945945
const queryOptions = {
946946
...sdkOptions,
947947
env: {
@@ -995,7 +995,10 @@ export const layerQueryRunner: Layer.Layer<
995995
const spawnClaudeCodeProcess = (spawnOptions: ClaudeSpawnOptions) => {
996996
const child = spawnProcess(spawnOptions);
997997
spawnedProcess = child;
998-
if (child.pid !== undefined) child.once("exit", portDiscovery.trackAgent());
998+
// A spawn that fails emits only "error".
999+
const releaseAgent = portDiscovery.trackAgent();
1000+
child.once("exit", releaseAgent);
1001+
child.on("error", releaseAgent);
9991002
processExited = child.exitCode !== null || child.signalCode != null;
10001003
processExit = new Promise<void>((resolve) => {
10011004
if (processExited) resolve();

‎apps/web/src/components/chat/ThreadServersPanel.tsx‎

Lines changed: 61 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ import {
1010
isAtomCommandInterrupted,
1111
squashAtomCommandFailure,
1212
} from "@t3tools/client-runtime/state/runtime";
13-
import { GlobeIcon, SquareIcon } from "lucide-react";
13+
import { GlobeIcon, LoaderCircleIcon, SquareIcon } from "lucide-react";
1414
import { useState } from "react";
1515

16+
import { cn } from "../../lib/utils";
1617
import { useThreadDiscoveredPorts } from "../../portDiscoveryState";
1718
import { useEnvironment } from "../../state/environments";
1819
import { previewEnvironment } from "../../state/preview";
@@ -82,43 +83,72 @@ export function ThreadServersPanel(props: {
8283
return (
8384
<ThreadDetailsSection headingId="thread-details-servers-heading" title="Servers">
8485
<ul className="m-0 list-none p-0">
85-
{servers.map((server) => (
86-
<li key={serverKey(server)} className="flex items-center gap-1">
87-
<ThreadDetailsControl
88-
className="flex-1"
89-
disabled={!canOpen}
90-
aria-label={`Open localhost:${server.port} in the browser`}
91-
onClick={() => void open(server)}
92-
>
93-
<GlobeIcon className={THREAD_DETAILS_PANEL_ICON_CLASS} />
94-
<span className="shrink-0">localhost:{server.port}</span>
95-
<span className="ms-auto min-w-0 truncate text-2xs text-muted-foreground">
96-
{[server.terminal === null ? "Agent" : "Terminal", server.processName]
97-
.filter(Boolean)
98-
.join(" · ")}
99-
</span>
100-
</ThreadDetailsControl>
101-
{canStop && supportsStop && server.pid !== null ? (
86+
{servers.map((server) => {
87+
const key = serverKey(server);
88+
const stoppable = canStop && supportsStop && server.pid !== null;
89+
return (
90+
<li key={key} className="group relative flex h-8 items-center rounded-lg">
10291
<Tooltip>
10392
<TooltipTrigger
93+
delay={200}
10494
render={
10595
<ThreadDetailsControl
106-
size="icon-xs"
96+
size="sm"
10797
variant="ghost"
108-
part="icon"
109-
aria-label={`Stop localhost:${server.port}`}
110-
disabled={stoppingKey !== null}
111-
onClick={() => void stop(server)}
112-
>
113-
<SquareIcon className="size-3.5" />
114-
</ThreadDetailsControl>
98+
part="row"
99+
disabled={!canOpen}
100+
onClick={() => void open(server)}
101+
/>
115102
}
116-
/>
117-
<TooltipPopup>Stop server</TooltipPopup>
103+
>
104+
<GlobeIcon aria-hidden className={THREAD_DETAILS_PANEL_ICON_CLASS} />
105+
<span className="shrink-0 text-sm font-medium leading-4 text-foreground/85">
106+
localhost:{server.port}
107+
</span>
108+
{/* The stop button covers this while it shows. */}
109+
<span
110+
className={cn(
111+
"ms-auto min-w-0 truncate text-2xs font-normal text-muted-foreground",
112+
stoppable &&
113+
"group-hover:opacity-0 group-focus-within:opacity-0 pointer-coarse:opacity-0 [@media(hover:none)]:opacity-0",
114+
)}
115+
>
116+
{[server.terminal === null ? "Agent" : "Terminal", server.processName]
117+
.filter(Boolean)
118+
.join(" · ")}
119+
</span>
120+
</TooltipTrigger>
121+
<TooltipPopup side="left">Open in the browser panel</TooltipPopup>
118122
</Tooltip>
119-
) : null}
120-
</li>
121-
))}
123+
{stoppable ? (
124+
<div className="pointer-events-none absolute right-1 top-1/2 -translate-y-1/2 opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100 pointer-coarse:pointer-events-auto pointer-coarse:opacity-100 [@media(hover:none)]:pointer-events-auto [@media(hover:none)]:opacity-100">
125+
<Tooltip>
126+
<TooltipTrigger
127+
render={
128+
<ThreadDetailsControl
129+
size="icon-xs"
130+
variant="ghost"
131+
part="icon"
132+
tone="destructive"
133+
aria-label={`Stop localhost:${server.port}`}
134+
disabled={stoppingKey !== null}
135+
onClick={() => void stop(server)}
136+
/>
137+
}
138+
>
139+
{stoppingKey === key ? (
140+
<LoaderCircleIcon aria-hidden className="size-3 animate-spin" />
141+
) : (
142+
<SquareIcon aria-hidden className="size-3 fill-current" />
143+
)}
144+
</TooltipTrigger>
145+
<TooltipPopup side="left">Stop server</TooltipPopup>
146+
</Tooltip>
147+
</div>
148+
) : null}
149+
</li>
150+
);
151+
})}
122152
</ul>
123153
</ThreadDetailsSection>
124154
);

‎docs/user/thread-sidebar.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ finishes; the call's own result shows its status.
253253

254254
On web and desktop, the thread details card lists the web servers that the
255255
thread's terminals or its Claude agent started, with their ports. A server the
256-
agent started stays listed after the agent finishes or the thread settles.
256+
agent started stays listed after the agent's turn ends.
257257
Select a server to open it in the browser panel. **Stop** ends the server's job
258258
and keeps the agent, the terminal, and T3 Code running. Stop needs terminal
259259
access to the environment and is not available on Windows.

0 commit comments

Comments
 (0)