#!/usr/bin/env bash
set -euo pipefail
# Run in either checkout. Supply a new empty directory as argument 1.
# Requires an already authenticated Codex installation and codex-cli 0.167.2.
export PROOF_SCRATCH="${1:?Supply a new empty scratch directory}"
mkdir -p "$PROOF_SCRATCH/codex"
python3 - <<'PY'
import json, os, pathlib, shutil, tomllib
source = pathlib.Path(os.environ.get('CODEX_HOME', str(pathlib.Path.home()/'.codex')))
target = pathlib.Path(os.environ['PROOF_SCRATCH'])/'codex'
shutil.copyfile(source/'auth.json', target/'auth.json')
original = tomllib.loads((source/'config.toml').read_text())
config = ''
if 'openai_base_url' in original:
    config += 'openai_base_url = '+json.dumps(original['openai_base_url'])+'\n'
config += '[mcp_servers.example_mcp]\nurl = "http://127.0.0.1:9/mcp"\n'
(target/'config.toml').write_text(config)
PY
export CODEX_HOME="$PROOF_SCRATCH/codex"
export T3CODE_DEV_SEED=0
# Pair the browser using the startup link. Use a 1280x800 viewport, light theme.
# Close Thread details to hide host details. Start a recording.
# In the default project, send through Codex:
# List the MCP servers and tools you have available. Do you have any example_mcp tools?
# Wait for completion, scroll to the first message, expand Worked for.
# Capture. On the fix, expand the orange MCP notice to read the full handshake error.
# Redact the private model selector in captures before sharing.
vp run dev
