Skip to content

fix(core): support attachments without a File global#5097

Open
Kinfe123 wants to merge 2 commits into
mainfrom
fix/attachment-file-detection
Open

fix(core): support attachments without a File global#5097
Kinfe123 wants to merge 2 commits into
mainfrom
fix/attachment-file-detection

Conversation

@Kinfe123

@Kinfe123 Kinfe123 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • identify prepared CreateAttachment values by their required content field instead of the ambient File constructor
  • keep the core composer and ExternalThread attachment paths consistent
  • cover environments without globalThis.File and files created by another constructor realm

Why

Calling addAttachment() with a prepared attachment could throw before doing any work in React Native, Ink, Node, or other environments where File is unavailable. A browser file created in another window or iframe could also fail instanceof File and be misclassified as a prepared attachment.

The new discriminator preserves the existing behavior for ordinary browser files and prepared attachments while removing the dependency on constructor identity.

Testing

  • pnpm test in packages/core (584 tests)
  • pnpm test in packages/react (472 tests)
  • pnpm --filter @assistant-ui/core build
  • pnpm --filter @assistant-ui/react build
  • pnpm lint
  • pnpm changeset status --since origin/main --verbose

Review in cubic

@Kinfe123
Kinfe123 requested a review from a team July 22, 2026 00:46
@changeset-bot

changeset-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d6bc5a7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@assistant-ui/core Patch
@assistant-ui/react Patch
@assistant-ui/react-mcp Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@rupic-app rupic-app Bot added stage/needs-review No reviews yet; waiting for a maintainer pkg/core Changes a package under packages/ pkg/react Changes a package under packages/ R1 Actionable, normal priority type/bugfix Bug fix labels Jul 22, 2026
@claude

claude Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Claude Code is working…

I'll analyze this and get back to you.

View job run

@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(core): support attachments without a..." | Re-trigger Greptile

Comment thread packages/core/src/runtime/base/base-composer-runtime-core.ts Outdated
@rupic-app rupic-app Bot added stage/awaiting-reviewer Has reviews but not approved; reviewer follow-up needed and removed stage/needs-review No reviews yet; waiting for a maintainer labels Jul 22, 2026
Comment thread packages/react/src/client/ExternalThread.ts Outdated
@Kinfe123
Kinfe123 force-pushed the fix/attachment-file-detection branch from 3c45608 to 6c0fb7d Compare July 22, 2026 00:51

@cubic-dev-ai cubic-dev-ai Bot 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.

Review completed against the latest diff

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/core/src/runtime/base/base-composer-runtime-core.ts Outdated
@Kinfe123
Kinfe123 force-pushed the fix/attachment-file-detection branch from 6c0fb7d to 69e1419 Compare July 22, 2026 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg/core Changes a package under packages/ pkg/react Changes a package under packages/ R1 Actionable, normal priority stage/awaiting-reviewer Has reviews but not approved; reviewer follow-up needed type/bugfix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant