@@ -1242,7 +1242,7 @@ it.effect.each(["fails", "is interrupted"] as const)(
12421242) ;
12431243
12441244it . effect . each ( [ "failed" , "interrupted" ] as const ) (
1245- "holds a message queued during setup that arrives after the setup %s" ,
1245+ "holds every message that arrives after the setup %s without a worktree " ,
12461246 ( ending ) => {
12471247 let fetchEntered : Deferred . Deferred < void > | null = null ;
12481248 const harness = makeHarness ( {
@@ -1304,9 +1304,9 @@ it.effect.each(["failed", "interrupted"] as const)(
13041304 assert . equal ( held . status , "queued" ) ;
13051305 assert . equal ( held . queueHeld , true ) ;
13061306
1307- // A message the user starts does not release it: the held message would
1308- // run after it in the project checkout.
1309- yield * threads . sendToThread ( {
1307+ // A message sent fresh after the setup ended waits behind it too, rather
1308+ // than starting in the project checkout with no worktree .
1309+ const sentAfter = yield * threads . sendToThread ( {
13101310 projectId,
13111311 commandId : CommandId . make ( `command:launch:late-queued-follow-up-${ ending } :start` ) ,
13121312 threadId : launched . threadId ,
@@ -1317,9 +1317,8 @@ it.effect.each(["failed", "interrupted"] as const)(
13171317 createdBy : "user" ,
13181318 creationSource : "web" ,
13191319 } ) ;
1320- // Nor does the next one, though the run that message started is now the
1321- // latest and carries no workspace preparation.
1322- yield * threads . sendToThread ( {
1320+ assert . equal ( sentAfter . delivery , "queued" ) ;
1321+ const sentAgain = yield * threads . sendToThread ( {
13231322 projectId,
13241323 commandId : CommandId . make ( `command:launch:late-queued-follow-up-${ ending } :again` ) ,
13251324 threadId : launched . threadId ,
@@ -1330,8 +1329,18 @@ it.effect.each(["failed", "interrupted"] as const)(
13301329 createdBy : "user" ,
13311330 creationSource : "web" ,
13321331 } ) ;
1332+ assert . equal ( sentAgain . delivery , "queued" ) ;
13331333 const after = yield * threads . getThreadProjection ( launched . threadId ) ;
13341334 assert . isTrue ( after . runs . find ( ( run ) => run . id === held . id ) ?. queueHeld ) ;
1335+ assert . deepStrictEqual (
1336+ after . runs . slice ( 1 ) . map ( ( run ) => [ run . status , run . queueHeld === true ] ) ,
1337+ [
1338+ [ "queued" , true ] ,
1339+ [ "queued" , true ] ,
1340+ [ "queued" , true ] ,
1341+ ] ,
1342+ ) ;
1343+ assert . equal ( after . thread . worktreePath , null ) ;
13351344 } ) . pipe ( Effect . provide ( harness . layer ) ) ;
13361345 } ,
13371346) ;
0 commit comments