Skip to content

fix: preserve data URL attachment filename extensions - #130625

Merged
steipete merged 1 commit into
mainfrom
codex/qa32-attachment-mime
Aug 27, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa32-attachment-mime

Conversation

@steipete

@steipete steipete commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Closes #130618

What Problem This Solves

Fixes an issue where attachment actions using valid data URL buffers produced filenames such as attachment instead of attachment.png or attachment.csv, even though the content type had already been recognized. Ordinary send did not have this filename defect.

Why This Change Was Made

The shared attachment hydrator extracted MIME from the data URL, then inferred the filename from the earlier, missing input MIME. Filename inference now consumes the normalized MIME already owned by that hydrator. This reuses the existing normalizer and filename helper; it adds no new branch, channel-specific handling, dependency, or fallback.

User Impact

sendAttachment, reply, upload-file, and shared group-icon attachment normalization retain the expected MIME-derived filename extension. Explicit filenames and content types still take precedence, and raw base64 naming behavior is unchanged. Buffer decoding, media access policy, sandboxing, delivery, and persistent state are untouched.

Evidence

Before the production edit, 11 regression assertions failed: PNG/CSV filename inference across four attachment actions, plus existing action-runner dispatch fixtures for sendAttachment, upload-file, and reply. All failures received attachment instead of the expected MIME-derived filename. Ordinary-send controls and explicit content-type controls passed.

After the one-line producer repair, 267 tests passed across the two hydration/runner suites and the shared MIME suite:

OPENCLAW_VITEST_MAX_WORKERS=1 pnpm test src/infra/outbound/message-action-params.attachments.test.ts src/infra/outbound/message-action-params.test.ts packages/media-core/src/mime.test.ts
pnpm check:changed
git diff --check

All passed. Changed checks include formatting, type checks, lint, import-cycle and architecture guards. A separate Node process with temporary HOME/config/state and no module mocks passed 25 real hydration cases: data URL, explicit filename, explicit MIME, raw base64 with MIME, and raw base64 without MIME across all five actions.

Fresh independent P1 autoreview found no actionable findings (correct, confidence 0.94). Exact-head CI 33034708529 is green on 6bd02709b140456ccd666a6a30477801c22e8999; native review artifacts validate at READY FOR /prepare-pr. Production +1/-1, net zero; tests +29/-8. Coverage extends existing tables and dispatch fixtures, with no test-only production seam.

The latest ClawSweeper comment is still a review-started placeholder; no verdict or rank-up list has been published. It is not counted as completed review. The independent review and exact-head proof above are complete.

Proof limit: this is real core hydration and existing plugin-handler boundary proof, not a claim of live recipient delivery. No isolated iMessage recipient/account was provisioned; native recipient rendering, group-icon acceptance, and chat screenshots are therefore unverified. No external API or channel transport behavior changed. The group-icon CSV case checks the shared normalizer only, not that a recipient accepts CSV icons.

No docs contract or public options change. Existing documentation already accepts buffer/filename attachment inputs; release-note context is the restored inferred extensions described above. No changelog file edit. AI-assisted repair.

Carry the normalized MIME into the existing attachment filename inference. Cover PNG/CSV metadata across actions and the real action-to-plugin dispatch boundary. Explicit filenames and MIME overrides remain unchanged. Closes #130618.
@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Aug 27, 2026
@steipete
steipete marked this pull request as ready for review August 27, 2026 02:54
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for 6bd02709b140456ccd666a6a30477801c22e8999: CI 33034708529 is green, and native review artifacts validate at READY FOR /prepare-pr with no findings.

Root cause: the shared attachment hydrator computed the data URL MIME, then inferred filenames from the earlier missing MIME input. The existing filename owner now consumes that normalized fact. Explicit filename/MIME precedence, raw buffers, media access and transport remain unchanged. Production +1/-1; tests +29/-8.

Before: 11 intended filename failures, including three action-to-plugin dispatch cases. After: 267 focused tests passed, plus 25 real no-module-mock hydration/precedence cases in isolated temporary state. Exact local commands:

OPENCLAW_VITEST_MAX_WORKERS=1 pnpm test src/infra/outbound/message-action-params.attachments.test.ts src/infra/outbound/message-action-params.test.ts packages/media-core/src/mime.test.ts
pnpm check:changed
git diff --check

Fresh independent P1 autoreview is clean (correct, confidence 0.94). Current-main comparison found no affected owner/test drift. The PR body retains the concrete proof gap: no isolated iMessage recipient/account was provisioned, so recipient rendering/group-icon acceptance and chat screenshots were not verified. Core metadata and plugin-handler proof is not described as live channel delivery; no external API or transport changed.

The latest ClawSweeper comment remains a review-started placeholder, with no published verdict/rank-up list; it is not counted as completed review. Proceeding with the completed independent review, exact-head proof, and native hosted-CI landing gates.

@steipete
steipete merged commit 47fe3cc into main Aug 27, 2026
271 checks passed
@steipete
steipete deleted the codex/qa32-attachment-mime branch August 27, 2026 03:17
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
Carry the normalized MIME into the existing attachment filename inference. Cover PNG/CSV metadata across actions and the real action-to-plugin dispatch boundary. Explicit filenames and MIME overrides remain unchanged. Closes openclaw#130618.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Data URL attachment actions lose inferred filename extensions

1 participant