Retain bounded native probe failure diagnostics before cleanup
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s

Assistant: codex
Assistant-Model: gpt-6-astra
Assistant-Session: 01a07ff8-19d0-7820-b4d0-1353833cb7fc
This commit is contained in:
codex 2026-09-11 12:37:29 +02:00
parent 426a0d5829
commit aaa4b8e686
3 changed files with 47 additions and 5 deletions

View file

@ -73,8 +73,8 @@ def bootstrap(config, dbpath, envelope):
return envelope
def delivery_phase(config, phase, dbpath):
observed = []
def delivery_phase(config, phase, dbpath, receipt):
observed = receipt.setdefault("observed_http_statuses", [])
lose = phase == 'lost-receipt'
if config['sender'] == 'approval-engine':
from approval_engine.store import Engine
@ -160,7 +160,9 @@ def main():
directory = Path('/state/private'); directory.mkdir(mode=0o700,exist_ok=True)
dbpath = directory/'outbox.db'
if len(sys.argv)>1:
receipt = {'status':'passed','http_status':delivery_phase(config,sys.argv[1],dbpath)}
receipt['phase'] = sys.argv[1]
receipt['http_status'] = delivery_phase(config,sys.argv[1],dbpath,receipt)
receipt['status'] = 'passed'
else:
require(not dbpath.exists(), 'fresh_probe_state_required')
envelope = {'id':config['event_id'], 'type':'factory.audit-probe.'+config['run_id'],
@ -168,12 +170,18 @@ def main():
'tenant':'tenant:platform', 'correlation_id':config['run_id'],
'occurred_at':datetime.now(timezone.utc).isoformat(),
'data':{'synthetic':True,'no_human_action':True,'purpose':'audit-sender-acceptance'}}
receipt['phase'] = 'bootstrap'
envelope = bootstrap(config,dbpath,envelope)
phases=[]
for phase in ['lost-receipt','restart-retry']:
receipt['phase'] = phase
child = subprocess.run([sys.executable,__file__,phase],capture_output=True,timeout=30)
require(child.returncode == 0, phase+'_failed')
phases.append(json.loads(child.stdout)['http_status'])
child_receipt = json.loads(child.stdout)
if child.returncode:
receipt['child_error'] = child_receipt.get('error','contained_probe_failed')
receipt['observed_http_statuses'] = child_receipt.get('observed_http_statuses',[])
raise Refused(phase+'_failed')
phases.append(child_receipt['http_status'])
receipt.update(status='passed', sender=config['sender'], event_id=config['event_id'],
run_id=config['run_id'], source_zip_sha256=config['source_zip_sha256'],
http_statuses=phases, process_restart_retry=True, synthetic_outbox_only=True,