BYOK Codex Agent: turn ends before write tool_use (read tools work; repro on gpt-5.4 and gpt-5.5; started after 3.9)

Hey, thanks for the detailed report with logs. That makes debugging a lot easier. Here’s what I’m seeing. It looks like the issue isn’t Cursor itself, but two parts of your BYOK setup.

  1. The proxy is dropping large requests. In your logs, the POST to chatgpt.com/backend-api/codex/responses returns EOF when the body is around 400 to 530 KB, and cloudflared shows “context canceled” during the write attempt. Read tools send small payloads and succeed, while write or edit turns send the full context plus the file contents, which is larger, and they get cut off upstream. That matches the “read works, write fails” behavior. Check body size limits and timeouts across the whole chain, including CLIProxyAPI and cloudflared, and increase them.

  2. Your custom model names conflict with built-in ones. You named your models exactly gpt-5.4 and gpt-5.5, which match built-in slugs. Because of the collision, some traffic doesn’t go through your gateway. Rename your custom models to unique names, like gpt-5.5-mycodex, so routing uses your API key plus Override Base URL. Then open Usage and confirm those requests show Type = “User API Key”. If not, routing is still bypassing your endpoint.

About “it broke after 3.9”. The relevant BYOK fix landed before your 3.9.16 build, so 3.9 didn’t introduce this. More likely, 3.9 agent payloads are a bit larger and hit your proxy limits harder.

One more thing. The setup CLIProxyAPI to personal ChatGPT Codex subscription is not a supported path, so some of this behavior isn’t guaranteed.

Try those two steps and tell me if anything changes. If it does, send a Request ID with Privacy Mode turned off, and we can dig deeper.