Repository navigation
Historical images are re-uploaded on every turn in Codex Desktop and VS Code #35732
Description
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?
- Start a new Codex conversation in Codex Desktop or the VS Code extension.
- Over multiple turns, attach or paste several user images.
- Ask Codex to generate images or use a workflow that produces screenshots.
- Continue the conversation with short prompts that do not reference the old images and do not attach new images.
- Inspect a sanitized network trace, request-size measurement, or local session metadata. No private logs, screenshots, or session files need to be shared.
- 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:
- Bug: image-heavy chats repeatedly reconnect and become very slow #20805 - image-heavy chats repeatedly reconnect and become very slow
- Desktop compaction repeatedly embeds full image base64 in compacted checkpoints #23257 - compaction repeatedly embeds full image payloads
- macOS Desktop: image-heavy thread takes minutes to open because rollout JSONL embeds generated image payloads inline #22603 - generated image payloads duplicated in Desktop session history
- Desktop threads can be poisoned by inline base64 tool images, leading to
{"detail":"Bad Request"}on resume and likely inflated token usage #18629 - inline base64 tool images persisted in replayable history
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
github-actions commentedon Jul 28, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
tianyu2202 commentedon Sep 7, 2026
Windows 实测补充:单次请求约 24 MB,用户观测本次长对话累计上传约 20 GB
本次现象与此 issue 高度一致,补充实际请求大小和网卡采样数据。问题已严重影响长时间工具工作流,请优先排查历史图片复用及上下文传输。
环境与现象
26.901.6511.0;本机配套codex-cli 0.153.4。直接测得的请求大小
客户端
codex_http_client::request日志记录了发往https://chatgpt.com/backend-api/codex/responses的 POST 请求:Compressed request body with zstd pre_compression_bytes=... post_compression_bytes=...对应五次响应均为 HTTP 200。另抽查 20 条
auth_retry_after_unauthorized标记均为 false;该样本不支持认证失败重传是主要原因,但不能排除其他重试。Windows
Get-NetAdapterStatistics独立采样在 13:48:49.081–13:50:03.103(约 74 秒、140 个样本)记录到:历史图片关联证据与确定性边界
仅在本机扫描存储的会话记录并统计
data:image编码长度,没有解码或附上图片内容。最近一次 compaction 记录之后新增的 10 条图片编码合计 31,580,328 个 ASCII 字符,与当前约 32.58 MB 的压缩前请求大小高度吻合。这些图片中,最后两张小截图合计只有 126,464 字符。停止新增大图后仍持续发送约 24 MB 请求,强烈支持历史大图被随上下文重复传输的推断。但本次没有解密网络请求或逐张重建请求输入,不能断言每个请求具体包含哪些图片,也没有证明 compaction 的确切行为。确认的事实是反复出现的大请求及实际网卡上行量。
观察路径与预期行为
本次在已有长任务中持续观察,尚未另做干净任务的完整对照复现。供维护者复现的路径:
预期:需要保留的图片应尽可能通过稳定引用、去重或可复用的会话状态延续;少量新增文字不应持续触发数十 MB 的重复上传。也希望提供从现有任务裁剪历史媒体的可用办法。具体修复方案请以内部接口和实际根因为准。
此补充只提交数值和诊断方法,不包含原始会话、图片、业务代码、凭据或完整日志。