interplane.Get Omega
Read in your language

omega-tool-model

First-party Omega tool-use model source, serving harnesses, and verification records

Brought by drakestapleton

branch main Branches Tags History

omega-tool-model / deployment / verify.py

40 lines · 2569 bytes Raw Blame History
1import os
2"""External deployment check; never executes model-generated actions."""
3from pathlib import Path
4import hashlib,json,subprocess,time
5R=Path(__file__).resolve().parent
6P=R.parent/'tool-omega-20261104'
7D=(Path(os.path.expanduser('~')) / '/.local/share/omega-tool-model/round40'.lstrip('/'))
8B=D/'omega-tool-model'
9rows=[]
10def run(label,cmd,data=None):
11 start=time.monotonic()
12 p=subprocess.run([str(x) for x in cmd],input=data,capture_output=True,timeout=120)
13 rec=dict(label=label,command=[str(x) for x in cmd],returncode=p.returncode,stdout=p.stdout.decode(errors='replace'),stderr=p.stderr.decode(errors='replace'),seconds=time.monotonic()-start)
14 if data is not None: rec['stdin_sha256']=hashlib.sha256(data).hexdigest()
15 rows.append(rec)
16 (R/'verification-commands.json').write_text(json.dumps(rows,indent=2)+'\n')
17 return p
18jobs=json.loads((P/'round40/final-selected.json').read_text())
19turns=jobs[0]['turns']
20demo=run('candidate-demo',[B,'--demo'])
21assert demo.returncode==0 and demo.stdout.decode()==turns[0]['raw'], rows[-1]
22(R/'one-shot.json').write_text(json.dumps(dict(prompt=turns[0]['prompt'],actual=demo.stdout.decode(),expected=turns[0]['raw'],pass_=True),indent=2)+'\n')
23for index,turn in enumerate(turns):
24 candidate=run(f'candidate-stage-{index}',[B],turn['prompt'].encode())
25 reference=run(f'reference-stage-{index}',[P/'build/sample',D/'model.ck',160,turn['prompt'],D/'merges.bin'])
26 assert candidate.returncode==reference.returncode==0
27 assert candidate.stdout==reference.stdout==turn['raw'].encode(),rows[-2:]
28 assert not candidate.stderr and not reference.stderr
29for label,data,expected in [('empty',b'',2),('embedded-zero',b'Task:\x00Answer:\n',2),('byte-overflow',b'x'*4001,2),('token-overflow',(b'! '*600),3)]:
30 q=run(label,[B],data)
31 assert q.returncode==expected,rows[-1]
32q=run('wrong-option',[B,'--unknown'])
33assert q.returncode==2
34q=run('help',[B,'--help'])
35assert q.returncode==0 and b'No tools are executed' in q.stdout
36pins=json.loads((R/'build-receipt.json').read_text())['pins']
37for name,want in pins.items():
38 assert hashlib.sha256(Path(name).read_bytes()).hexdigest()==want,name
39(R/'verification.json').write_text(json.dumps(dict(passed=True,demonstration_passed=True,repair_stage_parity=len(turns),refusal_checks=5,help_passed=True,all_pins_unchanged=True,scope='Model-response parity only; no tools executed, no new independent accuracy claim.'),indent=2)+'\n')
40print('Passed: real one-shot, all five repair-stage responses match, input refusals and asset hashes verified.')