fix(line): preserve uploaded file names for media detection#96403
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 24, 2026, 8:54 AM ET / 12:54 UTC. Summary PR surface: Source +9, Tests +57. Total +66 across 4 files. Reproducibility: yes. for the scoped metadata/audio-detection path: current main drops LINE Review metrics: none identified. 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:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the focused filename handoff as a partial LINE fix if maintainers accept the scope, and keep #96163 open for the empty-stream investigation. Do we have a high-confidence way to reproduce the issue? Yes for the scoped metadata/audio-detection path: current main drops LINE Is this the best way to solve the issue? Yes for the scoped metadata fix: using LINE's existing AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ae9474b5fdc0. Label changesLabel justifications:
Evidence reviewedPR surface: Source +9, Tests +57. Total +66 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
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
…#96403) * fix(line): preserve file upload filenames * test(line): fail unexpected media downloads
…#96403) * fix(line): preserve file upload filenames * test(line): fail unexpected media downloads
…#96403) * fix(line): preserve file upload filenames * test(line): fail unexpected media downloads
…#96403) * fix(line): preserve file upload filenames * test(line): fail unexpected media downloads
Related: #96163
What Problem This Solves
Fixes an issue where LINE users who upload an audio file as a file message can lose the original filename before OpenClaw stores the attachment, leaving the media path without the
.m4a/audio extension hint needed by downstream audio detection when MIME sniffing is inconclusive.Why This Change Was Made
LINE
FileMessageContentalready carriesfileName, and OpenClaw's media store already acceptsoriginalFilenamefor MIME/extension fallback and safe saved-media IDs. This change keeps the fix inside the LINE plugin boundary: file messages normalize and pass the LINE filename intodownloadLineMedia, and the download wrapper forwards it tosaveMediaStream.This intentionally does not claim to fix the separate reported 0-byte LINE content stream behavior from #96163; that still needs live LINE/API evidence before changing download endpoints or stream handling.
User Impact
LINE audio files uploaded through the file picker can now retain names like
voice-note.m4athrough media storage, allowing the existing media-understanding path to classify them as audio instead of falling back to an unknown extensionless attachment when bytes alone do not identify the format.Duplicate/work check: I found no open PR for #96163,
downloadLineMedia originalFilename,FileMessage fileName saveMediaStream, or LINE file-upload audio metadata. Nearby open PRs checked: #86873 changes LINE download idle timeouts, not filename propagation; #71517 changes Feishu/shared filename decoding, not LINEFileMessage.fileNamehandoff.Evidence
node scripts/run-vitest.mjs extensions/line/src/download.test.ts extensions/line/src/bot-handlers.test.ts extensions/line/src/bot-message-context.test.ts src/media-understanding/attachments.guards.test.ts src/media-understanding/apply.test.tsnode scripts/run-vitest.mjs extensions/line/src/bot-handlers.test.tspnpm exec oxfmt --check extensions/line/src/download.ts extensions/line/src/bot-handlers.ts extensions/line/src/download.test.ts extensions/line/src/bot-handlers.test.tspnpm exec oxfmt --check extensions/line/src/bot-handlers.test.ts && git diff --checkgit diff --check$autoreviewfinal pass: clean, no accepted/actionable findingsDependency/source proof checked: local
@line/bot-sdkFileMessageContenttype includesfileNameandfileSize;saveMediaStreamalready acceptsoriginalFilenameand uses it for MIME detection/path extension fallback with sanitization.Real behavior proof
Behavior addressed: LINE file-style audio filename preservation through OpenClaw media storage/classification, using the real
saveMediaStreamandresolveAttachmentKindruntime path.Real environment tested: local OpenClaw checkout with Node 26.3.1 and an isolated
OPENCLAW_HOME=$(mktemp -d).Exact steps or command run after this patch:
OPENCLAW_HOME=$(mktemp -d) node --import tsx --input-type=module -from the repo root, with an inline probe importingsrc/media/store.tsandsrc/media-understanding/attachments.normalize.ts, then streaming unknown bytes throughsaveMediaStreamfirst without an original filename and then withvoice-note.m4a.Evidence after fix:
Observed result after fix: without the filename hint, the saved attachment is extensionless and classifies as
unknown; withvoice-note.m4a, the saved basename preserves the sanitized audio extension and the actual attachment classifier returnsaudio.What was not tested: no live LINE credential/API upload was run, and this does not validate or fix the separate 0-byte LINE content stream behavior from #96163.