Skip to content

fix: deliver Codex-generated images on message-tool routes - #110893

Merged
steipete merged 2 commits into
mainfrom
omarshahine/fix-codex-generated-media-delivery
Jul 18, 2026
Merged

steipete merged 2 commits into
mainfrom
omarshahine/fix-codex-generated-media-delivery

Conversation

@omarshahine

@omarshahine omarshahine commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Closes #110394

What Problem This Solves

Fixes an issue where users asking Codex-backed agents to generate an image would receive no response on message_tool_only channel routes when Codex used its native image-generation tool.

Why This Change Was Made

Codex native image generation intentionally completes without assistant text and returns the saved artifact through the host. The Codex projector now carries those exact URLs as host-owned provenance. Core splits that subset from generic tool media before applying the existing source-reply suppression exception, while continuing to suppress ordinary assistant source replies, generic media, and message-tool transcript mirrors.

This adds one optional field to the existing agent-harness-runtime attempt-result type so provider harnesses can identify host-owned media. It does not change channel/plugin registration APIs, config schema, or gateway protocol.

Maintainer decision: message_tool_only governs model-authored source replies and generic tool media. Runtime-owned terminal output with explicit provenance remains deliverable through host dispatch, consistent with existing command and durable-completion exceptions. Outbound sendPolicy denial still wins.

User Impact

Generated images from Codex-native imagegen are delivered to the originating channel even when normal source replies require the message tool. Existing message-tool-only text delivery behavior is unchanged.

Evidence

  • Production repro on OpenClaw 2026.7.2-beta.2 (54d98a4): Codex completed native image generation with a valid 2.4 MB PNG and zero assistant text; the gateway logged visible channel turn dispatched with no queued reply payloads, and iMessage received nothing.
  • Focused local proof after the provenance refinement: 316 tests passed across tool-media-payloads.test.ts, schema-help quality, Codex event-projector.test.ts, and Codex run-attempt.test.ts. After rebasing, the core delivery, schema-help, and projector suites passed 201 tests; two additional queued-delivery tests prove that marked host media still respects sendPolicy: deny and ambient room_event silence. The local current-main run-attempt.test.ts harness times out before turn/start, including an untouched adjacent test, so CI remains authoritative for that file on the rebased head.
  • Blacksmith changed-file gate: typecheck, lint, formatting, Plugin SDK API baseline, plugin boundaries, import cycles, and repository guards passed (run).
  • Autoreview: implementation review clean with no accepted/actionable findings (0.88 confidence); contract/docs follow-up review also clean (0.96 confidence).
  • Live fixed-path iMessage proof on commit 5d03f44; the published head 67def3c is a clean rebase with identical stable patch ID f81dcd8293243d4b8c9eeef7fe5c42ba55bcb22c:
    • The unmodified prompt was Generate a lobster image using imagegen. No delivery behavior was forced or prohibited.
    • The local Codex harness ran openai/gpt-5.5 against a copied real iMessage DM session and completed normally in 158.5 seconds.
    • Codex rollout lines 43-50 contain imagegen -> image_generation_end (completed) -> terminal agent_message -> task_complete, with no message function call. The live terminal message was empty; the upstream Codex contract's nonempty Done follow-up is covered by the mixed assistant-text regression test.
    • OpenClaw projected exactly one image-only payload with the generated PNG and zero text.
    • Messages row 7092 is outbound, has zero text, and contains one image/png attachment (2,693,995 bytes).
    • The image-only reply appeared in the originating iMessage conversation with no caption; the maintainer captured the live conversation screenshot separately.
    • Production remained online on port 18789 for the entire proof; no development gateway or second inbound iMessage monitor was started.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling extensions: codex size: M maintainer Maintainer-authored PR labels Jul 18, 2026
@omarshahine

omarshahine commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Live iMessage proof on the final patch content:

  • Unmodified prompt: Generate a lobster image using imagegen.
  • Codex rollout: imagegen -> completed image_generation_end -> terminal agent_message -> task_complete; no message tool call.
  • OpenClaw projection: exactly one PNG payload, zero text.
  • Messages DB: outbound row 7092, zero text, one image/png attachment, 2,693,995 bytes.
  • Production remained online on :18789; no second inbound iMessage monitor was started.
  • Proven SHA 5d03f44; published head 67def3c has identical stable patch ID f81dcd8293243d4b8c9eeef7fe5c42ba55bcb22c.

Local ClawSweeper final result: no findings, no risks, no merge-risk labels. Autoreview: clean.

@omarshahine
omarshahine force-pushed the omarshahine/fix-codex-generated-media-delivery branch from afa4e5e to 67def3c Compare July 18, 2026 18:50
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels Jul 18, 2026
@clawsweeper

clawsweeper Bot commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 18, 2026, 3:41 PM ET / 19:41 UTC.

Summary
The PR adds explicit host-owned-media provenance to the Codex harness result, separates that media from generic tool media on message_tool_only routes, and documents/tests the resulting delivery exception.

PR surface: Source +64, Tests +243, Docs +9. Total +316 across 17 files.

Reproducibility: yes. from source and the supplied production report: a Codex native image-generation turn with media and no assistant text reaches the message-tool-only suppression boundary. I could not independently run the current-main reproduction in this read-only review environment.

Review metrics: 1 noteworthy metric.

  • Agent-harness delivery surface: 1 optional attempt-result field added. The new hostOwnedToolMediaUrls field creates a shared harness-to-core policy signal, so its ownership boundary matters beyond the Codex implementation.

Stored data model
Persistent data-model change detected: unknown-data-model-change: src/config/schema.help.automation.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #110394
Summary: This PR is the candidate fix for the open report of Codex-native image artifacts being suppressed on message-tool-only routes.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🦐 gold shrimp
Patch quality: 🐚 platinum hermit
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Attach redacted final-head iMessage or equivalent live delivery evidence, including the commit SHA.
  • [P1] Have the code owner confirm the documented trusted-harness suppression exception before merge.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR contains detailed redacted production iMessage evidence for the functional patch and an earlier stated-equivalent head, but it does not directly identify the current 0b426317 head; add final-head live output, logs, or a redacted terminal/chat capture before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] hostOwnedToolMediaUrls is a new cross-harness delivery capability that intentionally bypasses an existing user-selected source-reply suppression policy for a restricted provenance class; maintainers should confirm that the documented trusted-harness contract is the intended permanent boundary.
  • [P1] The concrete live iMessage evidence is for the prior proven patch/head rather than the final 0b426317 head, so the final branch lacks directly attributable real-behavior proof despite strong focused tests and a detailed earlier run.

Maintainer options:

  1. Prove and approve the final-head boundary (recommended)
    Attach redacted live evidence from 0b426317 showing the image delivery and retained sendPolicy/room-event protections, then have the owner confirm the shared harness contract.
  2. Accept the cross-harness policy exception
    Merge with the documented trusted-harness provenance exception as an intentional compatibility change if the owner accepts that it overrides source-reply suppression for this artifact class.

Next step before merge

  • [P1] The remaining gate is owner confirmation of a compatibility-sensitive shared harness policy plus final-head live proof, not a narrow automated code repair.

Maintainer decision needed

  • Question: Does the final hostOwnedToolMediaUrls agent-harness contract have owner approval as the permanent exception to message_tool_only source-reply suppression?
  • Rationale: This is an intentional compatibility-sensitive expansion of a delivery exception shared by harnesses; tests can prove mechanics but cannot decide the permanent cross-harness policy boundary.
  • Likely owner: steipete — The current-head follow-up commit and assignment connect steipete directly to the refined contract and its validation.
  • Options:
    • Approve the narrow trusted-harness exception (recommended): Accept the documented subset rule after final-head live proof confirms only native host artifacts bypass source-reply suppression.
    • Keep suppression universal: Reject the new provenance exception and require Codex-native artifacts to use the normal message-tool delivery path instead.

Security
Cleared: The diff adds no dependency, workflow, permission, secret, downloader, or package-resolution change; its new provenance marker is constrained to a delivered-media subset and covered by negative-path tests.

Review details

Best possible solution:

Keep the explicit subset-and-provenance design, confirm the trusted-harness contract on the final head, and attach a redacted final-head iMessage or equivalent live delivery transcript showing that marked artifacts deliver while sendPolicy: deny and room-event silence still win.

Do we have a high-confidence way to reproduce the issue?

Yes from source and the supplied production report: a Codex native image-generation turn with media and no assistant text reaches the message-tool-only suppression boundary. I could not independently run the current-main reproduction in this read-only review environment.

Is this the best way to solve the issue?

Yes, conditionally: provenance as a validated subset of delivered tool media is narrower than broadly exempting tool media or changing the user configuration. The remaining question is approval and live proof for the final shared-harness contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against bf2da1ce1af7.

Label changes

Label changes:

  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR contains detailed redacted production iMessage evidence for the functional patch and an earlier stated-equivalent head, but it does not directly identify the current 0b426317 head; add final-head live output, logs, or a redacted terminal/chat capture before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • remove proof: sufficient: Current real behavior proof status is insufficient, not sufficient.
  • remove status: ⏳ waiting on author: Current PR status label is status: 📣 needs proof.

Label justifications:

  • P2: This fixes a deterministic but bounded failure affecting Codex-native image delivery on message-tool-only routes.
  • merge-risk: 🚨 compatibility: The PR deliberately changes how an existing message_tool_only user policy treats a newly classified class of harness output.
  • merge-risk: 🚨 message-delivery: The new metadata determines whether generated media is routed or suppressed on channel delivery paths.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR contains detailed redacted production iMessage evidence for the functional patch and an earlier stated-equivalent head, but it does not directly identify the current 0b426317 head; add final-head live output, logs, or a redacted terminal/chat capture before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +64, Tests +243, Docs +9. Total +316 across 17 files.

View PR surface stats
Area Files Added Removed Net
Source 10 88 24 +64
Tests 5 273 30 +243
Docs 2 10 1 +9
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 17 371 55 +316

What I checked:

  • Narrow delivery boundary: The core path marks only URLs that are both declared host-owned and present in toolMediaUrls; generic tool media remains unmarked, and marked media is split into a separate payload only for message_tool_only. (src/agents/embedded-agent-runner/run/tool-media-payloads.ts:20, 0b4263175711)
  • Existing admission controls retained: The follow-up path preserves ambient room-event silence and send-policy denial before routing marked host media, which matches the stated boundary rather than creating an unconditional send path. (src/auto-reply/reply/followup-runner.ts:2009, 0b4263175711)
  • Public harness contract is explicit: The added harness field is documented as restricted to native artifacts created and persisted by the trusted harness, requires every URL to also be in toolMediaUrls, and explicitly excludes model-selected dynamic-tool media. Public docs: docs/plugins/sdk-agent-harness.md. (docs/plugins/sdk-agent-harness.md:435, 0b4263175711)
  • Prior review blocker addressed in the follow-up: The previous review requested a narrowed or approved cross-harness suppression-bypass contract; the current PR adds the provenance subset rule, SDK documentation, and tests through the runner-to-dispatch bridge. The follow-up commit is attributed to steipete. (src/agents/embedded-agent-runner/run/types.ts:284, 0b4263175711)
  • Real proof does not identify the final head: The PR body and contributor comment give detailed iMessage evidence for 5d03f44 and state that 67def3c has the same patch ID, but the current pull-request head is 0b426317; the added final commit must be tied to equivalent final-head runtime proof before merge. (0b4263175711)

Likely related people:

  • steipete: Authored the current-head follow-up commit that adds the Codex delivery-path coverage and harness-contract documentation, and is assigned to the PR. (role: recent area contributor and likely follow-up owner; confidence: high; commits: 0b4263175711; files: extensions/codex/src/app-server/run-attempt.test.ts, src/agents/embedded-agent-runner/run/tool-media-payloads.test.ts, docs/plugins/sdk-agent-harness.md)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (1 earlier review cycle)
  • reviewed 2026-07-18T18:56:27.093Z sha 67def3c :: found issues before merge. :: [P1] Narrow or approve the shared suppression-bypass contract

@steipete steipete self-assigned this Jul 18, 2026
Document trusted harness artifact provenance and cover the runner-to-dispatch bridge.\n\nRelease note: Codex-generated images now reach message-tool-only routes while normal source suppression remains intact.\n\nCo-authored-by: Omar Shahine <[email protected]>
@clawsweeper clawsweeper Bot added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jul 18, 2026
@steipete
steipete merged commit bbad877 into main Jul 18, 2026
126 of 132 checks passed
@steipete
steipete deleted the omarshahine/fix-codex-generated-media-delivery branch July 18, 2026 19:46
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 19, 2026
…110893)

* fix: deliver Codex-generated images on message-tool routes

* test(codex): cover native image delivery path

Document trusted harness artifact provenance and cover the runner-to-dispatch bridge.\n\nRelease note: Codex-generated images now reach message-tool-only routes while normal source suppression remains intact.\n\nCo-authored-by: Omar Shahine <[email protected]>

---------

Co-authored-by: Omar Shahine <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…110893)

* fix: deliver Codex-generated images on message-tool routes

* test(codex): cover native image delivery path

Document trusted harness artifact provenance and cover the runner-to-dispatch bridge.\n\nRelease note: Codex-generated images now reach message-tool-only routes while normal source suppression remains intact.\n\nCo-authored-by: Omar Shahine <[email protected]>

---------

Co-authored-by: Omar Shahine <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: codex gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Codex-native generated images are dropped on message-tool-only routes

2 participants