@@ -1440,6 +1440,20 @@ describe("U2 — one action path, and one owner for a pending request", () => {
14401440 } ) ;
14411441
14421442 it ( "U2: activating it opens the drawer, and one choice settles that request once" , function * ( ) {
1443+ const builderArrived = signal ( ) ;
1444+ const releaseBuilder = signal ( ) ;
1445+ // Hold Session resolution before Prompt registers the builder's live turn.
1446+ yield * Agent . around ( {
1447+ * session ( args , next ) {
1448+ const [ routed ] = args ;
1449+ const name = typeof routed === "string" ? routed : routed ?. name ;
1450+ if ( name === "builder" ) {
1451+ builderArrived . publish ( ) ;
1452+ yield * awaiting ( "the builder Session being released" , releaseBuilder . published ) ;
1453+ }
1454+ return yield * next ( ...args ) ;
1455+ } ,
1456+ } ) ;
14431457 const { session, stub } = yield * asking ( {
14441458 review : {
14451459 streaming : true ,
@@ -1448,7 +1462,11 @@ describe("U2 — one action path, and one owner for a pending request", () => {
14481462 build : { streaming : true } ,
14491463 check : { queued : true } ,
14501464 } ) ;
1465+ yield * awaiting ( "the builder reaching its Session gate" , builderArrived . published ) ;
14511466 yield * until ( session , "a request waiting" , ( ) => session . agent . requests . length === 1 ) ;
1467+ expect ( session . agent . turns . some ( ( turn ) => turn . prompt === "build" ) ) . toBe ( false ) ;
1468+ releaseBuilder . publish ( ) ;
1469+ yield * until ( session , "both started turns" , ( ) => started ( session ) === 2 ) ;
14521470 const request = session . agent . requests [ 0 ] ;
14531471 if ( request === undefined ) {
14541472 throw new Error ( "no request was published" ) ;
0 commit comments