@@ -1540,7 +1540,7 @@ it.effect.each(["fails", "is interrupted"] as const)(
15401540) ;
15411541
15421542it . effect . each ( [ "failed" , "interrupted" ] as const ) (
1543- "holds a message queued during setup that arrives after the setup %s" ,
1543+ "holds every message that arrives after the setup %s without a worktree " ,
15441544 ( ending ) => {
15451545 let fetchEntered : Deferred . Deferred < void > | null = null ;
15461546 const harness = makeHarness ( {
@@ -1602,9 +1602,9 @@ it.effect.each(["failed", "interrupted"] as const)(
16021602 assert . equal ( held . status , "queued" ) ;
16031603 assert . equal ( held . queueHeld , true ) ;
16041604
1605- // A message the user starts does not release it: the held message would
1606- // run after it in the project checkout.
1607- yield * threads . sendToThread ( {
1605+ // A message sent fresh after the setup ended waits behind it too, rather
1606+ // than starting in the project checkout with no worktree .
1607+ const sentAfter = yield * threads . sendToThread ( {
16081608 projectId,
16091609 commandId : CommandId . make ( `command:launch:late-queued-follow-up-${ ending } :start` ) ,
16101610 threadId : launched . threadId ,
@@ -1615,6 +1615,7 @@ it.effect.each(["failed", "interrupted"] as const)(
16151615 createdBy : "user" ,
16161616 creationSource : "web" ,
16171617 } ) ;
1618+ assert . equal ( sentAfter . delivery , "queued" ) ;
16181619 yield * threads . dispatch ( {
16191620 type : "message.dispatch" ,
16201621 commandId : CommandId . make ( `command:launch:late-queued-follow-up-${ ending } :wake` ) ,
@@ -1630,9 +1631,7 @@ it.effect.each(["failed", "interrupted"] as const)(
16301631 assert . equal ( wake . status , "queued" ) ;
16311632 assert . isTrue ( wake . queueHeld ) ;
16321633
1633- // Nor does the next one, though the run that message started is now the
1634- // latest and carries no workspace preparation.
1635- yield * threads . sendToThread ( {
1634+ const sentAgain = yield * threads . sendToThread ( {
16361635 projectId,
16371636 commandId : CommandId . make ( `command:launch:late-queued-follow-up-${ ending } :again` ) ,
16381637 threadId : launched . threadId ,
@@ -1643,8 +1642,19 @@ it.effect.each(["failed", "interrupted"] as const)(
16431642 createdBy : "user" ,
16441643 creationSource : "web" ,
16451644 } ) ;
1645+ assert . equal ( sentAgain . delivery , "queued" ) ;
16461646 const after = yield * threads . getThreadProjection ( launched . threadId ) ;
16471647 assert . isTrue ( after . runs . find ( ( run ) => run . id === held . id ) ?. queueHeld ) ;
1648+ assert . deepStrictEqual (
1649+ after . runs . slice ( 1 ) . map ( ( run ) => [ run . status , run . queueHeld === true ] ) ,
1650+ [
1651+ [ "queued" , true ] ,
1652+ [ "queued" , true ] ,
1653+ [ "queued" , true ] ,
1654+ [ "queued" , true ] ,
1655+ ] ,
1656+ ) ;
1657+ assert . equal ( after . thread . worktreePath , null ) ;
16481658 } ) . pipe ( Effect . provide ( harness . layer ) ) ;
16491659 } ,
16501660) ;
0 commit comments