Skip to content

Commit b5c83cd

Browse files
authored
Show the full title in lineage/side-chat row tooltips (pingdotgg#28326)
1 parent 67ff912 commit b5c83cd

2 files changed

Lines changed: 200 additions & 18 deletions

File tree

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

Lines changed: 163 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
import * as DateTime from "effect/DateTime";
12
import { EnvironmentId, NodeId, ThreadId } from "@t3tools/contracts";
23
import * as Cause from "effect/Cause";
34
import { AsyncResult } from "effect/reactivity";
45
import { expect, it, vi } from "vite-plus/test";
5-
import { page } from "vite-plus/test/browser";
6+
import { page, userEvent } from "vite-plus/test/browser";
67

7-
const state = vi.hoisted(() => ({ projection: null as unknown, commandSucceeds: false }));
8+
const state = vi.hoisted(() => ({
9+
projection: null as unknown,
10+
commandSucceeds: false,
11+
relatedShells: [] as unknown[],
12+
}));
813

914
vi.mock(import("@effect/atom-react"), async (original) => ({
1015
...(await original()),
@@ -16,7 +21,9 @@ vi.mock(import("../../state/entities"), () => ({
1621
useThreadProjection: ((ref: unknown) =>
1722
ref === null ? null : { projection: state.projection }) as never,
1823
useThreadRelationshipShells: (() =>
19-
state.projection === null ? [] : [(state.projection as { thread: unknown }).thread]) as never,
24+
state.projection === null
25+
? []
26+
: [(state.projection as { thread: unknown }).thread, ...state.relatedShells]) as never,
2027
useProjects: (() => []) as never,
2128
}));
2229
vi.mock(import("../../state/environments"), () => ({
@@ -43,6 +50,7 @@ const threadId = ThreadId.make("fork");
4350

4451
function setup() {
4552
state.commandSucceeds = false;
53+
state.relatedShells = [];
4654
state.projection = {
4755
thread: {
4856
id: threadId,
@@ -183,3 +191,155 @@ it("opens an idle child from Lineage when its shell has not been loaded", async
183191
expect(screen.router?.state.location.pathname).toBe("/local/omitted-child"),
184192
);
185193
});
194+
195+
it("shows a lineage thread's full title in its tooltip", async () => {
196+
setup();
197+
const longTitle = "Compare the lineage tooltip against a title that the row truncates";
198+
const sourceThread = {
199+
...(state.projection as { thread: Record<string, unknown> }).thread,
200+
id: "source",
201+
title: longTitle,
202+
lineage: { parentThreadId: null, relationshipToParent: null },
203+
};
204+
state.relatedShells = [sourceThread];
205+
await using _screen = await render(
206+
<ThreadRelationshipsPanel
207+
environmentId={environmentId}
208+
threadId={threadId}
209+
showLineage
210+
showSideChats={false}
211+
/>,
212+
);
213+
214+
await userEvent.hover(page.getByText(longTitle, { exact: true }));
215+
await vi.waitFor(() =>
216+
expect(document.querySelector('[data-slot="tooltip-popup"]')?.textContent).toContain(longTitle),
217+
);
218+
});
219+
220+
it("shows a side chat's full title in its tooltip", async () => {
221+
setup();
222+
const longTitle = "Side chat question with a title that the side chat row truncates";
223+
state.relatedShells = [
224+
{
225+
id: "side",
226+
title: longTitle,
227+
lineage: {
228+
parentThreadId: threadId,
229+
relationshipToParent: "fork",
230+
rootThreadId: threadId,
231+
sideChat: true,
232+
},
233+
},
234+
];
235+
await using _screen = await render(
236+
<ThreadRelationshipsPanel
237+
environmentId={environmentId}
238+
threadId={threadId}
239+
showLineage={false}
240+
showSideChats
241+
/>,
242+
);
243+
244+
await userEvent.hover(page.getByText(longTitle, { exact: true }));
245+
await vi.waitFor(() =>
246+
expect(document.querySelector('[data-slot="tooltip-popup"]')?.textContent).toContain(longTitle),
247+
);
248+
});
249+
250+
it("shows a remote subagent's full title in its tooltip even when its environment is unavailable", async () => {
251+
setup();
252+
const longTitle = "Investigate a remote subagent issue across linked environments";
253+
const remoteEnvId = EnvironmentId.make("remote-env");
254+
const remoteThreadId = ThreadId.make("remote-thread");
255+
const now = DateTime.makeUnsafe("2026-10-31T20:00:00.000Z");
256+
state.projection = {
257+
...(state.projection as Record<string, unknown>),
258+
subagents: [
259+
{
260+
id: NodeId.make("remote-agent"),
261+
threadId,
262+
runId: null,
263+
parentNodeId: NodeId.make("parent"),
264+
origin: "app_owned",
265+
createdBy: "agent",
266+
driver: "codex",
267+
providerInstanceId: "provider",
268+
providerThreadId: null,
269+
childThreadId: null,
270+
nativeTaskRef: null,
271+
prompt: "Run remote task",
272+
title: longTitle,
273+
model: null,
274+
status: "completed",
275+
result: null,
276+
startedAt: null,
277+
completedAt: null,
278+
updatedAt: now,
279+
remoteChild: {
280+
environmentId: remoteEnvId,
281+
threadId: remoteThreadId,
282+
label: "Remote VM",
283+
},
284+
},
285+
],
286+
};
287+
await using screen = await render(
288+
<ThreadRelationshipsPanel
289+
environmentId={environmentId}
290+
threadId={threadId}
291+
showLineage
292+
showSideChats={false}
293+
/>,
294+
{ router: "/environment/fork" },
295+
);
296+
297+
const row = screen.getByRole("button", { name: new RegExp(longTitle) });
298+
await userEvent.hover(row);
299+
await vi.waitFor(() =>
300+
expect(document.querySelector('[data-slot="tooltip-popup"]')?.textContent).toContain(longTitle),
301+
);
302+
expect(document.querySelector('[data-slot="tooltip-popup"]')?.textContent).toContain(
303+
"Runs on Remote VM. Connect to it to open the thread there.",
304+
);
305+
306+
await row.click({ force: true });
307+
expect(screen.router?.state.location.pathname).toBe("/environment/fork");
308+
});
309+
310+
it("shows a delegated-from thread's full title in its tooltip even when its environment is unavailable", async () => {
311+
setup();
312+
const longTitle = "Parent task delegated from another machine that has a long description";
313+
state.projection = {
314+
...(state.projection as Record<string, unknown>),
315+
thread: {
316+
...(state.projection as { thread: Record<string, unknown> }).thread,
317+
delegatedFrom: {
318+
environmentId: EnvironmentId.make("parent-env"),
319+
threadId: ThreadId.make("parent-thread"),
320+
title: longTitle,
321+
},
322+
},
323+
};
324+
await using screen = await render(
325+
<ThreadRelationshipsPanel
326+
environmentId={environmentId}
327+
threadId={threadId}
328+
showLineage
329+
showSideChats={false}
330+
/>,
331+
{ router: "/environment/fork" },
332+
);
333+
334+
const row = screen.getByRole("button", { name: new RegExp(longTitle) });
335+
await userEvent.hover(row);
336+
await vi.waitFor(() =>
337+
expect(document.querySelector('[data-slot="tooltip-popup"]')?.textContent).toContain(longTitle),
338+
);
339+
expect(document.querySelector('[data-slot="tooltip-popup"]')?.textContent).toContain(
340+
"Delegated from a linked environment. Connect to it to open the parent thread.",
341+
);
342+
343+
await row.click({ force: true });
344+
expect(screen.router?.state.location.pathname).toBe("/environment/fork");
345+
});

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

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,16 @@ function relationshipThreadTitle(input: {
197197
return formatSubagentDisplayTitle(input.title);
198198
}
199199

200+
/** The full title, since the row truncates it, with what a click does. */
201+
function LineageTooltipContent(props: { readonly title: string; readonly hint: string }) {
202+
return (
203+
<>
204+
<span className="block font-medium">{props.title}</span>
205+
<span className="block text-muted-foreground">{props.hint}</span>
206+
</>
207+
);
208+
}
209+
200210
function currentSubagent<Agent extends RuntimeSubagent>(
201211
agent: Agent | undefined,
202212
childThread: OrchestrationV2ThreadShell | null | undefined,
@@ -257,15 +267,16 @@ function RemoteSubagentRow(props: {
257267
size="sm"
258268
variant="ghost"
259269
part="row"
260-
disabled={environment === null}
261-
onClick={() =>
270+
aria-disabled={environment === null || undefined}
271+
onClick={() => {
272+
if (environment === null) return;
262273
void navigate({
263274
to: "/$environmentId/$threadId",
264275
params: buildThreadRouteParams(
265276
scopeThreadRef(remoteChild.environmentId, remoteChild.threadId),
266277
),
267-
})
268-
}
278+
});
279+
}}
269280
/>
270281
}
271282
>
@@ -288,9 +299,14 @@ function RemoteSubagentRow(props: {
288299
</span>
289300
</TooltipTrigger>
290301
<TooltipPopup side="left">
291-
{environment === null
292-
? `Runs on ${remoteChild.label}. Connect to it to open the thread there.`
293-
: `Open on ${remoteChild.label}`}
302+
<LineageTooltipContent
303+
title={title}
304+
hint={
305+
environment === null
306+
? `Runs on ${remoteChild.label}. Connect to it to open the thread there.`
307+
: `Open on ${remoteChild.label}`
308+
}
309+
/>
294310
</TooltipPopup>
295311
</Tooltip>
296312
</li>
@@ -323,13 +339,14 @@ function DelegatedFromRow(props: {
323339
size="sm"
324340
variant="ghost"
325341
part="row"
326-
disabled={environment === null}
327-
onClick={() =>
342+
aria-disabled={environment === null || undefined}
343+
onClick={() => {
344+
if (environment === null) return;
328345
void navigate({
329346
to: "/$environmentId/$threadId",
330347
params: buildThreadRouteParams(parentRef),
331-
})
332-
}
348+
});
349+
}}
333350
/>
334351
}
335352
>
@@ -344,9 +361,14 @@ function DelegatedFromRow(props: {
344361
) : null}
345362
</TooltipTrigger>
346363
<TooltipPopup side="left">
347-
{environment === null
348-
? `Delegated from ${label ?? "a linked environment"}. Connect to it to open the parent thread.`
349-
: "Open parent agent"}
364+
<LineageTooltipContent
365+
title={title}
366+
hint={
367+
environment === null
368+
? `Delegated from ${label ?? "a linked environment"}. Connect to it to open the parent thread.`
369+
: "Open parent agent"
370+
}
371+
/>
350372
</TooltipPopup>
351373
</Tooltip>
352374
</li>
@@ -680,7 +702,7 @@ export function ThreadRelationshipsPanel(props: {
680702
childProject={project}
681703
/>
682704
) : (
683-
relationshipHint
705+
<LineageTooltipContent title={threadTitle} hint={relationshipHint} />
684706
);
685707
const relationshipContent = (
686708
<>

0 commit comments

Comments
 (0)