Repository navigation
fix(line): forward FileMessage fileName to media store for audio MIME detection - #96643
xydigit-sj wants to merge 3 commits into
Conversation
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
$(cat <<EOF This PR supersedes #96616, which was closed due to a GitHub PR head sync issue after the latest push. The branch now contains the lint fix and the integration proof test. Real behavior proof is included in the PR body and in extensions/line/src/download.integration.test.ts: it exercises downloadLineMedia with the real saveMediaStream (no mock) and a mocked LINE stream, using a temporary OPENCLAW_HOME. A .mp3 filename hint produces audio/mpeg and a .mp3 saved file path even when the buffer has no audio magic bytes. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: the same LINE file-message filename handoff is already covered by a cleaner open canonical PR with stronger handler coverage and proof, while the broader LINE issue remains open for the separate 0-byte stream behavior. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Use #96403 as the canonical filename-handoff fix and keep #96163 open for the separate 0-byte LINE stream investigation. So I’m closing this here and keeping the remaining discussion on #96403 and #96163. Review detailsBest possible solution: Use #96403 as the canonical filename-handoff fix and keep #96163 open for the separate 0-byte LINE stream investigation. Do we have a high-confidence way to reproduce the issue? Yes for the scoped filename/audio-detection path: source inspection shows current main drops LINE fileName before saveMediaStream, and attachment classification depends on MIME or saved-path extension. No live LINE reproduction was established for the separate 0-byte stream behavior. Is this the best way to solve the issue? No for this branch as the landing path: the fix shape is plausible, but #96403 covers the same behavior with handler-level coverage, a cleaner options-shaped API, and sufficient runtime proof. Security review: Security review cleared: No concrete security or supply-chain concern found; the diff threads existing LINE filename metadata into the already-sanitizing media-store path and adds tests. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against c6ade83a5ccb. |
|
Closing as superseded by #96403, landed on The landed fix preserves LINE upload filenames at the handler/download boundary, normalizes the optional filename before use, passes it through the existing options-shaped API, and includes focused media-detection coverage. That is the same intended behavior with a cleaner boundary than this older branch, whose current head is also dirty and failing checks. Thanks for tracing the missing filename through the LINE media path. The separate zero-byte stream report in #96163 is not resolved by this closure. |
What Problem This Solves
Closes the audio-detection half of #96163.
When a LINE user sends an audio file via the file upload feature, the message arrives as
type: \"file\"(webhook.FileMessageContent). That content carries afileNamefield (e.g.voice.m4a), butextensions/line/src/bot-handlers.tsdiscarded it before callingdownloadLineMedia. The media store therefore received nooriginalFilenamehint, so audio formats that lack reliable magic-byte detection could be saved as.binand never routed to the audio transcription pipeline.The 0-byte download half of #96163 is not addressed here; ClawSweeper noted that a high-confidence live repro is still needed for that part.
Why This Change Was Made
saveMediaStreamalready accepts anoriginalFilenameparameter that is used for MIME type classification and extension selection. The LINE plugin simply was not plumbing the availablefileNamemetadata into it. Forwarding the existing field is the smallest, backward-compatible fix and aligns LINE file messages with other attachment paths that already provide filename hints.User Impact
LINE file-upload audio attachments (
.m4a,.mp3,.wav,.ogg, etc.) can now be correctly classified as audio by the media store, so they are eligible for transcription by the configuredtools.media.audioprovider. No config or UI change is required.Evidence
node scripts/run-vitest.mjs run extensions/line/src/download.test.ts→ 8 passednode scripts/run-vitest.mjs run extensions/line/src/bot-handlers.test.ts→ 26 passednode scripts/run-vitest.mjs run extensions/line/src/download.integration.test.ts→ 1 passed.mp3filename hint yieldsaudio/mpegand a.mp3saved file path when the buffer has no audio magic bytesnpx oxfmt --write --threads=1 extensions/line/src/download.ts extensions/line/src/bot-handlers.ts extensions/line/src/download.test.ts extensions/line/src/download.integration.test.ts