@@ -1343,12 +1343,43 @@ describe("mapCodexNotification — streaming deltas", () => {
13431343 expect ( text [ 0 ] ) . toMatchObject ( { type : "content.delta" , stream : "reasoning_text" } ) ;
13441344 const summary = mapCodexNotification (
13451345 "item/reasoning/summaryTextDelta" ,
1346- { threadId : "x" , itemId : "rs-1" , delta : "summary" } ,
1346+ { threadId : "x" , itemId : "rs-1" , delta : "summary" , summaryIndex : 0 } ,
13471347 state ,
13481348 ) ;
13491349 expect ( summary [ 0 ] ) . toMatchObject ( { type : "content.delta" , stream : "reasoning_text" } ) ;
13501350 } ) ;
13511351
1352+ it ( "preserves boundaries between indexed reasoning summary parts" , ( ) => {
1353+ const state = createCodexMapperState ( "t-codex" ) ;
1354+ mapCodexNotification (
1355+ "item/started" ,
1356+ { threadId : "x" , itemId : "rs-1" , item : { id : "rs-1" , type : "reasoning" } } ,
1357+ state ,
1358+ ) ;
1359+
1360+ const events = [
1361+ ...mapCodexNotification (
1362+ "item/reasoning/summaryTextDelta" ,
1363+ { threadId : "x" , itemId : "rs-1" , delta : "**Planning sidebar**" , summaryIndex : 0 } ,
1364+ state ,
1365+ ) ,
1366+ ...mapCodexNotification (
1367+ "item/reasoning/summaryTextDelta" ,
1368+ { threadId : "x" , itemId : "rs-1" , delta : "**Refining" , summaryIndex : 1 } ,
1369+ state ,
1370+ ) ,
1371+ ...mapCodexNotification (
1372+ "item/reasoning/summaryTextDelta" ,
1373+ { threadId : "x" , itemId : "rs-1" , delta : " removal**" , summaryIndex : 1 } ,
1374+ state ,
1375+ ) ,
1376+ ] ;
1377+
1378+ expect (
1379+ events . flatMap ( ( event ) => ( event . type === "content.delta" ? [ event . delta ] : [ ] ) ) . join ( "" ) ,
1380+ ) . toBe ( "**Planning sidebar**\n\n**Refining removal**" ) ;
1381+ } ) ;
1382+
13521383 it ( "maps MCP tool progress into the existing tool payload" , ( ) => {
13531384 const state = createCodexMapperState ( "t-codex" ) ;
13541385 mapCodexNotification (
0 commit comments