Repository navigation
fix(codex): show screenshots returned by native tools - #154125
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Live Control UI verificationThe workflow is identical in each capture: Codex calls Before — attachment absentAfter — attachment rendered inlineAfter full Control UI reload — attachment retainedThe normal Gateway service was restored after this verification. |
6b23833 to
b4dde1e
Compare
|
Codex review: needs maintainer review before merge. What this changesThe Codex plugin turns validated native tool-output images into managed reply attachments while preserving delivery deduplication and generated-image accounting. Example: A native view_image call returns a 240×120 PNG inside function_call_output.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR repairs a current screenshot-loss bug through the existing media owner; no actionable correctness or security finding remains. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Codex event projector receives native and raw app-server notifications, correlates tool identities, saves validated image bytes through Gateway media storage, and supplies attachment references to reply delivery and persisted history. flowchart LR
A[Codex app server] --> B[Turn event projector]
B --> C[Native tool identity correlation]
C --> D[Existing media projection owner]
D --> E[Gateway media store]
E --> F[Reply delivery and history]
F --> G[Control UI]
Technical reviewBest possible solution: Land this focused media-owner repair after required checks pass, retaining host-dynamic exclusion and existing delivery receipts. Do we have a high-confidence way to reproduce the issue? Current-main source drops the reported structured tool images, and the supplied built-Gateway baseline comparison demonstrates the missing attachment; this review ran no target code. Is this the best way to solve the issue? The patch fixes the missing projection at its existing owner, reuses validation and storage contracts, and preserves generated-image and delivery semantics. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2c157ed06dff. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +231, Tests -1. Total +230 across 3 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (6 earlier review cycles)
Reviewed October 30, 2026, 6:46 PM ET / 22:46 UTC (Revision 7). |
b4dde1e to
9c36662
Compare
9c36662 to
c3a7d75
Compare
Final local validation and CI shard diagnosisThe detached, resource-capped final validation completed after the desktop client disconnected:
The sole GitHub failure is changed-extension shard 27, where those same two existing native-output-fidelity parameter cases reported a missing I attempted to rerun the failed workflow, but fork PR authors do not have repository-admin permission to rerun this upstream Actions run. A maintainer rerun of shard 27 is needed; no source change in this PR is indicated by the available evidence. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Built Gateway + real Chromium proofCandidate Secretless Node 24.22.1 Docker; separately built Gateway and Control UI on both refs; real Chromium; task-owned synthetic protocol-faithful app-server fixture. No real Codex binary execution, model inference, paid API key or operator login is claimed. The fixture emits the actual structured tool-result encoding inspected in upstream Codex. Actual sessions were created through Gateway RPC, then Every rendered image decoded at 240×120 pixels. Repeated raw/native events did not duplicate attachments. Existing focused media suite passed 11/11, including ordinary screenshot side-effect=false and retained generated-image behavior; changed-file formatting passed. A separate baseline unit replay timed out during worker execution and is not counted as product evidence; its children were stopped. Initial catalog/route and startup-wait setup failures are not counted as defect reproduction. Native source inspected at
Production +241/-10 (251 gross); existing test +29/-30 (net -1); no new test/support file. Contributor commits retained. No sibling PR code adopted. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 96583dd. Thanks @sobechestnut-dev. Images from native Codex tool outputs now show in chat. |
fix(codex): show images from native Codex tool outputs, such as screenshots OpenClaw kept images from native Codex turns only when they came from `image_generation`. Images returned inside tool outputs never reached chat or history. Codex returns those as `input_image` content items in `function_call_output` and `custom_tool_call_output` (for example `view_image` in codex-rs/core/src/tools/handlers/view_image.rs:234-250, item shape in codex-rs/protocol/src/models.rs:2247-2259, at ce0323f2f2). They are now recorded and shown. Generated images are unchanged. Malformed, oversized, unowned and host-dynamic outputs stay excluded, with at most eight images per turn. Evidence: built Gateway and Control UI in real Chromium with a protocol-faithful Codex app-server fixture (no real inference). Main showed no screenshot (twice). With this change exactly one was shown (twice), including after a reload and with either event order. Generated images worked on both refs, the excluded cases stayed excluded, and nine images were capped at eight. Details and screenshots: openclaw#154125 (comment). Thanks @sobechestnut-dev. Co-authored-by: Ayaan Zaidi <[email protected]>
fix(codex): show images from native Codex tool outputs, such as screenshots OpenClaw kept images from native Codex turns only when they came from `image_generation`. Images returned inside tool outputs never reached chat or history. Codex returns those as `input_image` content items in `function_call_output` and `custom_tool_call_output` (for example `view_image` in codex-rs/core/src/tools/handlers/view_image.rs:234-250, item shape in codex-rs/protocol/src/models.rs:2247-2259, at ce0323f2f2). They are now recorded and shown. Generated images are unchanged. Malformed, oversized, unowned and host-dynamic outputs stay excluded, with at most eight images per turn. Evidence: built Gateway and Control UI in real Chromium with a protocol-faithful Codex app-server fixture (no real inference). Main showed no screenshot (twice). With this change exactly one was shown (twice), including after a reload and with either event order. Generated images worked on both refs, the excluded cases stayed excluded, and nine images were capped at eight. Details and screenshots: #154125 (comment). Thanks @sobechestnut-dev. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 96583dd) Co-authored-by: RomneyDa <[email protected]>







What Problem This Solves
Native Codex tool screenshots arrive as
input_imageentries inside raw tool outputs, not only asimage_generation_callresults. OpenClaw was dropping those bytes before composing the assistant reply, leaving the Control UI without the screenshot, including after reload.Summary
imageViewidentities in either event order; keep unowned and host-dynamic outputs excluded so outbound policy cannot be bypassed.The native encoding was checked against Codex
ce0323f2f2d3b25e82806cd555237da3db4e1897:codex-rs/protocol/src/models.rslines 1166–1186 and 1212–1225 define function/custom output payloads; lines 2244–2258 defineinput_image; lines 928–934 define inlineimage_url; lines 2348–2352 allow structured content arrays.codex-rs/core/src/tools/handlers/view_image.rslines 234–250 construct an inline image in a function output with the original call ID.Evidence
Built Gateway and built Control UI, secretless Node 24.22.1 Docker, real Chromium, and a deterministic protocol-faithful Codex app-server fixture (not a claim of paid inference or execution of the real Codex binary). Real sessions,
chat.send,agent.wait, andchat.historyexercise the shipped turn and persistence path.Before/after browser evidence is linked in the proof comment. The generated-image path is an unchanged control. Focused existing media suite: 11/11 passed; changed-file formatting passed.
Simplification
Removed the extra standalone regression suite and consolidated screenshot delivery coverage into the existing media suite, retaining source-alias, processed attachment, partial-delivery and generated-image assertions. Reused the canonical base64 estimator, removed forwarding/dead media paths, and replaced an unnecessary generated-ID set with a boolean. Against frozen main: production +241/-10 (251 gross), tests +29/-30 (net -1), no test/support allocation.
Observed before/after evidence: #154125 (comment)
Merge Danger
Two-way door: reverting restores the old projection behavior; no config or schema migration is introduced. Blast radius is native Codex inline tool-image projection and its media delivery receipts; generated-image and host-dynamic policy behavior must remain unchanged.