TypeScript
Show the full title in lineage/side-chat row tooltips (#28326)
Fatih ÖZDİLb5c83cdb951f
diff --git a/apps/web/src/components/chat/ThreadRelationshipsControl.browser.test.tsx b/apps/web/src/components/chat/ThreadRelationshipsControl.browser.test.tsxindex 3124cc7b3fa..9fc48530c59 100644--- a/apps/web/src/components/chat/ThreadRelationshipsControl.browser.test.tsx+++ b/apps/web/src/components/chat/ThreadRelationshipsControl.browser.test.tsx@@ -1,10 +1,15 @@+import * as DateTime from "effect/DateTime";import { EnvironmentId, NodeId, ThreadId } from "@t3tools/contracts";import * as Cause from "effect/Cause";import { AsyncResult } from "effect/reactivity";import { expect, it, vi } from "vite-plus/test";-import { page } from "vite-plus/test/browser";+import { page, userEvent } from "vite-plus/test/browser";-const state = vi.hoisted(() => ({ projection: null as unknown, commandSucceeds: false }));+const state = vi.hoisted(() => ({+ projection: null as unknown,+ commandSucceeds: false,+ relatedShells: [] as unknown[],+}));vi.mock(import("@effect/atom-react"), async (original) => ({...(await original()),@@ -16,7 +21,9 @@ vi.mock(import("../../state/entities"), () => ({useThreadProjection: ((ref: unknown) =>ref === null ? null : { projection: state.projection }) as never,useThreadRelationshipShells: (() =>- state.projection === null ? [] : [(state.projection as { thread: unknown }).thread]) as never,+ state.projection === null+ ? []+ : [(state.projection as { thread: unknown }).thread, ...state.relatedShells]) as never,useProjects: (() => []) as never,}));vi.mock(import("../../state/environments"), () => ({@@ -43,6 +50,7 @@ const threadId = ThreadId.make("fork");function setup() {state.commandSucceeds = false;+ state.relatedShells = [];state.projection = {thread: {id: threadId,@@ -183,3 +191,155 @@ it("opens an idle child from Lineage when its shell has not been loaded", asyncexpect(screen.router?.state.location.pathname).toBe("/local/omitted-child"),);});++it("shows a lineage thread's full title in its tooltip", async () => {+ setup();+ const longTitle = "Compare the lineage tooltip against a title that the row truncates";+ const sourceThread = {+ ...(state.projection as { thread: Record<string, unknown> }).thread,+ id: "source",+ title: longTitle,+ lineage: { parentThreadId: null, relationshipToParent: null },+ };+ state.relatedShells = [sourceThread];+ await using _screen = await render(+ <ThreadRelationshipsPanel+ environmentId={environmentId}+ threadId={threadId}+ showLineage+ showSideChats={false}+ />,+ );++ await userEvent.hover(page.getByText(longTitle, { exact: true }));+ await vi.waitFor(() =>+ expect(document.querySelector('[data-slot="tooltip-popup"]')?.textContent).toContain(longTitle),+ );+});++it("shows a side chat's full title in its tooltip", async () => {+ setup();+ const longTitle = "Side chat question with a title that the side chat row truncates";+ state.relatedShells = [+ {+ id: "side",+ title: longTitle,+ lineage: {+ parentThreadId: threadId,+ relationshipToParent: "fork",+ rootThreadId: threadId,+ sideChat: true,+ },+ },+ ];+ await using _screen = await render(+ <ThreadRelationshipsPanel+ environmentId={environmentId}+ threadId={threadId}+ showLineage={false}+ showSideChats+ />,+ );++ await userEvent.hover(page.getByText(longTitle, { exact: true }));+ await vi.waitFor(() =>+ expect(document.querySelector('[data-slot="tooltip-popup"]')?.textContent).toContain(longTitle),+ );+});++it("shows a remote subagent's full title in its tooltip even when its environment is unavailable", async () => {+ setup();+ const longTitle = "Investigate a remote subagent issue across linked environments";+ const remoteEnvId = EnvironmentId.make("remote-env");+ const remoteThreadId = ThreadId.make("remote-thread");+ const now = DateTime.makeUnsafe("2026-10-31T20:00:00.000Z");+ state.projection = {+ ...(state.projection as Record<string, unknown>),+ subagents: [+ {+ id: NodeId.make("remote-agent"),+ threadId,+ runId: null,+ parentNodeId: NodeId.make("parent"),+ origin: "app_owned",+ createdBy: "agent",+ driver: "codex",+ providerInstanceId: "provider",+ providerThreadId: null,+ childThreadId: null,+ nativeTaskRef: null,+ prompt: "Run remote task",+ title: longTitle,+ model: null,+ status: "completed",+ result: null,+ startedAt: null,+ completedAt: null,+ updatedAt: now,+ remoteChild: {+ environmentId: remoteEnvId,+ threadId: remoteThreadId,+ label: "Remote VM",+ },+ },+ ],+ };+ await using screen = await render(+ <ThreadRelationshipsPanel+ environmentId={environmentId}+ threadId={threadId}+ showLineage+ showSideChats={false}+ />,+ { router: "/environment/fork" },+ );++ const row = screen.getByRole("button", { name: new RegExp(longTitle) });+ await userEvent.hover(row);+ await vi.waitFor(() =>+ expect(document.querySelector('[data-slot="tooltip-popup"]')?.textContent).toContain(longTitle),+ );+ expect(document.querySelector('[data-slot="tooltip-popup"]')?.textContent).toContain(+ "Runs on Remote VM. Connect to it to open the thread there.",+ );++ await row.click({ force: true });+ expect(screen.router?.state.location.pathname).toBe("/environment/fork");+});++it("shows a delegated-from thread's full title in its tooltip even when its environment is unavailable", async () => {+ setup();+ const longTitle = "Parent task delegated from another machine that has a long description";+ state.projection = {+ ...(state.projection as Record<string, unknown>),+ thread: {+ ...(state.projection as { thread: Record<string, unknown> }).thread,+ delegatedFrom: {+ environmentId: EnvironmentId.make("parent-env"),+ threadId: ThreadId.make("parent-thread"),+ title: longTitle,+ },+ },+ };+ await using screen = await render(+ <ThreadRelationshipsPanel+ environmentId={environmentId}+ threadId={threadId}+ showLineage+ showSideChats={false}+ />,+ { router: "/environment/fork" },+ );++ const row = screen.getByRole("button", { name: new RegExp(longTitle) });+ await userEvent.hover(row);+ await vi.waitFor(() =>+ expect(document.querySelector('[data-slot="tooltip-popup"]')?.textContent).toContain(longTitle),+ );+ expect(document.querySelector('[data-slot="tooltip-popup"]')?.textContent).toContain(+ "Delegated from a linked environment. Connect to it to open the parent thread.",+ );++ await row.click({ force: true });+ expect(screen.router?.state.location.pathname).toBe("/environment/fork");+});diff --git a/apps/web/src/components/chat/ThreadRelationshipsControl.tsx b/apps/web/src/components/chat/ThreadRelationshipsControl.tsxindex a3eaf6e787b..131d77b8aac 100644--- a/apps/web/src/components/chat/ThreadRelationshipsControl.tsx+++ b/apps/web/src/components/chat/ThreadRelationshipsControl.tsx@@ -197,6 +197,16 @@ function relationshipThreadTitle(input: {return formatSubagentDisplayTitle(input.title);}+/** The full title, since the row truncates it, with what a click does. */+function LineageTooltipContent(props: { readonly title: string; readonly hint: string }) {+ return (+ <>+ <span className="block font-medium">{props.title}</span>+ <span className="block text-muted-foreground">{props.hint}</span>+ </>+ );+}+function currentSubagent<Agent extends RuntimeSubagent>(agent: Agent | undefined,childThread: OrchestrationV2ThreadShell | null | undefined,@@ -257,15 +267,16 @@ function RemoteSubagentRow(props: {size="sm"variant="ghost"part="row"- disabled={environment === null}- onClick={() =>+ aria-disabled={environment === null || undefined}+ onClick={() => {+ if (environment === null) return;void navigate({to: "/$environmentId/$threadId",params: buildThreadRouteParams(scopeThreadRef(remoteChild.environmentId, remoteChild.threadId),),- })- }+ });+ }}/>}>@@ -288,9 +299,14 @@ function RemoteSubagentRow(props: {</span></TooltipTrigger><TooltipPopup side="left">- {environment === null- ? `Runs on ${remoteChild.label}. Connect to it to open the thread there.`- : `Open on ${remoteChild.label}`}+ <LineageTooltipContent+ title={title}+ hint={+ environment === null+ ? `Runs on ${remoteChild.label}. Connect to it to open the thread there.`+ : `Open on ${remoteChild.label}`+ }+ /></TooltipPopup></Tooltip></li>@@ -323,13 +339,14 @@ function DelegatedFromRow(props: {size="sm"variant="ghost"part="row"- disabled={environment === null}- onClick={() =>+ aria-disabled={environment === null || undefined}+ onClick={() => {+ if (environment === null) return;void navigate({to: "/$environmentId/$threadId",params: buildThreadRouteParams(parentRef),- })- }+ });+ }}/>}>@@ -344,9 +361,14 @@ function DelegatedFromRow(props: {) : null}</TooltipTrigger><TooltipPopup side="left">- {environment === null- ? `Delegated from ${label ?? "a linked environment"}. Connect to it to open the parent thread.`- : "Open parent agent"}+ <LineageTooltipContent+ title={title}+ hint={+ environment === null+ ? `Delegated from ${label ?? "a linked environment"}. Connect to it to open the parent thread.`+ : "Open parent agent"+ }+ /></TooltipPopup></Tooltip></li>@@ -680,7 +702,7 @@ export function ThreadRelationshipsPanel(props: {childProject={project}/>) : (- relationshipHint+ <LineageTooltipContent title={threadTitle} hint={relationshipHint} />);const relationshipContent = (<>