@@ -44,13 +44,21 @@ const run = async (viewport, label) => {
4444 await expect ( first . locator ( ".tool-run-span" ) ) . toHaveText ( "200ms" )
4545 await expect ( first . locator ( ".tool-run-notes" ) ) . toHaveCount ( 0 )
4646 await expect ( first . locator ( ".tool-size" ) ) . toHaveCount ( 0 )
47+ // Per-call size classes, counted per call in canonical order.
48+ await expect ( first . locator ( ".tool-run-sizes" ) ) . toHaveText ( "XS×4" )
49+ await expect ( first . locator ( ".tool-run-sizes" ) ) . toHaveAttribute ( "title" , / ^ S i z e d i s t r i b u t i o n o f 4 c a l l s : 4 X S \n S i z e = c h a r a c t e r s / )
4750 const second = runFor ( "p21_big" )
4851 await expect ( second ) . toHaveAttribute ( "data-timeline-part-ids" , "p21_big,p22_fail,p23_a,p24_b" )
4952 await expect ( second . locator ( ".tool-run-tools" ) ) . toHaveText ( "read ×3 · bash" )
5053 await expect ( second . locator ( ".tool-run-notes" ) ) . toHaveText ( "1 failed" )
5154 // Wall clock from first start to last end, not a sum.
5255 await expect ( second . locator ( ".tool-run-span" ) ) . toHaveText ( "2.0s" )
53- await expect ( second . locator ( ".tool-run-summary" ) ) . toHaveAttribute ( "aria-label" , "4 tool calls, read ×3 · bash, 2.0s wall clock: first call start to last call end, 1 failed" )
56+ await expect ( second . locator ( ".tool-run-sizes" ) ) . toHaveText ( "XS×3 · L×1" )
57+ await expect ( second . locator ( ".tool-run-summary" ) ) . toHaveAttribute ( "aria-label" ,
58+ "4 tool calls, read ×3 · bash, Size distribution of 4 calls: 3 XS, 1 L, 2.0s wall clock: first call start to last call end, 1 failed" )
59+ // Failure notes are quiet text, muted like the span, not a red alert.
60+ expect ( await second . locator ( ".tool-run-notes" ) . evaluate ( ( element ) => getComputedStyle ( element ) . color ) )
61+ . toBe ( await second . locator ( ".tool-run-span" ) . evaluate ( ( element ) => getComputedStyle ( element ) . color ) )
5462 // A shell call that reported a nonzero exit is counted, not split out.
5563 const third = runFor ( "p40_ta" )
5664 await expect ( third ) . toHaveAttribute ( "data-timeline-part-ids" , "p40_ta,p41_tb,p42_tc,p43_fail,p44_sa,p45_sb,p46_sc" )
@@ -119,8 +127,10 @@ const run = async (viewport, label) => {
119127 for ( const id of [ "p61_la" , "p62_lb" , "p63_lc" , "p70_ma" , "p71_mb" ] ) await expect ( chip ( id ) ) . toHaveCount ( engaged ? 1 : 0 )
120128 await shot ( page , `${ label } -completed` )
121129 // The collapsed summary follows member updates rather than a cached snapshot.
122- emitPart ( "msg_1012" , { ...preview . tool ( "p71_mb" , "edit" , { filePath : "/workspace/m-b" } , "Error: stale file" , { status : "error" } ) } )
130+ await expect ( tail . locator ( ".tool-run-sizes" ) ) . toHaveText ( "XS×5" )
131+ emitPart ( "msg_1012" , { ...preview . tool ( "p71_mb" , "edit" , { filePath : "/workspace/m-b" } , "Error: stale file " + "e" . repeat ( 12_000 ) , { status : "error" } ) } )
123132 await expect ( tail . locator ( ".tool-run-notes" ) ) . toHaveText ( "1 failed" )
133+ await expect ( tail . locator ( ".tool-run-sizes" ) ) . toHaveText ( "XS×4 · L×1" )
124134 await expect ( tail . locator ( ".tool-run-span" ) ) . toHaveText ( "2.0s" )
125135 if ( engaged ) await tail . locator ( ".tool-run-summary" ) . click ( )
126136 await first . locator ( ".tool-run-summary" ) . click ( )
@@ -291,6 +301,7 @@ const many = async () => {
291301 const runs = page . locator ( ".tool-run" )
292302 await expect ( runs ) . toHaveCount ( 1 , { timeout : 30_000 } )
293303 await expect ( runs . first ( ) . locator ( ".tool-run-kind" ) ) . toHaveText ( "300 tool calls" )
304+ await expect ( runs . first ( ) . locator ( ".tool-run-sizes" ) ) . toHaveText ( "XS×300" )
294305 await expect ( runs . first ( ) . locator ( ".tool-run-tools" ) ) . toHaveText ( "read ×60 · bash ×60 · edit ×60 · grep ×60 · task ×60" )
295306 await expect ( runs . first ( ) . locator ( ".tool-run-span" ) ) . toHaveText ( "499ms" )
296307 await runs . first ( ) . locator ( ".tool-run-summary" ) . click ( )
@@ -306,17 +317,18 @@ const many = async () => {
306317// At 320px a run with every kind of status note wraps inside the viewport, LTR and RTL.
307318const narrow = async ( ) => {
308319 const small = await startToolRunsPreview ( 0 )
309- const untimed = small . tool ( "prt_n4" , "read" , { filePath : "/workspace/n4" } , "n4" )
320+ const untimed = small . tool ( "prt_n4" , "read" , { filePath : "/workspace/n4" } , "L" . repeat ( 15_000 ) )
310321 delete untimed . state . time . end
311322 small . fixture . messages = [
312323 { info : { id : "msg_n0000" , sessionID : "ses_a" , role : "user" , agent : "build" , model : { providerID : "fixture" , modelID : "test" } , time : { created : 1 } } ,
313324 parts : [ { id : "msg_n0000_text" , messageID : "msg_n0000" , sessionID : "ses_a" , type : "text" , text : "Mixed outcomes." } ] } ,
314325 small . assistant ( "msg_n0001" , "msg_n0000" , [
315326 small . tool ( "prt_n1" , "bash" , { command : "false" } , "boom" , { metadata : { exit : 1 } } ) ,
316- small . tool ( "prt_n2" , "apply_patch" , { patchText : "x" } , "Tool execution aborted" , { status : "error" } ) ,
317- small . tool ( "prt_n3" , "bash" , { command : "sleep" } , "" , { metadata : { exit : null } } ) ,
327+ small . tool ( "prt_n2" , "apply_patch" , { patchText : "x" } , "Tool execution aborted " + "s" . repeat ( 2_000 ) , { status : "error" } ) ,
328+ small . tool ( "prt_n3" , "bash" , { command : "sleep" } , "M" . repeat ( 5_000 ) , { metadata : { exit : null } } ) ,
318329 untimed ,
319- small . tool ( "prt_n5" , "webfetch" , { url : "https://example.com/a-very-long-url-segment" } , "page" ) ,
330+ small . tool ( "prt_n5" , "webfetch" , { url : "https://example.com/a-very-long-url-segment" } , "X" . repeat ( 40_000 ) ) ,
331+ small . tool ( "prt_n6" , "bash" , { command : "yes" } , "y" , { metadata : { exit : 0 , truncated : true } } ) ,
320332 ] , { info : { finish : "tool-calls" } } ) ,
321333 small . assistant ( "msg_n0002" , "msg_n0000" , [ small . text ( "prt_n_done" , "Done." ) ] , { info : { finish : "stop" } } ) ,
322334 ]
@@ -330,25 +342,30 @@ const narrow = async () => {
330342 const runs = page . locator ( ".tool-run" )
331343 await expect ( runs ) . toHaveCount ( 1 , { timeout : 30_000 } )
332344 await expect ( runs . first ( ) . locator ( ".tool-run-notes" ) ) . toHaveText ( "1 failed · 1 interrupted · 1 exit unknown · 1 untimed" )
345+ await expect ( runs . first ( ) . locator ( ".tool-run-sizes" ) ) . toHaveText ( "XS×1 · S×1 · M×1 · L×1 · XL×1 · ?×1" )
346+ await expect ( runs . first ( ) . locator ( ".tool-run-sizes" ) ) . toHaveAttribute ( "title" , / 1 n o t s i z e d \( l o w e r b o u n d o n l y : i n p u t w a l k c a p p e d o r o u t p u t t r u n c a t e d × 1 \) / )
333347 await expect ( runs . first ( ) . locator ( ".tool-run-span" ) ) . toHaveText ( / ^ ≥ / )
334348 for ( const dir of [ "ltr" , "rtl" ] ) {
335349 await page . evaluate ( ( value ) => { document . documentElement . dir = value } , dir )
336350 await runs . first ( ) . scrollIntoViewIfNeeded ( )
337351 const box = await runs . first ( ) . locator ( ".tool-run-summary" ) . evaluate ( ( element ) => {
338352 const rect = element . getBoundingClientRect ( )
339353 const notes = element . querySelector ( ".tool-run-notes" )
354+ const sizes = element . querySelector ( ".tool-run-sizes" )
340355 return { left : rect . left , right : rect . right , overflow : element . scrollWidth - element . clientWidth ,
341- notesClipped : notes . scrollWidth - notes . clientWidth , width : document . documentElement . clientWidth ,
356+ notesClipped : notes . scrollWidth - notes . clientWidth , sizesClipped : sizes . scrollWidth - sizes . clientWidth , width : document . documentElement . clientWidth ,
342357 children : [ ...element . children ] . map ( ( child ) => { const r = child . getBoundingClientRect ( ) ; return [ r . left , r . right ] } ) }
343358 } )
344359 expect ( box . overflow ) . toBeLessThanOrEqual ( 0 )
345360 expect ( box . notesClipped ) . toBeLessThanOrEqual ( 0 )
361+ expect ( box . sizesClipped ) . toBeLessThanOrEqual ( 0 )
346362 expect ( box . left ) . toBeGreaterThanOrEqual ( 0 )
347363 expect ( box . right ) . toBeLessThanOrEqual ( box . width )
348364 for ( const [ left , right ] of box . children ) expect ( left >= box . left - 1 && right <= box . right + 1 ) . toBe ( true )
349365 // English notes and the span keep their reading order in an RTL layout.
350366 expect ( await runs . first ( ) . locator ( ".tool-run-notes" ) . evaluate ( ( element ) => getComputedStyle ( element ) . direction ) ) . toBe ( "ltr" )
351367 expect ( await runs . first ( ) . locator ( ".tool-run-span" ) . evaluate ( ( element ) => getComputedStyle ( element ) . direction ) ) . toBe ( "ltr" )
368+ expect ( await runs . first ( ) . locator ( ".tool-run-sizes" ) . evaluate ( ( element ) => getComputedStyle ( element ) . direction ) ) . toBe ( "ltr" )
352369 await shot ( page , `narrow-${ dir } ` )
353370 }
354371 } finally {
0 commit comments