@@ -1352,6 +1352,33 @@ describe('BlockExecutor streaming pump', () => {
13521352 )
13531353 } )
13541354
1355+ it ( 'forwards the stable block ID for streams from expanded branch nodes' , async ( ) => {
1356+ const handler = createAgentEventsStreamingHandler ( {
1357+ events : [ { type : 'text_delta' , text : 'branch answer' , turn : 'final' } ] ,
1358+ } )
1359+ const { executor, block, state } = createExecutor ( handler )
1360+ const ctx = createContext ( state )
1361+ const node = createNode ( block )
1362+ node . id = `${ block . id } ₍0₎`
1363+ node . metadata = {
1364+ isParallelBranch : true ,
1365+ subflowId : 'parallel-1' ,
1366+ subflowType : 'parallel' ,
1367+ originalBlockId : block . id ,
1368+ branchIndex : 0 ,
1369+ }
1370+ let streamedBlockId : string | undefined
1371+
1372+ ctx . onStream = async ( streamingExec ) => {
1373+ streamedBlockId = streamingExec . blockId
1374+ await new Response ( streamingExec . stream ) . text ( )
1375+ }
1376+
1377+ await executor . execute ( ctx , node , block )
1378+
1379+ expect ( streamedBlockId ) . toBe ( block . id )
1380+ } )
1381+
13551382 it ( 'drains without onStream and still persists answer content' , async ( ) => {
13561383 const handler = createAgentEventsStreamingHandler ( {
13571384 events : [ { type : 'text_delta' , text : 'offline answer' , turn : 'final' } ] ,
0 commit comments