Files
stack/packages/cli/tests/fixtures/model-clock-probe.mjs
jason.woltje 362893d043 feat: integrate reviewed proxy page and managed model keys
Source-candidate: poe d9a564e6d20f5f0fd75ce45b12cbbf8bb4c9d568\nSource-candidate: magica38ba5762b06716db1dee00d0afec162656488f5c\nValidated321whole-file phase plus whole bus1349/model-proxy100/webui490; final gate tooling checks pending, not landed.
2026-10-26 12:04:21 -05:00

14 lines
917 B
JavaScript

// Isolated owned FIFO probe: parent bounds/kills this exact child if I/O blocks.
import fs from 'node:fs';
import { join } from 'node:path';
import { watchModelOutput } from '../../src/model-stall.mjs';
import { getPriority, setPriority } from 'node:os';
// Enforce the gate's existing nice19 contract on this owned probe itself.
setPriority(0, 19);
let stops=0;const receipts=[];
const watch=watchModelOutput({runDir:process.argv[2],armAtFirstTurn:true,seconds:60,keyId:'0123456789ab',stop:async()=>{stops++;},receipt:r=>receipts.push(r)});
const clock=setTimeout(watch.cancel,100);
await watch.done;clearTimeout(clock);
const marker=join(process.argv[2],'proxy-first-turn'),openMarkerFds=fs.readdirSync('/proc/self/fd').filter(n=>{try{return fs.readlinkSync('/proc/self/fd/'+n)===marker;}catch{return false;}}).length;
process.stdout.write(JSON.stringify({stops,receipts,nice:getPriority(0),openMarkerFds})+'\n');