Skip to content

t3code/support non-image chat attachments - #3927

Closed
jakeleventhal wants to merge 7 commits into
pingdotgg:mainfrom
jakeleventhal:t3code/support-markdown-chat-attachments
Closed

t3code/support non-image chat attachments#3927
jakeleventhal wants to merge 7 commits into
pingdotgg:mainfrom
jakeleventhal:t3code/support-markdown-chat-attachments

Conversation

@jakeleventhal

@jakeleventhal jakeleventhal commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Verification

Screenshot 2026-07-12 at 3 07 25 PM Screenshot 2026-07-12 at 3 09 10 PM [t3code-attachment-tests.zip](https://github.com/user-attachments/files/29944548/t3code-attachment-tests.zip)

Summary

  • allow UTF-8 text files to be dragged into the chat composer alongside images
  • persist text attachments under .t3/attachments and insert standard file-link chips into the prompt
  • avoid collapsing otherwise short user prompts when attachment links contain long hidden paths

Why

The composer previously rejected every dropped file that was not an image. This made it impossible to attach Markdown, source, configuration, or other text files as agent context.

Text attachments now reuse the existing project file-writing and Markdown file-link paths, so they render and behave like other file references. Files are limited to 1 MB and rejected when they contain NUL bytes or invalid UTF-8.

The message collapse heuristic also now measures displayed link labels instead of their backing absolute paths. Without this, prompts containing several attachments could appear hidden even though their visible content was short.

Validation

  • pnpm exec vp test apps/web/src/components/chat/MessagesTimeline.test.tsx
  • pnpm exec vp check
  • pnpm exec vp run typecheck
  • manual drag-and-drop verification with extensionless, Markdown, source, and configuration text files

Note

Medium Risk
Attachment ID format now includes a hash suffix, which can break stored IDs from older threads; attachment persistence and projection cleanup logic also changed in non-trivial ways.

Overview
The chat composer now accepts UTF-8 text files (drag, paste, or picker) in addition to images. Valid files are written under .t3/attachments through a new projects.writeTextAttachment RPC, with server checks for UTF-8, non-empty content, and a contract-defined size cap (1 MB); the prompt gets standard file-link chips like other project references.

Attachment identity and cleanup change: owned segments include a SHA-256 hash suffix (toOwnedThreadAttachmentSegment) to avoid cross-thread slug collisions, and text attachments live as directories outside the workspace. runAttachmentSideEffects is reworked to prune only thread-owned directory attachments without removing legacy image attachments still referenced elsewhere.

Message collapse now measures visible markdown (measureComposerMarkdownVisibleLength) so short prompts with long hidden attachment paths are not collapsed incorrectly.

Reviewed by Cursor Bugbot for commit 1f2cbca. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add support for non-image chat attachments

This PR contains only blank line modifications. Despite the title indicating support for non-image chat attachments, no functional changes are present.

Macroscope summarized 1f2cbca.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 43778ade-25c1-4623-af5c-fccebcd6ec43

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Jul 13, 2026
@macroscopeapp

macroscopeapp Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 1f2cbca

Macroscope's review found this PR approvable — The specified base and head resolve to identical repository trees, with zero changed files or line changes. Despite the feature-oriented title, this PR has no runtime impact to review.

Notes:

  • No code objects were reviewed. Approvability was decided on eligibility alone.

You can add or adjust custom eligibility rules. Learn more.

Comment thread apps/web/src/components/chat/ChatComposer.tsx Outdated
Comment thread apps/web/src/components/chat/ChatComposer.tsx Outdated
Comment thread apps/web/src/components/chat/ChatComposer.tsx Outdated
Comment thread apps/web/src/components/chat/ChatComposer.tsx Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f044e403be

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/web/src/components/chat/ChatComposer.tsx Outdated
Comment thread apps/web/src/components/chat/ChatComposer.tsx Outdated
Comment thread apps/web/src/components/chat/ChatComposer.tsx Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c7e248cb18

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/web/src/components/chat/ChatComposer.tsx Outdated
@jakeleventhal jakeleventhal changed the title t3code/support markdown chat attachments t3code/support non-image chat attachments Jul 18, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3a5cf3e282

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/web/src/components/chat/ChatComposer.tsx Outdated
Comment thread apps/web/src/components/chat/ChatComposer.tsx Outdated
Comment thread apps/web/src/components/chat/ChatComposer.tsx Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 26a4c8e14f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/web/src/components/chat/ChatComposer.tsx Outdated
@jakeleventhal
jakeleventhal force-pushed the t3code/support-markdown-chat-attachments branch from 26a4c8e to 2b01a69 Compare July 25, 2026 01:24

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

if (nextImageCount >= PROVIDER_SEND_TURN_MAX_ATTACHMENTS) {
error = `You can attach up to ${PROVIDER_SEND_TURN_MAX_ATTACHMENTS} images per message.`;
break;

P2 Badge Continue processing text files after reaching the image cap

When the composer already has eight images, or the current drop reaches that limit, encountering one additional image executes this break and silently skips every later file in the same drop. This now incorrectly discards otherwise supported text attachments that happen to follow the excess image, even though the reported limit applies only to images; record the image error and continue scanning the remaining files instead.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/web/src/components/chat/MessagesTimeline.tsx Outdated
Comment thread apps/web/src/components/chat/ChatComposer.tsx Outdated
@Reston

Reston commented Jul 29, 2026

Copy link
Copy Markdown

I need this, plenty of times I want to give context to the chat and I had to copy the path manually in order to work, in codex cli automatically I can paste and it gives the filepath so the model can fetch it.

@jakeleventhal
jakeleventhal force-pushed the t3code/support-markdown-chat-attachments branch from 2b01a69 to 58a0171 Compare August 10, 2026 19:33
@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Aug 10, 2026

@macroscopeapp macroscopeapp 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.

Effect service conventions: two error-modeling issues in the new projects.writeTextAttachment path.

Posted via Macroscope — Effect Service Conventions

Comment thread apps/server/src/ws.ts Outdated
Comment thread packages/contracts/src/project.ts Outdated
Comment thread apps/web/src/components/chat/ChatComposer.tsx Outdated
Comment thread apps/server/src/workspace/WorkspaceFileSystem.ts Outdated
Comment thread apps/web/src/components/chat/ChatComposer.tsx
Comment thread apps/server/src/workspace/WorkspaceFileSystem.ts Outdated
Comment thread apps/web/src/components/chat/ChatComposer.tsx Outdated
Comment thread apps/web/src/components/chat/ChatComposer.tsx Outdated
@jakeleventhal
jakeleventhal force-pushed the t3code/support-markdown-chat-attachments branch from 58a0171 to 2955bbd Compare August 10, 2026 20:18
@github-actions github-actions Bot added size:XL 500-999 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Aug 10, 2026
Comment thread apps/server/src/attachmentStore.ts Outdated
Comment thread apps/server/src/orchestration/Layers/ProjectionPipeline.ts
Comment thread packages/shared/src/composerInlineTokens.ts Outdated
Comment thread packages/shared/src/composerInlineTokens.ts Outdated
Comment thread packages/shared/src/composerInlineTokens.ts Outdated
Comment thread apps/server/src/attachmentStore.ts Outdated
Comment thread apps/server/src/attachmentStore.ts
Comment thread apps/server/src/orchestration/Layers/ProjectionPipeline.ts
Comment thread apps/server/src/orchestration/Layers/ProjectionPipeline.ts

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a36b386. Configure here.

Comment thread apps/server/src/orchestration/Layers/ProjectionPipeline.ts
@t3dotgg t3dotgg added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. and removed vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Aug 24, 2026
@jakeleventhal

Copy link
Copy Markdown
Contributor Author

Synced this branch to current upstream main in 1f2cbca. The resulting tree is identical to main: the non-image attachment feature from this PR has now shipped upstream through the generic attachment upload/claim pipeline, with subsequent validation, cleanup, download, draft recovery, provider, web, and mobile hardening. All 32 review threads are resolved and there is no remaining diff, so I am closing this PR as superseded.

@github-actions github-actions Bot added size:XS 0-9 changed lines (additions + deletions). and removed size:XL 500-999 changed lines (additions + deletions). labels Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants