@@ -217,11 +217,12 @@ describe('Streaming Operations - sleep after', () => {
217217 test ( 'should keep sandbox alive during execStream beyond sleepAfter value' , async ( ) => {
218218 const sandbox = await createTestSandbox ( { sleepAfter : '3s' } ) ;
219219 try {
220- const { workerUrl, headers } = sandbox ;
220+ const { workerUrl } = sandbox ;
221+ const headers = sandbox . headers ( ) ;
221222
222223 const streamResponse = await fetch ( `${ workerUrl } /api/execStream` , {
223224 method : 'POST' ,
224- headers : headers ( ) ,
225+ headers,
225226 body : JSON . stringify ( {
226227 command : "bash -c 'sleep 5; printf done'"
227228 } )
@@ -250,7 +251,7 @@ describe('Streaming Operations - sleep after', () => {
250251 while ( Date . now ( ) < deadline ) {
251252 const stateResponse = await fetch ( `${ workerUrl } /api/state` , {
252253 method : 'GET' ,
253- headers : headers ( ) ,
254+ headers,
254255 signal : AbortSignal . timeout ( 5000 )
255256 } ) ;
256257 expect ( stateResponse . status ) . toBe ( 200 ) ;
@@ -262,6 +263,15 @@ describe('Streaming Operations - sleep after', () => {
262263 await new Promise ( ( resolve ) => setTimeout ( resolve , 1000 ) ) ;
263264 }
264265
266+ // Debugging
267+ if ( status !== 'stopped' && status !== 'stopped_with_code' ) {
268+ console . log (
269+ 'Sandbox Config' ,
270+ await fetch ( `${ workerUrl } /api/config` , { headers } ) . then ( ( r ) =>
271+ r . json ( )
272+ )
273+ ) ;
274+ }
265275 expect ( status ) . toMatch ( / ^ ( s t o p p e d | s t o p p e d _ w i t h _ c o d e ) $ / ) ;
266276 } finally {
267277 await cleanupTestSandbox ( sandbox ) ;
0 commit comments