Skip to content

Commit efa8ac1

Browse files
committed
fix(web): show the full title in lineage/side-chat row tooltips
Fork, parent, remote, delegated, and side-chat rows in the thread relationships panel truncate long titles, but their hover tooltip only repeated the relationship hint ("Open parent agent", etc.), never the title itself — so a truncated row had no way to read the full title. The tooltip now shows the full title above the existing hint.
1 parent 79f1fad commit efa8ac1

2 files changed

Lines changed: 92 additions & 10 deletions

File tree

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

Lines changed: 65 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ import { EnvironmentId, NodeId, ThreadId } from "@t3tools/contracts";
22
import * as Cause from "effect/Cause";
33
import { AsyncResult } from "effect/reactivity";
44
import { expect, it, vi } from "vite-plus/test";
5-
import { page } from "vite-plus/test/browser";
5+
import { page, userEvent } from "vite-plus/test/browser";
66

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

913
vi.mock(import("@effect/atom-react"), async (original) => ({
1014
...(await original()),
@@ -16,7 +20,9 @@ vi.mock(import("../../state/entities"), () => ({
1620
useThreadProjection: ((ref: unknown) =>
1721
ref === null ? null : { projection: state.projection }) as never,
1822
useThreadRelationshipShells: (() =>
19-
state.projection === null ? [] : [(state.projection as { thread: unknown }).thread]) as never,
23+
state.projection === null
24+
? []
25+
: [(state.projection as { thread: unknown }).thread, ...state.relatedShells]) as never,
2026
useProjects: (() => []) as never,
2127
}));
2228
vi.mock(import("../../state/environments"), () => ({
@@ -43,6 +49,7 @@ const threadId = ThreadId.make("fork");
4349

4450
function setup() {
4551
state.commandSucceeds = false;
52+
state.relatedShells = [];
4653
state.projection = {
4754
thread: {
4855
id: threadId,
@@ -183,3 +190,58 @@ it("opens an idle child from Lineage when its shell has not been loaded", async
183190
expect(screen.router?.state.location.pathname).toBe("/local/omitted-child"),
184191
);
185192
});
193+
194+
it("shows a lineage thread's full title in its tooltip", async () => {
195+
setup();
196+
const longTitle = "Compare the lineage tooltip against a title that the row truncates";
197+
const sourceThread = {
198+
...(state.projection as { thread: Record<string, unknown> }).thread,
199+
id: "source",
200+
title: longTitle,
201+
lineage: { parentThreadId: null, relationshipToParent: null },
202+
};
203+
state.relatedShells = [sourceThread];
204+
await using _screen = await render(
205+
<ThreadRelationshipsPanel
206+
environmentId={environmentId}
207+
threadId={threadId}
208+
showLineage
209+
showSideChats={false}
210+
/>,
211+
);
212+
213+
await userEvent.hover(page.getByText(longTitle, { exact: true }));
214+
await vi.waitFor(() =>
215+
expect(document.querySelector('[data-slot="tooltip-popup"]')?.textContent).toContain(longTitle),
216+
);
217+
});
218+
219+
it("shows a side chat's full title in its tooltip", async () => {
220+
setup();
221+
const longTitle = "Side chat question with a title that the side chat row truncates";
222+
state.relatedShells = [
223+
{
224+
id: "side",
225+
title: longTitle,
226+
lineage: {
227+
parentThreadId: threadId,
228+
relationshipToParent: "fork",
229+
rootThreadId: threadId,
230+
sideChat: true,
231+
},
232+
},
233+
];
234+
await using _screen = await render(
235+
<ThreadRelationshipsPanel
236+
environmentId={environmentId}
237+
threadId={threadId}
238+
showLineage={false}
239+
showSideChats
240+
/>,
241+
);
242+
243+
await userEvent.hover(page.getByText(longTitle, { exact: true }));
244+
await vi.waitFor(() =>
245+
expect(document.querySelector('[data-slot="tooltip-popup"]')?.textContent).toContain(longTitle),
246+
);
247+
});

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

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,16 @@ function relationshipThreadTitle(input: {
192192
return formatSubagentDisplayTitle(input.title);
193193
}
194194

195+
/** The full title, since the row truncates it, with what a click does. */
196+
function LineageTooltipContent(props: { readonly title: string; readonly hint: string }) {
197+
return (
198+
<>
199+
<span className="block font-medium">{props.title}</span>
200+
<span className="block text-muted-foreground">{props.hint}</span>
201+
</>
202+
);
203+
}
204+
195205
function currentSubagent<Agent extends RuntimeSubagent>(
196206
agent: Agent | undefined,
197207
childThread: OrchestrationV2ThreadShell | null | undefined,
@@ -283,9 +293,14 @@ function RemoteSubagentRow(props: {
283293
</span>
284294
</TooltipTrigger>
285295
<TooltipPopup side="left">
286-
{environment === null
287-
? `Runs on ${remoteChild.label}. Connect to it to open the thread there.`
288-
: `Open on ${remoteChild.label}`}
296+
<LineageTooltipContent
297+
title={title}
298+
hint={
299+
environment === null
300+
? `Runs on ${remoteChild.label}. Connect to it to open the thread there.`
301+
: `Open on ${remoteChild.label}`
302+
}
303+
/>
289304
</TooltipPopup>
290305
</Tooltip>
291306
</li>
@@ -339,9 +354,14 @@ function DelegatedFromRow(props: {
339354
) : null}
340355
</TooltipTrigger>
341356
<TooltipPopup side="left">
342-
{environment === null
343-
? `Delegated from ${label ?? "a linked environment"}. Connect to it to open the parent thread.`
344-
: "Open parent agent"}
357+
<LineageTooltipContent
358+
title={title}
359+
hint={
360+
environment === null
361+
? `Delegated from ${label ?? "a linked environment"}. Connect to it to open the parent thread.`
362+
: "Open parent agent"
363+
}
364+
/>
345365
</TooltipPopup>
346366
</Tooltip>
347367
</li>
@@ -666,7 +686,7 @@ export function ThreadRelationshipsPanel(props: {
666686
childProject={project}
667687
/>
668688
) : (
669-
relationshipHint
689+
<LineageTooltipContent title={threadTitle} hint={relationshipHint} />
670690
);
671691
const relationshipContent = (
672692
<>

0 commit comments

Comments
 (0)