"""Extract only settings fields, never conversation content, from this task's log."""
import json
from pathlib import Path

root = Path(__file__).resolve().parents[1]
path = Path('/Users/curtispyke/.codex/sessions/2026/09/06/rollout-2026-09-06T19-38-00-01a079ba-cbe7-7c31-a9e2-c5aded19fc93.jsonl')
allowed = ('turn_id', 'model', 'effort', 'cwd')
rows = []
for line in path.open():
    row = json.loads(line)
    if row.get('type') == 'turn_context':
        rows.append({'timestamp': row['timestamp'], 'type': row['type'],
                     'payload': {k: row['payload'].get(k) for k in allowed}})
current = next(r for r in reversed(rows) if r['payload']['turn_id'] == '01a079da-14a7-7062-b3c7-eccd805ee663')
baseline = next(r for r in reversed(rows) if r['payload']['turn_id'] == '01a079cc-7dc0-7041-8deb-09871331946c')
assert current['payload']['model'] == 'gpt-6-astra'
evidence = {'source': 'Codex persisted turn_context run settings; allowlisted fields only',
            'source_filename': path.name, 'current_run': current, 'baseline_run': baseline,
            'ui_screenshot': False,
            'scope': 'This Astra continuation authors and executes the reproduction. Earlier assets remain attributed to their original run.'}
(root/'evidence/run-settings.json').write_text(json.dumps(evidence, indent=2)+'\n')
print(json.dumps(evidence, indent=2))
