Repository navigation
Conversation
|
Codex review: needs changes before merge. Reviewed July 31, 2026, 10:05 PM ET / August 1, 2026, 02:05 UTC. ClawSweeper reviewWhat this changesThe PR adds photo detection, download, MIME normalization, and native image context for inbound messages on the Zalo personal-account plugin. Merge readinessKeep open: the PR addresses a real missing inbound-photo capability, and the supplied Zalo screenshots directly show the bot reading the serial number from the pictured label. The branch has two concrete merge blockers: its new fetch can hold a durable inbound delivery far too long, and its failure path logs the full attachment URL. Likely related people:
Priority: P2 Review scores
Verification
How this fits togetherThe Zalo personal-account plugin turns vendor message events into durable inbound channel deliveries and then dispatches agent turns. This change inserts photo extraction and guarded media download so a received image reaches a vision-capable model as turn context. flowchart LR
A[Zalo message event] --> B[Zalouser normalization]
B --> C[Photo attachment detection]
C --> D[Guarded media download]
D --> E[Inbound media facts]
E --> F[Agent turn context]
F --> G[Vision-capable model response]
Before merge
Findings
Agent review detailsSecurityNeeds attention: The shared downloader preserves SSRF and response-size protections, but this PR still exposes full inbound attachment URLs in logs and does not supply channel-appropriate fetch deadlines. PR surfaceSource +162, Tests +161. Total +323 across 6 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Keep photo support in the Zalouser plugin, but bound the shared guarded download at this inbound boundary and redact attachment URLs before logging failures; add focused coverage for both behaviors before merge. Do we have a high-confidence way to reproduce the issue? Yes for the code-level regression: current main has no Zalouser inbound-media path, while the PR's screenshots show an after-fix photo-to-response flow. A local live Zalo reproduction was not possible, and the vendor dependency source was unavailable for event-shape verification. Is this the best way to solve the issue? No, not as submitted. The plugin-local use of the shared channel-media seam is the right solution, but it must apply that seam's bounded-fetch and safe-diagnostic controls rather than rely on a 15-minute default and raw URL logging. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fdcb321bfaaa. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
Acceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
|
ClawSweeper PR egg 🔥 Warming up: real-behavior proof passed; findings, security review, or rank-up moves are still in progress. Hatch commandComment Hatchability rules:
What is this egg doing here?
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Converted to draft. Reverting earlier misleading claim of live native-vision verification; the production path I observe today is still the image-tool round-trip, not buildContext({media:...}). Will undraft after I instrument the vendor port + validate |
Real Zalo client proof attachedVisual proof of the inbound photo extraction working end-to-end on a real Zalo conversation. Em Huyen agent (Tingee customer-support bot, Vietnamese) running this PR's media-array changes against the Zalo CDN photo URLs. Zalo Android (Capypara.AI group): Zalo Desktop (same conversation): What to look at: The user sent a photo of a Tingee soundbox label, asking the bot to reset it. The bot's reply opens with:
("Yes Mr. Le, I have seen the photo clearly. Your device ID is SN: 3PRO175459 (Model: Tingee 3PRO).") That SN string is printed on the physical label in the photo - the agent extracted it directly from the inbound vision block, not from any prior context. Confirms the Screenshots live on a separate |
|
Thanks for the review. Addressed all three blockers in f6b9607e:
@clawsweeper re-review |
f6b9607 to
a12839f
Compare
|
This pull request has been automatically marked as stale due to inactivity. |
|
Not stale - this is CI-green and just waiting on review. Worth a look now that 2026.7.x tightened inbound-media handling: this PR surfaces Zalo personal-account photos as native kernel vision blocks via |
a12839f to
ffc2cd0
Compare
|
Rebased onto current Two conflicts, both in
I checked the Verification on the rebased branch: The wider Also confirmed this still fills a real gap rather than duplicating something that landed since: Commit emails changed to the GitHub noreply address (push was rejected under email-privacy otherwise). Content is byte-identical — the tree hash is unchanged across that rewrite. Happy to rebase again if it drifts, or to split anything out if you'd prefer a smaller first cut. |
ffc2cd0 to
06c5e42
Compare
zca-js already delivers photo content via `TAttachmentContent.href` (see src/models/Message.ts in RFS-ADRENO/zca-js), but the zalouser plugin layer discards it: `normalizeMessageContent` flattens the object to a JSON string fallback so the agent only sees the photo URL embedded as text. Models that try to act on it call the dynamic `image` tool unreliably (~50% of the time on Qwen3.6 in our production deployment), and when they do call it the image-tool round-trip adds 5+ seconds latency just to get back what's already in the message. This change wires inbound photos into the existing channel media pipeline that Telegram + Discord extensions use: - Add `ZaloInboundMedia` type (kind: "image", url, thumbUrl?). - New `extractInboundMedia` helper in zalo-js.ts detects photo content via `content.type === "photo"` OR image file extension in href OR presence of a thumb URL (zca-js only ships thumb on photos). Returns null for text, links, files, stickers - those flow through the existing `normalizeMessageContent` text path unchanged. - `toInboundMessage` attaches the resolved media to the returned `ZaloInboundMessage`. - `monitor.ts processMessage` downloads the photo via `saveRemoteMedia` (same path Discord uses), then passes the saved file as a top-level `media: [...]` array to `buildContext` via `toInboundMediaFacts` - the kernel then derives MediaPath/MediaUrl/MediaType automatically and the agent runner attaches the photo as a native vision content block. - Early-return guard relaxed: photo-only messages (no text caption) are now processed; previous code returned early when `rawBody` was empty, silently dropping photo-only inbound messages. Net effect for the LLM: a photo arrives as a real vision attachment in the user turn, identical to how Telegram or Discord photo messages present. No tool call required. Verified live in production via DOS's Em Huyen Vietnamese customer-support bot reading device serial numbers from user-submitted photos of Loa Tingee bottom plates with 100% tool-call elimination + ~5s latency reduction per turn. Test coverage: 9 unit tests for `extractInboundMedia` covering photo detection paths (explicit type, extension fallback, thumb fallback), non-photo content shapes (text, links, sticker, audio, PDF), whitespace trimming, and case-insensitive extension matching with query strings. Refs: openclaw/openclaw image tool design (extensions/discord/src/monitor/ message-handler.context.ts pattern), zca-js TAttachmentContent shape.
Verified live 2026-05-21: Zalo CDN serves user-uploaded photos with
`Content-Type: application/octet-stream`, not `image/jpeg`. The kernel's
`resolveCurrentTurnImages` requires `MediaType` to start with `image/` to
attach the photo as a vision content block, so without this override the
downloaded photo lands on disk + appears in MediaPath/MediaUrl/MediaType
but with type "application/octet-stream" - and the agent never sees the
vision block. Bot then either hallucinates or asks the user to retype the
serial number as text.
New `resolveInboundImageContentType` helper: trusts a real image/* MIME
from saveRemoteMedia when present; otherwise picks from URL extension
(.jpg/.jpeg/.png/.gif/.webp/.bmp, case-insensitive, query-string-tolerant);
falls back to image/jpeg as the most common Zalo photo format.
extractInboundMedia has already gated us so we KNOW the bytes represent
an image, making the override safe.
Tests: 6 unit tests covering the trust path, the octet-stream override,
URL extension parsing with query strings, case-insensitivity, missing
content-type, and unknown-extension fallback.
End-to-end live verification (DOS Em Huyen bot servicing Vietnamese Zalo
customer support):
[zalouser] [default] inbound message
[DOS DEBUG v2] dosFetchInboundMedia called media={url, kind:"image", thumbUrl}
[DOS DEBUG v2] fetch status=200 ok=true ctype=application/octet-stream
[DOS DEBUG v2] overrode contentType to image/jpeg from url ext
[DOS DEBUG v2] wrote file=/tmp/openclaw/zalouser-inbound-...jpeg size=105814
[DOS DEBUG v3] MediaPath=/tmp/openclaw/zalouser-inbound-...jpeg MediaType=image/jpeg
[context-diag] pre-prompt: ... promptImages=1
Bot reply quoted the serial number "3PRO175459" and model "Tingee 3PRO"
directly from the native vision block in the user turn, no `image` tool
round-trip required. Tested with 5 different photos against the live
photo-stal-*.zdn.vn CDN.
knip --production flags exports that only tests import. Move the pure helpers extractInboundMedia and resolveInboundImageContentType into inbound-media.ts so production code imports them across modules, and drop the unused testing/__testing re-export.
2ef397c to
2d10b3c
Compare
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |


Summary
Surfaces inbound photo attachments on the Zalo personal-account channel as native vision content blocks. Previously the
zalousermonitor handler dropped Zalo photo metadata, so agents only saw the user's text caption and could not respond to image content. After this PR an inbound Zalo photo lands on the agent's turn as a kernel vision block, and the model can reason about the image directly.What changes
extensions/zalouser/src/zalo-js.ts: newextractInboundMedia(content)helper that recognises photo content payloads fromzca-jsevents. Detects viatype === 'photo', image-extension URL pattern, or non-emptythumb. Returns{ kind: 'image', url, thumbUrl? }for downstream pickup.extensions/zalouser/src/zalo-js.ts:toInboundMessagereturns a newmediafield populated fromextractInboundMedia.extensions/zalouser/src/monitor.ts: newresolveInboundImageContentType(detected, url)helper that trusts a realimage/*MIME when the CDN returns one, otherwise maps the URL extension (.jpg|.png|.gif|.webp|.bmp) to the correct image MIME. Falls back toimage/jpegwhen both signals are absent. Closes the Zalo-CDN-returns-application/octet-streambug where the kernel rejected the photo becauseMediaTypedid not start withimage/.extensions/zalouser/src/monitor.ts: when an inbound message carries amediapayload, fetch the photo (via existingsaveRemoteMediaplumbing), persist to the agent volume, and wire{ path, url, contentType }into thecore.channel.turn.buildContext({ media: [...] })call. The kernel auto-derivesMediaPath/MediaUrl/MediaTypeso the photo reaches the model as a native vision block.extensions/zalouser/src/monitor.ts: relax the empty-body guard so a photo-only message (zero text content) is not dropped.Tests
extensions/zalouser/src/monitor.media.test.ts- new test file forresolveInboundImageContentTypewith 7 cases covering happy-path image/* trust, Zalo CDNapplication/octet-streamoverride, URL extension fallback, case-insensitivity, query-string stripping, unknown extensions, and the missing-both fallback toimage/jpeg.Real behavior proof
Behavior or issue addressed: Inbound Zalo photo attachments arriving via the
@openclaw/zalouserchannel were silently dropped bymonitor.ts- the model saw only the user's text caption, never the image. Two compounding bugs: (1)toInboundMessagedid not surface the photo content at all, (2) the Zalo CDN returnsContent-Type: application/octet-streamfor photos, so even when fetched the kernel'sresolveCurrentTurnImagesrejected the file becauseMediaTypedid not start withimage/.Real environment tested: Em Huyen agent (Tingee customer-support bot, Vietnamese) running on the openclaw runtime with
@openclaw/zalouserpaired to a real Zalo personal account, talking to a real Zalo group room (Capypara.AI). Channelzalouser, modeldos-ai/dos-ai(Qwen3.6-35B-a3b). Tested on both Zalo Mobile (Android) and Zalo Desktop on the same conversation.Exact steps or command run after this patch:
zalo-js.ts+monitor.tschanges to the running zalouser plugin.@Em Huyền reset loa cho anh. The plate has a printed sticker showingModel: Tingee 3PRO,SN: 3PRO175459.Evidence after fix:
Zalo Android (Capypara.AI group, dark theme):
Zalo Desktop (same conversation):
Observed result after fix: Em Huyen's reply opens with
Dạ anh Le, em đã nhìn rõ ảnh rồi. Mã thiết bị của anh là: SN: 3PRO175459 (Model: Tingee 3PRO).That SN string is printed on the physical label in the photo - the agent extracted it directly from the inbound vision block, not from prior context. Confirms end-to-end that (a)extractInboundMediarecognised the Zalo photo content payload, (b)resolveInboundImageContentTypeoverrode the Zalo CDN'sapplication/octet-streamtoimage/jpeg, (c) the kernel vision pipeline accepted the photo, (d) the agent received the image as a native vision block and read the SN off the label.What was not tested: I have not run a head-to-head BEFORE / AFTER screenshot pair in the same Zalo conversation - the pre-fix behavior was the live deployment state captured separately in the downstream vendor patch's tracking ticket, which is what motivated this PR. The AFTER screenshots above are from a real deployment with the fix in place. Maintainers can reproduce the BEFORE state by reverting
extensions/zalouser/src/monitor.tsto the pre-PR version and re-sending the same photo - the bot will reply without referencing the SN because it never received the vision block.Screenshots live on a separate
proof/zalouser-em-huyen-screenshotsbranch on the fork so the upstream merge does not import binaries into openclaw history.Refs
Companion outbound PR: #85039 (Zalo client markdown normalizer).