fix(media): forward scanned PDF page images as current-turn images#96706
fix(media): forward scanned PDF page images as current-turn images#96706wanyongstar wants to merge 2 commits into
Conversation
…at channels When extractFileBlocks receives a scanned/image-only PDF (no extractable text but page images present), it previously set a dead-end placeholder and dropped the images. The /v1/responses API path already forwarded the same images correctly. Fix: embed the extracted page images as base64 data URIs in the file context block, so vision-capable models can read scanned documents on all chat channels. Closes openclaw#96541
|
Codex review: needs real behavior proof before merge. Reviewed June 25, 2026, 4:26 AM ET / 08:26 UTC. Summary PR surface: Source +52. Total +52 across 4 files. Reproducibility: yes. at source level: current main can receive PDF-rendered images from Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Preserve the existing Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main can receive PDF-rendered images from Is this the best way to solve the issue? No as submitted. Carrying extracted page images through existing current-turn image plumbing is the right layer, but this branch must preserve existing Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 770b19f496c1. Label changesLabel justifications:
Evidence reviewedPR surface: Source +52. Total +52 across 4 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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
|
|
Thanks @wanyongstar for the PR and for pushing the typed image-forwarding direction. The same #96541 root cause has now been fixed by #97354, merged as 07b9349. The landed path forwards extracted scanned-PDF page images through the reply/ACP image plumbing, removes the stale placeholder wording, preserves ordering with other attachments, and includes live Telegram proof. Closing this PR as superseded by the merged canonical fix. |
What Problem This Solves
Chat media-understanding already receives page-image payloads from image-only PDFs, but converted them into placeholder-only file blocks. Scanned PDFs in chat channels therefore did not reach vision-capable agent turns, unlike the sibling OpenResponses path.
Summary
Carry extracted PDF page images as transient current-turn images, consumed once in normal reply and ACP dispatch.
Changes:
apply.ts:extractFileBlocksreturnsExtractedFileBlockswithimagesalongsideblocks. Extracted page images are stored onctx.CurrentTurnImagestemplating.ts:MsgContextgains optionalCurrentTurnImages?: ImageContent[]current-turn-images.ts:resolveCurrentTurnImagesconsumesctx.CurrentTurnImagesand merges them into the resolved image outputdispatch-acp.ts: consumesctx.CurrentTurnImagesand forwards as inline ACP attachmentsLinked context
Closes #96541
Evidence
extractFileBlocksnow returns images alongside text blocks[PDF content rendered to images; images not forwarded to model]to just[PDF content rendered to images]ImageContentpath (not Markdown data URIs)Live chat-channel proof will be supplied separately.
Risk checklist
Did user-visible behavior change? (
Yes) — PDF page images now reach vision-capable models on chat channels.Did config, environment, or migration behavior change? (
No)Did security, auth, secrets, network, or tool execution behavior change? (
No) — images that were already extracted and forwarded by the API path are now also forwarded on the chat path.What is the highest-risk area?
Double-consumption of CurrentTurnImages if both reply paths run in sequence.
How is that risk mitigated?
CurrentTurnImages is deleted after consumption (delete ctx.CurrentTurnImages) so each path consumes it at most once.