Skip to content

Requests take minutes to start responding, even for small prompts #348

Description

@jay-tau

Environment

  • copilot-api 1.14.18
  • Node v26.4.0, Linux, run as a systemd service: cao start --port 4141
  • Clients: Codex Desktop and Codex CLI — model_provider = copilot_api, wire_api = "responses"
  • Models: gpt-5.6-sol / gpt-5.6-terra / gpt-5.6-luna
  • useResponsesApiWebSocket: false
  • Usually 4–8 Codex sessions active at once

What happens

Codex sits on "thinking" for a long time before any output appears. It happens even for small prompts — a short follow-up takes about as long as a large context turn.

Over one day (955 requests):

  • 223 (23%) took over 1 minute
  • 58 (6%) took over 5 minutes

Wait time is roughly flat regardless of request size:

request body requests median wait
<100 KB 24 26s
100–400 KB 249 28s
400–800 KB 267 25s
>800 KB 225 34s

The gateway stays up throughout — no crash, no restart. It clears on its own and returns later, and is noticeably worse when several Codex sessions are active at once.

What I think is happening

I think most of the wait is spent inside the gateway before the request is sent upstream, rather than the model being slow. I may be misreading this.

I attached a read-only listener to undici's diagnostics_channel via NODE_OPTIONS=--require, so copilot-api's own code is unmodified. Per upstream request it records:

  • ms_to_wirefetch() called → request bytes written
  • ms_upstream — request bytes written → response headers received

Across 833 requests: median 25s before the request is sent, versus median 6s waiting on the response — roughly 80% of total time spent before anything goes out.

Worst cases seen:

body=515KB  ms_to_wire=217s  ms_upstream= 7s
body=869KB  ms_to_wire=205s  ms_upstream=19s
body=390KB  ms_to_wire=203s  ms_upstream= 6s
body=139KB  ms_to_wire=177s  ms_upstream= 3s

Small requests are affected the same way:

body=33KB  ms_to_wire=22s  ms_upstream=1s
body=62KB  ms_to_wire=44s  ms_upstream=1s
body=67KB  ms_to_wire=62s  ms_upstream=2s

Data

https://gist.github.com/jay-tau/085b77a1cf11d1f161d02872ab54b7e3

  • observer.cjs.txt — the listener used
  • cao-timings.txt — 859 requests, per-request timings
  • cao-gateway-log.txt — gateway log with verbose off (request/response lines only, no payloads)

Happy to run different measurements or test a patch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions