Repository navigation
fix(qqbot): treat inbound attachment content types case-insensitively - #102753
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 9, 2026, 7:56 AM ET / 11:56 UTC. Summary PR surface: Source +11, Tests +58. Total +69 across 4 files. Reproducibility: yes. Current main and the latest release compare raw QQ Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review detailsBest possible solution: Merge this focused QQ Bot plugin fix after routine exact-head checks, keeping raw Do we have a high-confidence way to reproduce the issue? Yes. Current main and the latest release compare raw QQ Is this the best way to solve the issue? Yes. Compare-only lowercasing at the two image branches and the voice detector is the narrowest maintainable fix; broader MIME plumbing or raw payload mutation would be less targeted. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8d6c54f51313. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +11, Tests +58. Total +69 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
|
|
Land-ready review complete. Verified the full QQBot inbound attachment path, quote replay caller, normalization helper, sibling classifiers, current main, and RFC 2045 media-type matching. Fresh Codex autoreview was clean (0.86 confidence). Exact head c28d69c has 58 successful hosted checks with no failures or pending checks. Sanitized direct AWS Crabbox provider=aws lease=cbx_26d6df347069 run=run_ad0d0ec62efb ran pnpm test extensions/qqbot/src/engine/gateway/inbound-attachments.test.ts extensions/qqbot/src/engine/utils/audio.test.ts: 2 files, 47 tests passed. The lease was public-only, had no Tailscale state, and is released. Known gap: no credentialed live QQ payload; deterministic production-path classification proof is sufficient for this compare-only fix. |
|
Merged via squash.
|
…openclaw#102753) * fix(qqbot): treat inbound attachment content types case-insensitively * test(qqbot): use distinct download paths per image; note voice sentinel in comment
Summary
Prompt request: Make QQ Bot inbound attachment classification treat content types case-insensitively per RFC 2045, while returning the raw
content_typevalues unchanged.Proof target: Show that mixed-case image and voice content types now classify identically to their lowercase forms (image display, remote-URL fallback on failed download, voice download and transcription routing), and that non-media types are still not promoted.
What Problem This Solves
Fixes an issue where QQ Bot inbound attachments with a mixed-case
content_type(such asImage/PNGorAudio/Silk) were silently misclassified. MIME types are case-insensitive per RFC 2045, but the qqbot inbound pipeline compared the raw value against lowercase literals at three sites:extensions/qqbot/src/engine/gateway/inbound-attachments.ts(download-success branch):att.content_type?.startsWith("image/")— a mixed-case image fell out of the image path into a generic[Attachment: ...]note, so the agent never received it as an image.extensions/qqbot/src/engine/gateway/inbound-attachments.ts(download-failure branch): the same comparison — a mixed-case image lost its remote-URL fallback and was reported as a plain failed download.extensions/qqbot/src/engine/utils/audio.tsisVoiceAttachment:content_type === "voice" || startsWith("audio/")— a mixed-case voice attachment (with no rescuing filename extension) skipped the voice download and transcription routing entirely and was treated as a generic file.The same
isVoiceAttachmentalready lowercases the filename-extension side of its check vianormalizeLowercase; thecontent_typeside was the missed half. This is the qqbot sibling of merged #102431, which fixed the same content-type case-sensitivity class in the msteams plugin on the same RFC 2045 reasoning.Why This Change Was Made
content_typevalues were compared against lowercase literals, while relay payloads may emit mixed-case MIME types.normalizeLowercaseStringOrEmptyhelper at the three comparison sites. Lowercasing is compare-only: the returned fields (contentType, media-type passthrough, filename fallback) keep the raw value, and lowercase inputs keep their existing behavior. MIME types are case-insensitive by spec, so lowercasing the comparison can only add matches, never remove one.voicevalue in the same check is a QQ-specific content marker rather than a MIME type; it is normalized the same way for the same relay-variability reason.User Impact
QQ Bot inbound images with mixed-case content types are now delivered to the agent as images (including the remote-URL fallback when the download fails), and mixed-case voice attachments route through voice download and transcription instead of being treated as generic files. Lowercase content types behave exactly as before.
Evidence
Boundary-capture of the production classification pipeline:
node --import tsxdrives the realprocessAttachments(download → classify) and the realisVoiceAttachment, with only the external media fetch replaced by a minimal adapter that performs a real HTTP GET against a local server (real bytes, real file writes through the productiondownloadFile). Fixtures: mixed-case image with successful download, mixed-case image with failed (404) download, extension-less mixed-case voice attachment, and a mixed-case PDF as negative control.Before (unmodified base branch):
After (this PR):
Real behavior proof
content_typevalues (Image/PNG,Audio/Silk) were misclassified: images dropped out of the image path (both download-success and URL-fallback branches) and voice attachments skipped voice download and transcription routing.c28d69c2c8d930c7d5f09395f8448d5e54597fb0OPENCLAW_HOME=$(mktemp -d) node --import tsx <proof script>— imports the productionprocessAttachmentsandisVoiceAttachment, wires the audio-convert port exactly like the production bridge assembly, serves attachment bytes from a local HTTP server through the platform-adapter seam, and prints the resulting classification. Run once against the unmodified base branch and once against this PR's HEAD.Audio/Silkenters the voice transcription path,Application/PDFstays a generic attachment.content_typevalues keep their original casing; non-media types are not promoted.Tests and validation
New tests cover: mixed-case image classification on the download-success branch (with lowercase regression in the same run and raw passthrough asserted), the remote-URL fallback on the download-failure branch,
isVoiceAttachmentmixed-case recognition (Voice,Audio/Silk) with a non-audio rejection, and a mixed-case non-image type that must not be promoted.Risk checklist
One concern, one PR — content-type case-insensitivity in qqbot inbound classification only.
No config, env, or default surface change.
Backward compatible — lowercase inputs produce identical results; comparisons only gain matches, and returned values are unchanged.
No new deps, no new helpers (uses the plugin's existing normalize helper).
No CHANGELOG edit (per release policy).
Tests added.
Allow edits by maintainers