@@ -904,39 +904,46 @@ describe("threadHistoryPaging", () => {
904904 expect ( bounded . projection . visibleTurnItems ) . toEqual ( actionable . visibleTurnItems ) ;
905905 } ) ;
906906
907- it ( "keeps agent-only turns visible when checkpoint file lists fill the byte budget" , ( ) => {
908- const items = Array . from ( { length : 3 } , ( _ , turn ) => {
909- const first = makeRow ( turn * 5 ) ;
910- const prompt = {
911- ...first ,
912- item : {
913- ...first . item ,
914- type : "user_message" as const ,
915- createdBy : "agent" as const ,
916- creationSource : "provider" as const ,
917- inputIntent : "turn_start" as const ,
918- messageId : MessageId . make ( `agent-prompt-${ turn } ` ) ,
919- text : `Step ${ turn } ` ,
920- attachments : [ ] ,
921- } ,
922- } as OrchestrationV2ProjectedTurnItem ;
923- return [ prompt , ...Array . from ( { length : 4 } , ( _ , index ) => makeRow ( turn * 5 + index + 1 ) ) ] ;
924- } ) . flat ( ) ;
925- const files = Array . from (
926- { length : 15_000 } ,
927- ( _ , index ) =>
928- `work/ws-${ index % 40 } /.jj/repo/store/extra/${ index . toString ( 16 ) . padStart ( 40 , "0" ) } ` ,
929- ) ;
930- const projection = {
931- ...makeProjection ( items ) ,
932- checkpoints : [ { id : "checkpoint-1" , files } ] ,
933- } as unknown as ReturnType < typeof makeProjection > ;
907+ it . each ( [ false , true ] ) (
908+ "keeps agent-only turns visible when checkpoint file lists fill the byte budget (stored interrupt request: %s)" ,
909+ ( withInterruptRequest ) => {
910+ const items = Array . from ( { length : 3 } , ( _ , turn ) => {
911+ const first = makeRow ( turn * 5 ) ;
912+ const prompt = {
913+ ...first ,
914+ item : {
915+ ...first . item ,
916+ type : "user_message" as const ,
917+ createdBy : "agent" as const ,
918+ creationSource : "provider" as const ,
919+ inputIntent : "turn_start" as const ,
920+ messageId : MessageId . make ( `agent-prompt-${ turn } ` ) ,
921+ text : `Step ${ turn } ` ,
922+ attachments : [ ] ,
923+ } ,
924+ } as OrchestrationV2ProjectedTurnItem ;
925+ return [ prompt , ...Array . from ( { length : 4 } , ( _ , index ) => makeRow ( turn * 5 + index + 1 ) ) ] ;
926+ } ) . flat ( ) ;
927+ const files = Array . from (
928+ { length : 15_000 } ,
929+ ( _ , index ) =>
930+ `work/ws-${ index % 40 } /.jj/repo/store/extra/${ index . toString ( 16 ) . padStart ( 40 , "0" ) } ` ,
931+ ) ;
932+ const base = makeProjection ( items ) ;
933+ const projection = {
934+ ...base ,
935+ turnItems : withInterruptRequest
936+ ? [ interruptItem ( "old-interrupt-req" , "run_interrupt_request" , 0 ) , ...base . turnItems ]
937+ : base . turnItems ,
938+ checkpoints : [ { id : "checkpoint-1" , files } ] ,
939+ } as unknown as ReturnType < typeof makeProjection > ;
934940
935- const bounded = buildBoundedThreadProjection ( { projection, snapshotSequence : 1 } ) ;
941+ const bounded = buildBoundedThreadProjection ( { projection, snapshotSequence : 1 } ) ;
936942
937- expect ( bounded . projection . visibleTurnItems ) . toHaveLength ( items . length ) ;
938- expect ( bounded . hasMoreHistory ) . toBe ( false ) ;
939- } ) ;
943+ expect ( bounded . projection . visibleTurnItems ) . toHaveLength ( items . length ) ;
944+ expect ( bounded . hasMoreHistory ) . toBe ( false ) ;
945+ } ,
946+ ) ;
940947
941948 it ( "keeps paged historical plan detail in the turn item and only status in its artifact" , ( ) => {
942949 const detail = "Implement the historical plan exactly.\n" . repeat ( 1_000 ) ;
0 commit comments