#!/usr/bin/env python3
"""Write synthetic T3 settings before starting an isolated reproduction server.
Arguments: checkout, empty-authorized-Codex-home-A, empty-authorized-Codex-home-B.
Credentials are provided locally and are never embedded in this script.
"""
import json
import pathlib
import sys
checkout, home_a, home_b = map(pathlib.Path, sys.argv[1:])
settings = {
    'defaultModelSelection': {'instanceId': 'codex', 'model': 'gpt-6.1-sol'},
    'providerInstances': {
        instance: {
            'driver': 'codex', 'displayName': label, 'enabled': True,
            'config': {'homePath': str(home.resolve())},
        }
        for instance, label, home in [
            ('codex', 'Codex', home_a), ('codex_b', 'Codex B', home_b)
        ]
    },
}
state = checkout / '.t3' / 'userdata'
state.mkdir(parents=True, exist_ok=True)
(state / 'settings.json').write_text(json.dumps(settings))
