1+ import * as DateTime from "effect/DateTime" ;
12import { EnvironmentId , NodeId , ThreadId } from "@t3tools/contracts" ;
23import * as Cause from "effect/Cause" ;
34import { AsyncResult } from "effect/reactivity" ;
45import { 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
914vi . 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} ) ) ;
2229vi . mock ( import ( "../../state/environments" ) , ( ) => ( {
@@ -43,6 +50,7 @@ const threadId = ThreadId.make("fork");
4350
4451function 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+ } ) ;
0 commit comments