feat(automation): add durable runner and signed approval recovery

This commit is contained in:
cesnimda
2026-10-29 14:33:50 +01:00
parent 4da3939547
commit 607ee1853e
29 changed files with 29694 additions and 7 deletions
+31
View File
@@ -0,0 +1,31 @@
"""Subprocess protocol double, used only in a disposable test checkout. No model/network."""
import json
from pathlib import Path
import subprocess
import sys
import time
args = sys.argv[1:]
if args[0] == 'exec':
prompt = sys.stdin.read()
if Path('simulate-interruption').exists():
sys.exit(17)
if Path('simulate-timeout').exists():
time.sleep(60)
if '--sandbox' not in args or args[args.index('--sandbox') + 1] != 'workspace-write':
sys.exit(18)
checkpoint = 'work'
Path('result.txt').write_text('subprocess worker output', encoding='utf-8')
Path('observed-prompt.txt').write_text(prompt, encoding='utf-8')
result = dict(outcome='complete', summary='synthetic subprocess', blockers=[], requestedApprovals=[], checkpoint=checkpoint)
Path(args[args.index('--output-last-message') + 1]).write_text(json.dumps(result), encoding='utf-8')
print(json.dumps(dict(type='thread.started', thread_id='synthetic-thread-id')))
print(json.dumps(dict(type='turn.completed')))
elif args[0] == 'sandbox':
# Remove known sandbox switches; execute the real deterministic check in the disposable repo.
index = 1
while args[index] in ('-C', '-c'):
index += 2
sys.exit(subprocess.run(args[index:], cwd=Path.cwd()).returncode)
else:
sys.exit(19)