"""Synthetic Responses endpoint. No credentials or real model requests are used.
Start with python3 reproduction.py; point an isolated Codex home at this endpoint.
In each checkout: T3CODE_DEV_SEED=0 vp run dev.
Add a synthetic project, start a Codex thread, send "Reply with hello.", and
leave the retry without additional output for at least ten minutes.
Codex config:
model_provider = "proof"
model = "test-model"
[model_providers.proof]
name = "Retry proof"
base_url = "http://127.0.0.1:19729/v1"
wire_api = "responses"
request_max_retries = 100
stream_max_retries = 100
The provider instance config.homePath must name that isolated Codex home.
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
class Handler(BaseHTTPRequestHandler):
    def do_POST(self):
        self.rfile.read(int(self.headers.get("Content-Length", 0)))
        self.send_response(429)
        self.send_header("Content-Type", "application/json")
        self.send_header("Retry-After", "10800")
        self.end_headers()
        self.wfile.write(b'{"error":{"message":"Synthetic rate limit; retry later","type":"rate_limit_error"}}')
HTTPServer(("127.0.0.1", 19729), Handler).serve_forever()
