Codex project threads hang after image2 writes huge C2PA/image payloads into turn events

Open 💬 3 comments Opened Jul 14, 2026 by hug1997
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

Original report title

Codex 项目线程调用 image2 后写入超大结果,导致线程持续假死并消耗大量 token

Environment

  • Codex Desktop release: 26.707.72221
  • Bundled Codex CLI: 0.144.2
  • macOS 26.5.2, Apple Silicon (arm64)
  • Plan shown in local rate-limit telemetry: Plus

What issue are you seeing?

In local Codex Desktop project threads, the image-generation tool (referred to as image2 in the UI/workflow) successfully generates a website background image, but the completed result is then written into the turn/session event as a very large inline image payload.

The generated PNG bytes include C2PA/JUMBF manifest data. The resulting inline event/tool output is millions of serialized characters. After image generation reports completed, the thread stops making useful progress: it does not continue copying the image into the project, editing code, building, or returning a final response. The UI remains active / inProgress until the user interrupts it.

Reproduction evidence

Thread 1

Thread ID:

019f5f9e-81e0-7e81-8544-49fc5f31c2eb

  • Image generation completed at 2026-07-14T08:10:27.814Z.
  • Saved PNG size: 2,186,047 bytes.
  • The PNG contains C2PA/JUMBF markers, including jumdc2pa, c2pa, a urn:c2pa:... manifest identifier, and c2pa.assertions.
  • image_generation_end.payload.result serialized length: 2,914,732 characters.
  • The following function/tool output serialized length: 2,915,306 characters and contained an inline image item.
  • No normal post-generation project workflow completed. The thread was eventually interrupted.
  • Local token telemetry reached 2,257,860 cumulative tokens in the thread after repeated continuation/polling calls; several later calls each reported roughly 89K input tokens.
Thread 2 / continuation thread

Thread ID:

019f5fbb-173f-7f22-93cc-46014e00fa7e

  • The continuation thread attempted to inspect/reuse the already generated PNG.
  • A single image tool output serialized to 2,914,891 characters.
  • No final project action completed after that output.
  • The turn remained stalled for about 6.5 minutes and was manually interrupted.
Thread 3

Thread ID:

019f5fc5-65c2-7df2-83ed-808c2e5159c3

  • Image generation completed at 2026-07-14T08:41:34.784Z.
  • Saved PNG size: 1,825,277 bytes.
  • The PNG also contains C2PA/JUMBF markers and a C2PA manifest identifier.
  • image_generation_end.payload.result serialized length: 2,433,704 characters.
  • The following function/tool output serialized length: 2,434,278 characters and contained an inline image item.
  • No subsequent tool action or final response completed for about 10 minutes.
  • The turn was manually interrupted.
  • Local token telemetry reached 428,669 cumulative tokens in this short continuation thread.

The raw serialized image-result sizes are approximately 2.43–2.92 million characters. Using a simple four-characters-per-token size comparison, that is roughly 0.61–0.73 million token-equivalent characters per image result. This is a size estimate, not a claim about the exact billable-token calculation. The separate local token_count records nevertheless show large and repeated input-token usage after the image payload entered the thread.

Steps to reproduce

  1. Open a local Codex Desktop project thread.
  2. Ask Codex to use image2 / the image-generation tool to create a website card background.
  3. Wait for image generation to complete successfully.
  4. Observe that the generated image result is embedded into the turn/event as a large inline image/base64-style payload, including PNG/C2PA data.
  5. Observe that the thread remains active / inProgress but does not continue with the requested project work or return a final response.
  6. Interrupt and start a continuation thread.
  7. Attempt to inspect or reuse the generated image; the large inline image output is introduced again and the continuation thread can stall as well.

Impact

  • The same project required multiple continuation threads.
  • Threads appeared frozen or stopped before the requested code/build work.
  • Repeated retries and polling caused substantial unnecessary token usage.
  • The user lost task continuity even though image generation itself succeeded.

Expected behavior

  • Image generation results should not inject the complete PNG binary, base64 representation, or C2PA payload into the project-thread model context or persisted event stream.
  • The tool should return only a lightweight artifact reference, local saved path, content hash, dimensions, and small metadata summary.
  • The generated artifact should be available to later tools by reference without replaying the full image bytes.
  • If an image result exceeds a safe context/event limit, Codex should cap or externalize it and continue the requested workflow.
  • The thread should proceed to copy the asset, edit code, build, and provide a final response.

Suggested safeguards

  • Replace inline generated-image bytes in image_generation_end.payload.result and function/tool outputs with artifact references.
  • Do not duplicate the same image bytes across event messages, tool output, persisted rollout JSONL, and context replay.
  • Strip or externalize C2PA/JUMBF binary data from model-visible/session-visible payloads while preserving the original saved artifact.
  • Add hard byte/token caps before image results enter model context.
  • Add a clear recoverable error if the result exceeds the cap.
  • Prevent repeated wait/polling continuation calls from replaying the full prior image payload.

Usage investigation and compensation request

Please investigate abnormal token/usage consumption associated with the three thread IDs above. The user requests review and compensation for usage consumed by the oversized image-result injection, repeated polling, and stalled continuation attempts.

If GitHub maintainers cannot handle account-level usage adjustments, please identify the correct support channel and the exact session/thread identifiers the user should provide.

Related reports

  • #33018 — image-input turns taking 130 seconds cold / 45 seconds warm on the same macOS installation.
  • #24676 — image-heavy session rollouts containing very large inline image payloads.

No private image content, project source code, local filesystem paths, or raw rollout records are attached to this report.

View original on GitHub ↗

3 Comments

github-actions[bot] contributor · 1 month ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #32766
  • #32128

Powered by Codex Action

hug1997 · 1 month ago

Additional reproduction on Codex Desktop, 2026-07-22: image input itself can stall before any model/tool progress.

Thread ID: 019f87bc-9443-7913-84fb-db2f6b7c7d36

Observed behavior:

  • The UI shows the task as active / inProgress.
  • The local rollout JSONL stopped updating at 2026-07-22 10:58:26 +0800 and remained unchanged when checked at 2026-07-22 11:08:11 +0800.
  • The rollout stayed at 92 lines and 5,339,017 bytes.
  • The last turn has no assistant message, no tool call, and no later token_count after the user submitted two images.
  • The last token_count before the image turn was line 86 at 2026-07-22T02:56:37.788Z: total tokens 318,914.

Key event evidence:

  • Line 91 is a response_item user message with serialized length about 4,950,759 characters.
  • That single event contains two input_image items using data:image/png;base64,... inline payloads.
  • The two inline image fields are about 3,206,198 and 1,743,250 characters respectively.
  • The following lightweight event_msg at line 92 contains only local_images paths and is only about 910 characters.

The original local files were ordinary clipboard PNGs:

  • codex-clipboard-8220c1d1-6538-4f18-8c6c-1c53302ec447.png: 2,404,632 bytes
  • codex-clipboard-d1d7f015-f3a7-4eb8-bf25-dcaa9323cb82.png: 2,171,134 bytes

This looks related to the original report but is a separate trigger point: not only generated image results, but also user-provided image inputs can be persisted/replayed as multi-megabyte inline base64 payloads in response_item. In this case the task stalled immediately after the image message was recorded, before any useful model/tool work happened.

Expected behavior remains the same: image inputs should be represented by local artifact references, paths, hashes, dimensions, or capped metadata in rollout/context replay, not by full inline image bytes.

tianxiaochannel-oss88 · 23 days ago

Independent macOS reproduction on the current Desktop build

This is an additional current reproduction of the inline-image/session-bloat failure described here, together with the zombie-turn behavior tracked in #31227.

Environment
  • ChatGPT/Codex Desktop 26.727.51351 (build 6119)
  • Bundled codex-cli 0.146.0-alpha.9.2
  • macOS 26.5.2 (25F84), Apple Silicon (arm64)
Sanitized evidence

Affected image-heavy project thread A:

  • Rollout JSONL: 92,327,102 bytes, 2,807 lines.
  • 75 persisted image_url data values total 79,120,658 bytes (75.46 MiB), about 85.7% of the entire rollout.
  • The largest JSONL line is 4,042,078 characters; many other individual lines are approximately 1.8-2.7 million characters.
  • The oversized records are response_item / custom_tool_call_output entries whose output arrays contain inline image_url data.
  • At inspection time, a new text-only follow-up remained active / inProgress for about five minutes with only the user message and no assistant, reasoning, tool, or error item.
  • The immediately preceding text-only follow-up was marked completed after 447,983 ms, but the turn contained only the user message and no assistant response or surfaced error.

Affected image-heavy project thread B:

  • Original rollout JSONL: 491,274,061 bytes, 43,405 lines.
  • A same-directory fork that copied completed history produced a 491,476,458-byte rollout.
  • The fork was sent a no-tool, one-sentence connectivity check. It produced no assistant message or tool activity for 722,873 ms and was eventually interrupted.
  • This means forking did not provide a usable recovery path once the completed history already contained the oversized payloads.
Impact
  • Image-heavy threads eventually become unusable for ordinary text follow-ups.
  • Retrying can create user-only turns that stay inProgress, or even turns marked completed without an assistant response.
  • A same-directory fork can inherit the pathological history size and reproduce the stall.
  • The practical workaround is to abandon the thread and create a clean task with a manually prepared text summary; preserving continuity is not currently reliable.
Expected safeguards
  • Persist image artifacts by bounded reference rather than replaying full inline data URLs in rollout/tool-output records.
  • Exclude raw image bytes from context replay, fork history, compaction, and hot thread hydration.
  • Put hard byte limits on persisted custom tool outputs and individual JSONL records.
  • If a worker does not start or a response stream produces no events, transition the turn to a visible failed/stale state instead of leaving it indefinitely inProgress or incorrectly completed.
  • Provide a supported repair/archive flow that keeps the textual transcript while externalizing historical binary payloads.

No task IDs, private image content, local filesystem paths, source code, or raw rollout records are included in this comment. They can be shared privately with maintainers if needed.