Skip to content

fix: accept upload-only video attachments for upload_file - #3179

Merged
esokullu merged 2 commits into
webbrain-one:mainfrom
16Miku:fix/video-upload-attachment-3166
Oct 12, 2026
Merged

esokullu merged 2 commits into
webbrain-one:mainfrom
16Miku:fix/video-upload-attachment-3166

Conversation

@16Miku

@16Miku 16Miku commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3166

Summary

  • The sidebar accepts MP4, MOV/QuickTime and WebM files as upload-only attachments (25 MB cap). Videos never enter model context. The agent attaches them to a page file input with upload_file({attachmentId}).
  • upload_file checks video container signatures (ftyp brands, EBML DocType) against the page's accept, so a renamed file cannot pass an MP4-only input.
  • On X public composer routes (/compose/post, /compose/tweet), upload_file no longer requires recipient binding. Clicks, typing and key presses on those routes keep the existing guard. DMs (/i/chat/) are unchanged.

Why the X exemption is needed

Recipient binding stops a message from reaching the wrong person. A public post has no recipient, and its composer sits near the top of the page, so the upload probe returned recipient_upload_target_unverifiable on every attempt. This was reproduced in test/message-recipient-upload.mjs for both Chrome and Firefox. The exemption applies only to upload_file, and only to routes an adapter declares with messaging.publicComposer.

Review notes

  • Please review isPublicComposerRoute and its two call sites in agent.js: _messageRecipientGuardBlock and _recipientBoundUploadContext.
  • The video guidance sits inside the existing untrusted user-attachment notice. No tools are added, so UNTRUSTED_CONTENT_TOOLS is unchanged.
  • Run snapshots persist only attachmentCount. The attachment payload stays in memory.
  • Chrome and Firefox are mirrored. The only differing line is the pre-existing getFullPageCapturePolicy import.
  • The branch was merged with webbrain-one/webbrain main at 40dc6cbe9 to resolve a conflict in package.json shard lists. Both sides are kept.

Testing (on the merged branch, 25647e536)

Check Result
node --test test/video-upload-attachment.mjs test/file-upload-accept.mjs test/file-upload-accept-agent.mjs 169/169
node test/message-recipient-upload.mjs (includes new X public-composer and DM cases) 84/84
node test/quality/video-upload-attachment-mv3.mjs (real Chrome MV3) Passed. The page input receives the exact bytes (SHA-256 match). No video bytes appear in the model request.
node test/run.js 2451/2452. The one failure is repository changelog retains complete…, which compares CHANGELOG.md (40.2.2) with package.json (40.4.0) on main. This PR changes neither file.
node test/fixtures/run.mjs 279/283. The same four fail on pristine webbrain-one/webbrain main: steering after a submission permits verified social recovery controls (chrome and firefox) and two Firefox geometry cases.
node --test test/draftjs-text.mjs 63/66. The three caret and empty-editor cases (direct-caret, wrapped-caret, Chrome: native appends preserve strong empty-editor proof…) also fail on pristine upstream main.
npm run build:chrome, npm run build:firefox Pass
Manual, Chrome, x.com/compose/post (before the merge) A 345 KB MP4 attaches, previews and plays. The draft is not published.

The failures listed above exist on upstream main without this PR. They are called out so CI results can be read against that baseline.

Known limitations

  • Firefox has unit tests and a build check only. No real-browser video upload run yet.
  • The sp.attach.unsupported_type copy in the 24 locale files still lists the old types. This PR does not translate it.
  • X accepts MP4 and MOV but not WebM. The page's own accept decides, and a mismatch is reported as file_type_mismatch.
  • The 25 MB payload is held in memory until it is sent.

CONTRIBUTING.md checklist

  • Chrome and Firefox mirrored
  • Unit tests run through test/run.js. One pre-existing failure is unrelated to this PR.
  • Read docs/prompt-injection-defense.md. No new tools or registry changes. No page-derived content added.
  • No CHANGELOG edit. CI generates it at release time.
  • Tests registered in CI shards: test:shard:runtime-unit and test:shard:browser-b2
  • Locale copy for sp.attach.unsupported_type (follow-up)

Fixes webbrain-one#3166

- The sidebar accepts MP4, MOV/QuickTime and WebM files as upload-only
  attachments (25 MB cap). Video contents never enter model context; the
  agent attaches the file to a page file input with upload_file and its
  attachmentId.
- upload_file checks video container signatures (ftyp brands, EBML DocType)
  against the page accept, so a renamed file cannot pass an MP4-only input.
- On X public composer routes (/compose/post, /compose/tweet), upload_file
  no longer requires recipient binding, because a public post has no
  recipient. Clicks, typing and key presses on those routes keep the generic
  guard, and DM routes are unchanged.
- Chrome and Firefox are mirrored. Unit, recipient-upload and real Chrome
  MV3 coverage are registered in the existing CI shards.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 12, 2026 16:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The job was not started because the account is locked due to a billing issue.

Bring the branch up to date with webbrain-one/webbrain main (40dc6cb) so the
PR merges cleanly. The only textual conflict was in package.json test shard
command lists; both sides are kept (upstream shard additions plus the video
upload unit and MV3 tests).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@vercel

vercel Bot commented Oct 12, 2026

Copy link
Copy Markdown

@16Miku is attempting to deploy a commit to the esokullu's projects Team on Vercel.

A member of the Team first needs to authorize it.

@esokullu
esokullu merged commit e17d1af into webbrain-one:main Oct 12, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

can't attach videos as attachment in the sidebar?

3 participants