Files
stack/agents/filbert/work/queue-91/r2/gate.py
T
jason.woltjeandClaude Opus 5.5 097dec3314 filbert: row 91 round 2 gate helper from the Codex seat, kept as evidence (no verdict; decision 130 moved row 91 to Dewey)
Scanned by Sage for secret markers, none. Filbert's Opus seat left it to Sage under decision 130.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 09:29:20 -05:00

45 lines
2.6 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Row 91 round 2 gate. Execute only in the assigned quiet test slot."""
import os, subprocess, signal, pathlib, json, hashlib, datetime
root=pathlib.Path.home()/'filbert-scratch/r91-r2-review/wt'
out=root.parent/'gate';out.mkdir(exist_ok=True)
env=dict(os.environ,TMPDIR=str(pathlib.Path.home()/'filbert-scratch/tmp'),DOCKER_HOST='unix:///nonexistent.sock')
seats=['darkwing','dewey','rocko','researcher','sage']
other=[str(pathlib.Path.home()/f'{seat}-scratch') for seat in seats]+[str(pathlib.Path('/mnt/storage/scratch')/seat) for seat in seats]
def quiet():
busy=[]
for p in pathlib.Path('/proc').iterdir():
if not p.name.isdigit():continue
try:
cwd=str((p/'cwd').resolve(strict=True))
if any(cwd==x or cwd.startswith(x+'/') for x in other):busy.append((p.name,cwd))
except (OSError,RuntimeError):pass
if busy:raise SystemExit('Other scratch processes active: '+repr(busy))
def matches():
m=pathlib.Path('/mnt/storage/src/mosaic-stack/agents/darkwing/work/queue-91/r2/candidate-manifest.sha256')
for line in m.read_text().splitlines():
sha,path=line.split();assert hashlib.sha256((root/path).read_bytes()).hexdigest()==sha,path
quiet();matches();rows=[]
def run(cmd,cwd,log):
quiet();start=datetime.datetime.now(datetime.timezone.utc).isoformat()
with log.open('w') as f:
p=subprocess.Popen(cmd,cwd=cwd,env=env,stdout=f,stderr=subprocess.STDOUT,start_new_session=True)
try:p.wait(timeout=300);rc=p.returncode
except subprocess.TimeoutExpired:
try:os.killpg(p.pid,signal.SIGKILL)
except ProcessLookupError:pass
p.wait();rc='timeout'
return rc,start
for package in ['seat','cli','bus','harness','tasks']:
cwd=root/'packages'/package
files=['tests/'] if package in ['seat','webui'] else [str(p.relative_to(cwd)) for p in sorted((cwd/'tests').glob('*.test.mjs'))]
log=out/f'node-{package}.log';rc,start=run(['node','--test',*files],cwd,log)
stats=[s for s in log.read_text().splitlines() if s.startswith(('ℹ tests ','ℹ pass ','ℹ fail ','# tests ','# pass ','# fail '))]
row={'suite':package,'rc':rc,'started':start,'stats':stats};rows.append(row);print(json.dumps(row),flush=True)
(out/'summary.json').write_text(json.dumps(rows,indent=2)+'\n')
for script in sorted((root/'scripts').glob('test-*.sh')):
log=out/f'{script.stem}.log';rc,start=run(['bash',str(script)],root,log)
row={'suite':script.stem,'rc':rc,'started':start,'last':log.read_text().splitlines()[-1:]};rows.append(row);print(json.dumps(row),flush=True)
(out/'summary.json').write_text(json.dumps(rows,indent=2)+'\n')
matches();print('manifest 8/8 after full gate',flush=True)
raise SystemExit(any(r['rc']!=0 for r in rows))