Skip to content

Historical images are re-uploaded on every turn in Codex Desktop and VS Code #35732

Open

Description

@iris-Neko

What issue are you seeing?

Summary

Codex Desktop and the Codex VS Code extension appear to include and re-upload all historical image payloads on every subsequent turn in a conversation.

This affects both:

  • Images attached or pasted by the user
  • Images generated or produced by Codex itself, including screenshots, browser/computer-use images, and generated images

The old images are re-sent even when the new prompt does not refer to them and does not contain a new image.

Impact

In affected long-running threads, the upload payload can grow to tens or even hundreds of megabytes on every turn. As more images accumulate:

  • Each new prompt takes progressively longer to upload and process.
  • Turn latency increases continuously.
  • The conversation may become extremely slow, reconnect repeatedly, freeze, or become difficult to resume.
  • The same image bytes may be transmitted many times instead of being reused by reference.
  • Context and usage can grow much faster than the visible conversation suggests.

Affected surfaces

  • Codex Desktop
  • Codex VS Code extension (openai.chatgpt)

The fact that both surfaces show the behavior may indicate that the problem is in shared session replay, context assembly, or app-server request construction.

Actual behavior

Historical user-provided and Codex-generated images appear to be bundled into each new turn as full image data, such as inline image payloads or equivalent binary/base64 content.

The same images are therefore uploaded repeatedly throughout the conversation.

What steps can reproduce the bug?

  1. Start a new Codex conversation in Codex Desktop or the VS Code extension.
  2. Over multiple turns, attach or paste several user images.
  3. Ask Codex to generate images or use a workflow that produces screenshots.
  4. Continue the conversation with short prompts that do not reference the old images and do not attach new images.
  5. Inspect a sanitized network trace, request-size measurement, or local session metadata. No private logs, screenshots, or session files need to be shared.
  6. Observe that previous image payloads are included again in later turns and that the upload size and latency increase as the thread grows.

What is the expected behavior?

Historical images should not be re-uploaded in full on every turn by default.

Codex should preferably:

  • Store image data out-of-line and reuse it through stable references, attachment IDs, or a server-side cache.
  • Deduplicate identical images across turns and session checkpoints.
  • Include old images only when they are relevant to the current context.
  • Remove or summarize stale image content during compaction.
  • Avoid hydrating large historical image payloads into every request.
  • Provide a way to remove or trim old media from an affected conversation.

If an old image is needed again, Codex could explicitly reattach or retrieve it by reference rather than silently transmitting the full image bytes every time.

Additional information

This appears related to:

Those reports cover related symptoms and persistence problems. This report specifically highlights the repeated per-turn upload behavior across both Codex Desktop and the VS Code extension.

I am intentionally not attaching raw transcripts, images, prompts, logs, or session files because they may contain private data. Sanitized request-size measurements and redacted metadata should be sufficient to investigate this behavior.

Activity

  1. added
    appIssues related to the Codex desktop app
    extensionIssues related to the VS Code extension
    sessionIssues involving session (thread) management, resuming, forking, naming, archiving
    contextIssues related to context management (including compaction)
    on Jul 28, 2026
  2. tianyu2202 commented on Sep 7, 2026

    @tianyu2202

    Windows 实测补充:单次请求约 24 MB,用户观测本次长对话累计上传约 20 GB

    本次现象与此 issue 高度一致,补充实际请求大小和网卡采样数据。问题已严重影响长时间工具工作流,请优先排查历史图片复用及上下文传输。

    环境与现象

    • 采集时间:2026-09-07,Asia/Shanghai(UTC+8)。
    • Windows,Codex 桌面应用包版本 26.901.6511.0;本机配套 codex-cli 0.153.4。
    • 含用户图片和工具图片的长任务。停止查看新图片后,继续执行仅返回少量文字的工具,界面每新增一条工具记录仍对应明显的上传尖峰。
    • 网络使用 WLAN 和 FlClash 代理。以下请求体大小来自 Codex 客户端压缩日志,独立于代理流量统计。
    • 用户观测:当前长对话累计产生约 20 GB 上传。 这是用户对累计影响的报告;本次诊断没有从对话开始进行持续逐进程计量,不能把 20 GB 全部声明为已独立核验的 Codex 请求字节。

    直接测得的请求大小

    客户端 codex_http_client::request 日志记录了发往 https://chatgpt.com/backend-api/codex/responses 的 POST 请求:
    Compressed request body with zstd pre_compression_bytes=... post_compression_bytes=...

    本地时间 压缩前 bytes zstd 压缩后 bytes
    13:41:12 32503597 23939342
    13:42:01 32524940 23947214
    13:43:04 32535795 23954173
    13:43:40 32546205 23957802
    13:44:28 32559637 23962030

    对应五次响应均为 HTTP 200。另抽查 20 条 auth_retry_after_unauthorized 标记均为 false;该样本不支持认证失败重传是主要原因,但不能排除其他重试。

    Windows Get-NetAdapterStatistics 独立采样在 13:48:49.081–13:50:03.103(约 74 秒、140 个样本)记录到:

    • WLAN 发送:49,054,717 bytes(49.05 MB)。
    • WLAN 接收:1,812,812 bytes。
    • 主要上行集中在两个突发区间,量级与两次约 24 MB 的 POST 相符。
    • 网卡数据包含其他进程流量,因此不作为严格逐进程归属证据。

    历史图片关联证据与确定性边界

    仅在本机扫描存储的会话记录并统计 data:image 编码长度,没有解码或附上图片内容。最近一次 compaction 记录之后新增的 10 条图片编码合计 31,580,328 个 ASCII 字符,与当前约 32.58 MB 的压缩前请求大小高度吻合。这些图片中,最后两张小截图合计只有 126,464 字符。

    停止新增大图后仍持续发送约 24 MB 请求,强烈支持历史大图被随上下文重复传输的推断。但本次没有解密网络请求或逐张重建请求输入,不能断言每个请求具体包含哪些图片,也没有证明 compaction 的确切行为。确认的事实是反复出现的大请求及实际网卡上行量。

    观察路径与预期行为

    本次在已有长任务中持续观察,尚未另做干净任务的完整对照复现。供维护者复现的路径:

    1. 在 Windows 桌面任务中通过用户附件及图片工具累积多张大图。
    2. 停止添加图片,继续执行仅产生少量文字输出的工具。
    3. 比较每次后续模型请求的压缩前后字节数与网卡发送增量。
    4. 检查旧图片是否作为完整内联数据重复加入请求,以及 compaction 前后的变化。

    预期:需要保留的图片应尽可能通过稳定引用、去重或可复用的会话状态延续;少量新增文字不应持续触发数十 MB 的重复上传。也希望提供从现有任务裁剪历史媒体的可用办法。具体修复方案请以内部接口和实际根因为准。

    此补充只提交数值和诊断方法,不包含原始会话、图片、业务代码、凭据或完整日志。

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 workingcontextIssues related to context management (including compaction)extensionIssues related to the VS Code extensionperformancesessionIssues involving session (thread) management, resuming, forking, naming, archiving

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions