@@ -847,22 +847,25 @@ describe("Claude live turn output bounds and result projection", () => {
847847 } ) ;
848848
849849 await expect ( startLiveTurn ( "run-live-oversized-line" , false ) ) . rejects . toThrow (
850- "Claude CLI JSONL line exceeded output limit ." ,
850+ "CLI JSONL line exceeded 8388608 characters; refusing to parse output ." ,
851851 ) ;
852852 } ) ;
853853
854854 it . each ( [
855855 {
856856 name : "a coalesced blank-frame flood" ,
857857 createChunk : ( ) => "\n" . repeat ( 20_001 ) ,
858+ expectedError : "CLI JSONL output exceeded 20000 lines; refusing to parse output." ,
858859 } ,
859860 {
860861 name : "whitespace-only records exceeding the raw budget" ,
861862 createChunk : ( ) => `${ " " . repeat ( 4_300_000 ) } \n${ " " . repeat ( 4_300_000 ) } \n` ,
863+ expectedError : "CLI JSONL output exceeded 8388608 characters; refusing to parse output." ,
862864 } ,
863865 {
864866 name : "valid JSON padded beyond the raw budget" ,
865867 createChunk : ( ) => `${ " " . repeat ( 4_300_000 ) } {}\n${ " " . repeat ( 4_300_000 ) } {}\n` ,
868+ expectedError : "CLI JSONL output exceeded 8388608 characters; refusing to parse output." ,
866869 } ,
867870 {
868871 name : "internal formatting around compacted Claude media" ,
@@ -886,14 +889,32 @@ describe("Claude live turn output bounds and result projection", () => {
886889 } ) . replace ( '"message":' , `"message":${ " " . repeat ( 4_300_000 ) } ` ) ;
887890 return `${ line } \n${ line } \n` ;
888891 } ,
892+ expectedError : "CLI JSONL output exceeded 8388608 characters; refusing to parse output." ,
889893 } ,
890- ] ) ( "rejects $name from the managed Claude live session " , async ( { createChunk } ) => {
894+ ] ) ( "reports the exact limit for $name " , async ( { createChunk, expectedError } ) => {
891895 const live : ReturnType < typeof mockClaudeLiveRun > = mockClaudeLiveRun ( supervisorSpawnMock , {
892896 onWrite : ( ) => live . spawnInput . onStdout ?.( createChunk ( ) ) ,
893897 } ) ;
894898
895- await expect ( startLiveTurn ( "run-live-output-budget" , false ) ) . rejects . toThrow (
896- "Claude CLI turn output exceeded limit." ,
899+ await expect ( startLiveTurn ( "run-live-output-budget" , false ) ) . rejects . toThrow ( expectedError ) ;
900+ } ) ;
901+
902+ it ( "reports backend JSONL parser failures without relabeling them as output limits" , async ( ) => {
903+ mockClaudeLiveRun ( supervisorSpawnMock , {
904+ events : [ { type : "system" , subtype : "init" , session_id : "live-parser-error" } ] ,
905+ } ) ;
906+
907+ await expectRejectsWithFields (
908+ startLiveTurn ( "run-live-parser-error" , false , {
909+ parseJsonlEvent : ( ) => {
910+ throw new Error ( "invalid custom event" ) ;
911+ } ,
912+ } ) ,
913+ {
914+ name : "FailoverError" ,
915+ reason : "format" ,
916+ message : "CLI backend claude-cli JSONL parser failed: invalid custom event" ,
917+ } ,
897918 ) ;
898919 } ) ;
899920
0 commit comments