Skip to content

Codex Desktop re-sends generated-image history in subsequent /responses turns, growing requests to 27 MB and TTFT to 20s+ #33760

Open

Description

@hdyusf

Codex version

Observed client User-Agent:

Codex Desktop/0.145.0-alpha.18 (Mac OS 26.5.1; arm64) unknown (codex_chatgpt_android_remote; dev)

Platform: macOS 26.5.1, Apple Silicon (arm64).

Issue

After generating images in a Codex Desktop thread, subsequent /responses turns appear to retain and re-send large inline image/history payloads. The inbound request body grows from roughly 100 KB to tens of megabytes, and time to first semantic output rises from roughly 2-4 seconds to 13-28 seconds.

This was measured at a relay immediately after receiving the Codex Desktop request and before model mapping or upstream forwarding. Raw request bodies were not retained or inspected; only sanitized sizes, upstream-reported usage, and timing metadata were analyzed.

Sanitized production evidence

Same Codex Desktop client, same thread workflow, same OAuth account, same model (gpt-5.6-sol), and reasoning_effort=medium:

Stage Inbound request size Cached context reported by upstream TTFT
Before image generation 104-134 KB 25k-31k tokens 1.26-4.09 s
After first generated image 18.45-21.04 MB 171k-204k tokens 12.7-15.7 s
After second generated image 27.2-27.7 MB 206k-217k tokens 13.4-27.75 s
New/smaller context during the same period 543-590 KB 125k-135k tokens 1.79-4.62 s

Across the observed requests:

  • cached context below 50k tokens: TTFT median 2.22 s
  • cached context above 150k tokens: TTFT median 14.87 s, p90 20.46 s
  • correlation between TTFT and total reported context size: approximately 0.83

The large requests were not explained by relay contention:

  • no overlapping request on the OAuth account for the initial affected samples
  • no account proxy
  • no rate limit or overload state
  • 5-hour quota usage was 0%; 7-day usage was low
  • the relay starts TTFT timing only after the inbound body has already been received

The request-size jump occurred immediately after successful image-generation turns. Later turns that did not generate another image still carried 18-27 MB inbound bodies.

Steps to reproduce

  1. Open Codex Desktop on macOS.
  2. Start a thread using the Responses API path.
  3. Generate one or more images in that thread.
  4. Continue with ordinary text turns in the same thread.
  5. Observe the serialized /responses request size for each subsequent turn and time to first semantic output.
  6. Compare with a new thread or compact context.

Expected behavior

Generated image bytes should not be repeatedly embedded in every later model request when the same image is already stored locally or represented in prior response state.

Possible approaches include:

  • keep generated image bytes out of hot conversation history and store a durable reference/content hash instead;
  • use server-side continuation (previous_response_id) where supported;
  • deduplicate or compact old generated-image content before serializing subsequent turns;
  • upload image content once and reuse a stable reference;
  • expose diagnostics for serialized request size and context composition.

Subsequent text turns should remain bounded in payload size and should not inherit multi-megabyte image bytes unless the image is explicitly needed again.

Related issues

This appears related to the broader inline-image amplification described in:

However, this report covers a distinct runtime impact: the serialized outbound /responses request itself grows to 18-27 MB after image generation, causing sustained model TTFT degradation on later turns, even when the Desktop UI remains responsive.

I can provide additional sanitized per-turn timing and size data if useful, but cannot share raw request bodies because they contain private conversation and image content.

Activity

  1. xiao-do-do commented on Oct 2, 2026

    @xiao-do-do

    I am also experiencing this on macOS during multi-round image generation. The impact extends beyond slower first-token times: image-heavy conversations can enter repeated reconnects and then remain extremely slow after HTTP/SSE fallback.

    I am also affected on macOS while iterating on image generation across multiple turns. After reconnect attempts reach 5/5, the transport falls back to HTTP/SSE. Continuing the same conversation then causes repeated large image uploads, heavy bandwidth use, and substantial delays between turns. This severely affects Codex conversation efficiency and makes iterative design work difficult, including ordinary follow-up messages after image generation.

    Please correlate this with #38846 (WebSocket close code 1009 / message too big), #24550 (large inline-image history causing WebSocket fallback), and #23665 (recovery from HTTP fallback). A 1009 close and the subsequent HTTP/SSE fallback are different stages of the failure: an oversized WebSocket message can trigger the disconnect, and fallback can then expose the repeated full-history upload cost. I have not captured the close code from my own session, so I am reporting the retry/fallback and bandwidth symptoms rather than claiming a confirmed 1009 reproduction.

    Please investigate generated-image persistence and the subsequent request-construction path together. Saving a generated image locally should allow a compact reusable reference rather than retaining full image bytes in every later request. A supported way to drop stale image payloads while preserving the text conversation would make a major difference to design iteration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appIssues related to the Codex desktop appbugSomething isn't workingimagenperformance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions