@@ -761,7 +761,33 @@ describe("createAcpReplyProjector", () => {
761761 ] ) ;
762762 } ) ;
763763
764- it ( "truncates oversized turns once and emits one truncation notice" , async ( ) => {
764+ it ( "truncates status updates without splitting surrogate pairs" , async ( ) => {
765+ const { deliveries, projector } = createProjectorHarness (
766+ createLiveCfgOverrides ( {
767+ coalesceIdleMs : 0 ,
768+ maxChunkChars : 256 ,
769+ maxSessionUpdateChars : 64 ,
770+ tagVisibility : {
771+ memory_summary : true ,
772+ } ,
773+ } ) ,
774+ ) ;
775+
776+ await projector . onEvent ( {
777+ type : "status" ,
778+ tag : "memory_summary" ,
779+ text : `${ "a" . repeat ( 62 ) } 🎉${ "b" . repeat ( 10 ) } ` ,
780+ } ) ;
781+
782+ expect ( deliveries ) . toEqual ( [
783+ {
784+ kind : "tool" ,
785+ text : prefixSystemMessage ( `${ "a" . repeat ( 62 ) } …` ) ,
786+ } ,
787+ ] ) ;
788+ } ) ;
789+
790+ it ( "truncates oversized turns at code-point boundaries and emits one notice" , async ( ) => {
765791 const { deliveries, projector } = createProjectorHarness ( {
766792 acp : {
767793 enabled : true ,
@@ -776,7 +802,7 @@ describe("createAcpReplyProjector", () => {
776802
777803 await projector . onEvent ( {
778804 type : "text_delta" ,
779- text : "hello world " ,
805+ text : "abcd😀 tail " ,
780806 tag : "agent_message_chunk" ,
781807 } ) ;
782808 await projector . onEvent ( {
@@ -787,7 +813,7 @@ describe("createAcpReplyProjector", () => {
787813 await projector . flush ( true ) ;
788814
789815 expect ( deliveries ) . toEqual ( [
790- { kind : "block" , text : "hello " } ,
816+ { kind : "block" , text : "abcd " } ,
791817 {
792818 kind : "tool" ,
793819 text : prefixSystemMessage ( "output truncated" ) ,
0 commit comments