Skip to content

fix(line): forward FileMessage fileName to media store for audio MIME detection - #96643

Closed
xydigit-sj wants to merge 3 commits into
openclaw:mainfrom
xydigit-sj:fix/line-file-message-filename-96163
Closed

xydigit-sj wants to merge 3 commits into
openclaw:mainfrom
xydigit-sj:fix/line-file-message-filename-96163

Conversation

@xydigit-sj

Copy link
Copy Markdown
Contributor

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 a fileName field (e.g. voice.m4a), but extensions/line/src/bot-handlers.ts discarded it before calling downloadLineMedia. The media store therefore received no originalFilename hint, so audio formats that lack reliable magic-byte detection could be saved as .bin and 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

saveMediaStream already accepts an originalFilename parameter that is used for MIME type classification and extension selection. The LINE plugin simply was not plumbing the available fileName metadata 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 configured tools.media.audio provider. No config or UI change is required.

Evidence

  • Local unit tests:
    • node scripts/run-vitest.mjs run extensions/line/src/download.test.ts → 8 passed
    • node scripts/run-vitest.mjs run extensions/line/src/bot-handlers.test.ts → 26 passed
  • Integration proof using real media store:
    • node scripts/run-vitest.mjs run extensions/line/src/download.integration.test.ts → 1 passed
    • Confirms a .mp3 filename hint yields audio/mpeg and a .mp3 saved file path when the buffer has no audio magic bytes
  • Format: npx 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

@openclaw-barnacle openclaw-barnacle Bot added channel: line Channel integration: line size: S labels Jun 25, 2026
@clawsweeper

clawsweeper Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@xydigit-sj

Copy link
Copy Markdown
Contributor Author

$(cat <<EOF
@clawsweeper review

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.
EOF
)

@clawsweeper

clawsweeper Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper

clawsweeper Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

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
Relationship: superseded
Canonical: #96403
Summary: This PR and the canonical open PR address the same LINE file-message filename handoff; the canonical PR is the viable landing path, while the broader issue still owns the 0-byte stream half.

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 details

Best 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:

  • steipete: GitHub commit history shows repeated work on saveMediaStream, media storage, media-core extraction, and attachment classification that the filename-handoff fix relies on. (role: media-store and attachment-classification area contributor; confidence: high; commits: 53d007bc878c, 6545317a2cb9, 77f1359612f6; files: src/media/store.ts, src/media-understanding/attachments.normalize.ts, extensions/line/src/download.ts)
  • vincentkoc: History shows the LINE channel move into the extension boundary and later media/temp-save work near the same storage seam. (role: LINE extension boundary and media seam contributor; confidence: medium; commits: 213198123042, ac0fd26e1699, e69fedc8cfad; files: extensions/line/src/bot-handlers.ts, extensions/line/src/download.ts, src/media/store.ts)
  • Takhoffman: History shows prior LINE media/auth/routing fixes touching old LINE handler, download, and message-context paths that overlap this bug class. (role: adjacent LINE media fix contributor; confidence: medium; commits: 9a5bfb1fe56d; files: src/line/bot-handlers.ts, src/line/download.ts, src/line/bot-message-context.ts)
  • plum-dawg: GitHub commit history identifies the original LINE plugin commit that introduced the initial handler and download implementation later moved into extensions/line. (role: original LINE plugin introducer; confidence: medium; commits: c96ffa7186a4; files: src/line/bot-handlers.ts, src/line/download.ts, extensions/line/src/bot-handlers.ts)

Codex review notes: model internal, reasoning high; reviewed against c6ade83a5ccb.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. labels Jun 25, 2026
@vincentkoc vincentkoc self-assigned this Jul 7, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Closing as superseded by #96403, landed on main as aa5ec51af0088fe59b56736fcdfe34b8b1bd1006.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: line Channel integration: line P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants