@@ -325,17 +325,15 @@ esac
325325 } ) ;
326326 } ) ;
327327
328- it ( "bounds identity lookups so a stalled host ps cannot strand frozen processes " , async ( ) => {
328+ it ( "releases an empty shared- host lease without depending on ps " , async ( ) => {
329329 const input = await fixture ( ) ;
330330 const healthyPs = await fs . readFile ( path . join ( input . bin , "ps" ) , "utf8" ) ;
331- const nonce = await quiesce ( input ) ;
332- const lease = JSON . parse (
333- await fs . readFile ( leasePath ( input . home , input . workspace , nonce ) , "utf8" ) ,
334- ) as { watchdog : { pid : number } } ;
331+ const nonce = await quiesce ( input , true , "1000" ) ;
332+ const leaseFile = leasePath ( input . home , input . workspace , nonce ) ;
333+ const lease = JSON . parse ( await fs . readFile ( leaseFile , "utf8" ) ) as { watchdog : { pid : number } } ;
335334
336- // Every SIGCONT is gated on processIdentity, so an unbounded lookup leaves the whole
337- // lease frozen with no remaining resumer. The stub ignores SIGTERM because that is the
338- // shape execFileSync's timeout alone cannot escape.
335+ // Shared hosts intentionally freeze nothing. A ps outage must not block a no-op release or
336+ // turn a successfully reconciled worker result into an error.
339337 await fs . writeFile ( path . join ( input . bin , "ps" ) , STALLED_PS ) ;
340338 await fs . chmod ( path . join ( input . bin , "ps" ) , 0o755 ) ;
341339
@@ -346,14 +344,22 @@ esac
346344 ) ;
347345
348346 expect ( result . termination ) . toBe ( "exit" ) ;
349- expect ( result . code ) . not . toBe ( 0 ) ;
347+ expect ( result . code ) . toBe ( 0 ) ;
348+ await expect ( fs . access ( leaseFile ) ) . rejects . toThrow ( ) ;
349+ await vi . waitFor (
350+ ( ) => {
351+ expect ( ( ) => process . kill ( lease . watchdog . pid , 0 ) ) . toThrow ( ) ;
352+ } ,
353+ { timeout : 5_000 } ,
354+ ) ;
350355 } finally {
351356 await fs . writeFile ( path . join ( input . bin , "ps" ) , healthyPs ) ;
352357 await fs . chmod ( path . join ( input . bin , "ps" ) , 0o755 ) ;
353- await resume ( input , nonce ) ;
354- await vi . waitFor ( ( ) => {
355- expect ( ( ) => process . kill ( lease . watchdog . pid , 0 ) ) . toThrow ( ) ;
356- } ) ;
358+ try {
359+ process . kill ( lease . watchdog . pid , "SIGTERM" ) ;
360+ } catch {
361+ // Expected once the missing lease has retired it.
362+ }
357363 }
358364 } ) ;
359365
0 commit comments