Skip to content

Commit e4d86ab

Browse files
fix(web): remote Lineage rows keep their title when the environment name is long (#33181)
Co-authored-by: Julius Marminge <[email protected]>
1 parent 633438d commit e4d86ab

2 files changed

Lines changed: 23 additions & 12 deletions

File tree

‎apps/web/src/components/chat/ThreadRelationshipsControl.browser.test.tsx‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { AsyncResult } from "effect/reactivity";
55
import { expect, it, vi } from "vite-plus/test";
66
import { page, userEvent } from "vite-plus/test/browser";
77

8+
import "~/index.css";
9+
810
const state = vi.hoisted(() => ({
911
projection: null as unknown,
1012
commandSucceeds: false,
@@ -295,18 +297,20 @@ it("shows a remote subagent's full title in its tooltip even when its environmen
295297
remoteChild: {
296298
environmentId: remoteEnvId,
297299
threadId: remoteThreadId,
298-
label: "Remote VM",
300+
label: "Remote VM with a long machine name in the office",
299301
},
300302
},
301303
],
302304
};
303305
await using screen = await render(
304-
<ThreadRelationshipsPanel
305-
environmentId={environmentId}
306-
threadId={threadId}
307-
showLineage
308-
showSideChats={false}
309-
/>,
306+
<div style={{ width: 320 }}>
307+
<ThreadRelationshipsPanel
308+
environmentId={environmentId}
309+
threadId={threadId}
310+
showLineage
311+
showSideChats={false}
312+
/>
313+
</div>,
310314
{ router: "/environment/fork" },
311315
);
312316

@@ -316,12 +320,16 @@ it("shows a remote subagent's full title in its tooltip even when its environmen
316320
.not.toBeInTheDocument();
317321
await screen.getByRole("button", { name: /Previous agents/ }).click();
318322
const row = screen.getByRole("button", { name: new RegExp(longTitle) });
323+
// A long environment label must not squeeze the title out of the row.
324+
expect(
325+
page.getByText(longTitle, { exact: true }).element().getBoundingClientRect().width,
326+
).toBeGreaterThan(0);
319327
await userEvent.hover(row);
320328
await vi.waitFor(() =>
321329
expect(document.querySelector('[data-slot="tooltip-popup"]')?.textContent).toContain(longTitle),
322330
);
323331
expect(document.querySelector('[data-slot="tooltip-popup"]')?.textContent).toContain(
324-
"Runs on Remote VM. Connect to it to open the thread there.",
332+
"Runs on Remote VM with a long machine name in the office. Connect to it to open the thread there.",
325333
);
326334

327335
await row.click({ force: true });

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,10 @@ function RemoteSubagentRow(props: {
309309
</span>
310310
</span>
311311
<span
312-
className={`shrink-0 text-2xs ${failed ? "text-destructive" : "text-muted-foreground"}`}
312+
className={`flex max-w-1/2 shrink-0 gap-1 text-2xs ${failed ? "text-destructive" : "text-muted-foreground"}`}
313313
>
314-
on {remoteChild.label} · {threadRelationshipStatusLabel(status)}
314+
<span className="truncate">on {remoteChild.label}</span>
315+
<span className="shrink-0">· {threadRelationshipStatusLabel(status)}</span>
315316
</span>
316317
</TooltipTrigger>
317318
<TooltipPopup side="left">
@@ -373,7 +374,9 @@ function DelegatedFromRow(props: {
373374
</span>
374375
</span>
375376
{label ? (
376-
<span className="shrink-0 text-2xs text-muted-foreground">on {label}</span>
377+
<span className="max-w-1/2 shrink-0 truncate text-2xs text-muted-foreground">
378+
on {label}
379+
</span>
377380
) : null}
378381
</TooltipTrigger>
379382
<TooltipPopup side="left">
@@ -382,7 +385,7 @@ function DelegatedFromRow(props: {
382385
hint={
383386
environment === null
384387
? `Delegated from ${label ?? "a linked environment"}. Connect to it to open the parent thread.`
385-
: "Open parent agent"
388+
: `Open parent agent on ${environment.label}`
386389
}
387390
/>
388391
</TooltipPopup>

0 commit comments

Comments
 (0)