@@ -110,9 +110,9 @@ describe.each(['mothership', 'workflow', 'browser', 'deploy'])('%s activity', (a
110110 act ( ( ) => trigger . dispatchEvent ( event ) )
111111 expect ( event . defaultPrevented ) . toBe ( true )
112112 expect ( trigger . getAttribute ( 'aria-expanded' ) ) . toBe ( 'true' )
113- expect ( header ( ) ?. textContent ) . toBe ( 'Tool activity ' )
113+ expect ( header ( ) ?. textContent ) . toBe ( 'Reading second ' )
114114 render ( [ tool ( 'first' , 'success' ) , tool ( 'second' , 'success' ) , tool ( 'third' ) ] )
115- expect ( header ( ) ?. textContent ) . toBe ( 'Tool activity ' )
115+ expect ( header ( ) ?. textContent ) . toBe ( 'Reading third ' )
116116 expect ( container . querySelector ( '[data-state="open"]' ) ?. textContent ) . toBe (
117117 'Read firstRead secondReading third'
118118 )
@@ -148,9 +148,7 @@ describe.each(['mothership', 'workflow', 'browser', 'deploy'])('%s activity', (a
148148 advance ( 1500 )
149149 expect ( header ( ) ?. textContent ) . toBe ( label )
150150 render ( [ tool ( 'first' , 'success' ) , tool ( 'second' , status ) ] , false )
151- expect ( header ( ) ?. textContent ) . toBe (
152- agentName === 'mothership' ? 'Read first + 1' : 'Read files'
153- )
151+ expect ( header ( ) ?. textContent ) . toBe ( 'Read first' )
154152 act ( ( ) => container . querySelector < HTMLElement > ( '[role="button"]' ) ?. click ( ) )
155153 expect ( container . querySelector ( '[data-state="open"]' ) ?. textContent ) . toContain (
156154 'Failed reading second'
@@ -163,7 +161,7 @@ describe.each(['mothership', 'workflow', 'browser', 'deploy'])('%s activity', (a
163161 advance ( 100 )
164162 render ( [ tool ( 'first' , 'success' ) , tool ( 'second' ) ] )
165163 render ( [ tool ( 'first' , 'success' ) , tool ( 'second' , 'success' ) ] , false )
166- const completed = agentName === 'mothership' ? ' Read second + 1' : 'Read files '
164+ const completed = ' Read second + 1'
167165 expect ( header ( ) ?. textContent ) . toBe ( completed )
168166 expect ( container . querySelector ( '[class*="shimmer"]' ) ) . toBeNull ( )
169167 advance ( 2000 )
@@ -198,13 +196,13 @@ describe.each(['mothership', 'workflow', 'browser', 'deploy'])('%s activity', (a
198196 'Failed reading firstReading second'
199197 )
200198 render ( [ tool ( 'first' , 'error' ) , tool ( 'second' , 'success' ) ] , false )
201- expect ( header ( ) ?. textContent ) . toBe ( 'Read files ' )
199+ expect ( header ( ) ?. textContent ) . toBe ( 'Read second ' )
202200 expect ( container . querySelector ( '[data-state="open"]' ) ?. textContent ) . toBe (
203201 'Failed reading firstRead second'
204202 )
205203 } )
206204
207- it ( 'shows three distinct actions and keeps the complete history available' , ( ) => {
205+ it ( 'shows the latest concrete action and keeps the complete history available' , ( ) => {
208206 render (
209207 [
210208 tool ( 'first' , 'success' ) ,
@@ -214,7 +212,7 @@ describe.each(['mothership', 'workflow', 'browser', 'deploy'])('%s activity', (a
214212 ] ,
215213 false
216214 )
217- expect ( header ( ) ?. textContent ) . toBe ( 'Read files, searched files, ran commands +1 more ' )
215+ expect ( header ( ) ?. textContent ) . toBe ( 'Read fourth + 3 ' )
218216 const trigger = container . querySelector < HTMLElement > ( '[role="button"]' ) !
219217 act ( ( ) => trigger . click ( ) )
220218 expect ( container . querySelector ( '[data-state="open"]' ) ?. textContent ) . toBe (
@@ -266,9 +264,78 @@ describe.each(['mothership', 'workflow', 'browser', 'deploy'])('%s activity', (a
266264 expect ( header ( ) ?. textContent ) . toBe ( agentName === 'mothership' ? 'Read first' : 'Reading first' )
267265 } )
268266
267+ it ( 'keeps the present-tense intent when expanded while completed collapse uses past tense' , ( ) => {
268+ const activity = {
269+ id : 'inputs' ,
270+ title : 'Checking invoice inputs' ,
271+ completedTitle : 'Checked invoice inputs' ,
272+ }
273+ const renderActivity = ( status : ToolCallStatus , active : boolean ) =>
274+ act ( ( ) =>
275+ root . render (
276+ < AgentGroup
277+ agentName = { agentName }
278+ agentLabel = 'Input review'
279+ activity = { activity }
280+ items = { items ( [
281+ { ...tool ( 'first' , status ) , params : { activity } } ,
282+ tool ( 'second' , status ) ,
283+ ] ) }
284+ isStreaming = { active }
285+ isLaneOpen = { active }
286+ />
287+ )
288+ )
289+ renderActivity ( 'executing' , true )
290+ expect ( header ( ) ?. textContent ) . toBe ( 'Reading second + 1' )
291+ act ( ( ) => container . querySelector < HTMLElement > ( '[role="button"]' ) ! . click ( ) )
292+ expect ( header ( ) ?. textContent ) . toBe ( activity . title )
293+ renderActivity ( 'success' , false )
294+ expect ( header ( ) ?. textContent ) . toBe ( activity . title )
295+ expect ( container . querySelector ( '[data-state="open"]' ) ?. textContent ) . toBe (
296+ 'Read firstRead second'
297+ )
298+ act ( ( ) => container . querySelector < HTMLElement > ( '[role="button"]' ) ! . click ( ) )
299+ expect ( header ( ) ?. textContent ) . toBe ( activity . completedTitle )
300+ } )
301+
269302 if ( agentName === 'mothership' ) {
303+ it ( 'does not claim a merged activity completed when its unlabelled validation failed' , ( ) => {
304+ const activity = {
305+ id : 'review' ,
306+ title : 'Reviewing invoices' ,
307+ completedTitle : 'Reviewed invoices' ,
308+ }
309+ act ( ( ) =>
310+ root . render (
311+ < AgentGroup
312+ agentName = 'mothership'
313+ agentLabel = 'Sim'
314+ activity = { activity }
315+ completedGroupCount = { 2 }
316+ items = { items ( [
317+ { ...tool ( 'read' , 'success' ) , params : { activity : { id : 'first' } } } ,
318+ { ...tool ( 'configure' , 'success' ) , params : { activity } } ,
319+ tool ( 'validation' , 'error' ) ,
320+ ] ) }
321+ />
322+ )
323+ )
324+ expect ( header ( ) ?. textContent ) . toBe ( 'Read configure + 1' )
325+ expect ( header ( ) ?. textContent ) . not . toContain ( activity . completedTitle )
326+ act ( ( ) => container . querySelector < HTMLElement > ( '[role="button"]' ) ! . click ( ) )
327+ expect ( header ( ) ?. textContent ) . toBe ( activity . title )
328+ expect ( container . querySelector ( '[data-state="open"]' ) ?. textContent ) . toContain (
329+ 'Failed reading validation'
330+ )
331+ } )
332+
270333 it ( 'shows active tool names and count, reserving the grouped completed title for lane closure' , ( ) => {
271- const activity : ToolActivity = { id : 'research' , completedTitle : 'Compared files' }
334+ const activity : ToolActivity = {
335+ id : 'research' ,
336+ title : 'Comparing files' ,
337+ completedTitle : 'Compared files' ,
338+ }
272339 const renderActivity = ( tools : ToolCallData [ ] , open : boolean ) =>
273340 act ( ( ) =>
274341 root . render (
@@ -294,7 +361,11 @@ describe.each(['mothership', 'workflow', 'browser', 'deploy'])('%s activity', (a
294361 } )
295362
296363 it ( 'closes the prior activity at normal text while keeping the trailing activity open' , ( ) => {
297- const activity : ToolActivity = { id : 'research' , completedTitle : 'Compared files' }
364+ const activity : ToolActivity = {
365+ id : 'research' ,
366+ title : 'Comparing files' ,
367+ completedTitle : 'Compared files' ,
368+ }
298369 const renderActivity = ( open : boolean ) =>
299370 act ( ( ) =>
300371 root . render (
0 commit comments