@@ -913,55 +913,10 @@ describe("diagnostic support export", () => {
913913 expect ( combined ) . toContain ( "Attach this zip to the bug report" ) ;
914914 } ) ;
915915
916- it ( "reads a normal-size config file and reports parseOk: true" , async ( ) => {
917- const configPath = path . join ( tempDir , "openclaw.json" ) ;
918- const outputPath = path . join ( tempDir , "support-normal-config.zip" ) ;
919- fs . writeFileSync (
920- configPath ,
921- JSON . stringify ( {
922- gateway : { mode : "local" , port : 18789 } ,
923- logging : { redactSensitive : "off" } ,
924- } ) ,
925- "utf8" ,
926- ) ;
927-
928- await writeDiagnosticSupportExport ( {
929- env : {
930- ...process . env ,
931- HOME : tempDir ,
932- OPENCLAW_CONFIG_PATH : configPath ,
933- OPENCLAW_STATE_DIR : tempDir ,
934- } ,
935- stateDir : tempDir ,
936- outputPath,
937- now : new Date ( "2026-07-18T12:00:00.000Z" ) ,
938- readLogTail : async ( ) => ( {
939- file : path . join ( tempDir , "logs" , "openclaw.log" ) ,
940- cursor : 0 ,
941- size : 0 ,
942- truncated : false ,
943- reset : false ,
944- lines : [ ] ,
945- } ) ,
946- } ) ;
947-
948- const entries = await readZipTextEntries ( outputPath ) ;
949- const configShape = JSON . parse ( entries [ "config/shape.json" ] ?? "{}" ) as {
950- parseOk ?: boolean ;
951- gateway ?: { mode ?: string ; port ?: number } ;
952- } ;
953- expect ( configShape . parseOk ) . toBe ( true ) ;
954- expect ( configShape . gateway ?. mode ) . toBe ( "local" ) ;
955- expect ( configShape . gateway ?. port ) . toBe ( 18789 ) ;
956- } ) ;
957-
958- it ( "handles an oversized config file exceeding the 8 MB read cap gracefully" , async ( ) => {
916+ it ( "finishes the support export when the config exceeds its read limit" , async ( ) => {
959917 const configPath = path . join ( tempDir , "openclaw.json" ) ;
960918 const outputPath = path . join ( tempDir , "support-oversized-config.zip" ) ;
961-
962- // Write a config file slightly over the 8 MB DIAGNOSTIC_CONFIG_MAX_BYTES cap
963- const oversizedContent = Buffer . alloc ( 8 * 1024 * 1024 + 1 , "{" ) ;
964- fs . writeFileSync ( configPath , oversizedContent ) ;
919+ fs . writeFileSync ( configPath , Buffer . alloc ( 8 * 1024 * 1024 + 1 , "{" ) ) ;
965920
966921 await writeDiagnosticSupportExport ( {
967922 env : {
@@ -989,12 +944,16 @@ describe("diagnostic support export", () => {
989944 error ?: string ;
990945 } ;
991946 expect ( configShape . parseOk ) . toBe ( false ) ;
992- // Error message should reference the size cap
993- expect ( JSON . stringify ( configShape ) ) . toMatch ( / e x c e e d | t o o l a r g e | m a x B y t e s | s i z e / i) ;
994-
995- // Other bundle contents are still present despite oversized config
996- expect ( Object . keys ( entries ) . toSorted ( ) ) . toContain ( "diagnostics.json" ) ;
997- expect ( Object . keys ( entries ) . toSorted ( ) ) . toContain ( "manifest.json" ) ;
947+ expect ( configShape . error ) . toContain ( "File exceeds 8388608 bytes" ) ;
948+ expect ( entries [ "config/sanitized.json" ] ) . toBe ( "null\n" ) ;
949+ expect ( Object . keys ( entries ) . toSorted ( ) ) . toEqual ( [
950+ "config/sanitized.json" ,
951+ "config/shape.json" ,
952+ "diagnostics.json" ,
953+ "logs/openclaw-sanitized.jsonl" ,
954+ "manifest.json" ,
955+ "summary.md" ,
956+ ] ) ;
998957
999958 const combined = Object . values ( entries ) . join ( "\n" ) ;
1000959 expect ( combined ) . toContain ( "Attach this zip to the bug report" ) ;
0 commit comments