Files
jason.woltje c012b2e0a3 docs(row333): R1 repair packet, receipts and author log appends (#1831)
Commits agents/codex/work/queue-333/r1-repair/ (packet, receipts, review and author files) and the append-only BUILD-LOG.md and docs/SESSIONS.md entries. The packet INDEX.json sha256 is 3eb9b8d10445aa328be3b854385e4792dda2c5712b19d443d485d1b00a18d0f8 and source-tests.patch is a78bc385801b64be270fb9d6e84672c443738a5fce8eb68f7d2a01359a57a770; the product commit for these bytes is 2627321f. Two packet tarballs are deliberately not committed: packet/baseline-input-bytes.tar.gz and packet/fixed-input-bytes.tar.gz. The secret check reported a -----BEGIN marker in each (members packages/bus/src/credentials.mjs and packages/discord/src/tools.mjs, byte-identical to 503b91e56 and with no PEM body). They stay untracked until the lead rules on them.
2026-11-02 13:37:52 -06:00

21 lines
1.4 KiB
JavaScript

// Own-process priority only. A drift is evidence failure, never a behavior RED.
import { setPriority, getPriority } from 'node:os';
import { appendFileSync } from 'node:fs';
const file=process.env.P5_PRIORITY_TRACE;
const capture=phase=>{let priority=null;try{priority=getPriority(0);}catch{};const row={phase,pid:process.pid,ppid:process.ppid,priority};appendFileSync(file,JSON.stringify(row)+'\n');if(priority!==19)process.exitCode=78;return row;};
try{setPriority(0,19);}catch{appendFileSync(file,JSON.stringify({phase:'setup-failed',pid:process.pid})+'\n');process.exit(78);}
const enter=capture('before-modules');if(enter.priority!==19)process.exit(78);
const direct=process.ppid===Number(process.env.P5_PRIORITY_PARENT) && typeof process.send==='function';
if(direct){
await new Promise(resolve=>{process.once('message',msg=>{if(msg?.p5Priority!=='before-ack'||msg.priority!==19)process.exit(78);resolve();});process.send({p5Priority:'before',...enter});});
if(capture('before-modules-acked').priority!==19)process.exit(78);
process.channel.unref();
}
let sampled=false;
process.on('beforeExit',()=>{
if(sampled)return;sampled=true;
const after=capture('after-modules');
if(direct&&process.connected){process.channel.ref();process.once('message',msg=>{if(msg?.p5Priority!=='after-ack'||msg.priority!==19)process.exitCode=78;process.disconnect();});process.send({p5Priority:'after',...after});}
});
process.on('exit',()=>capture('exit'));