Merged
Conversation
When documents were attached in the first message of a thread, the
embeddings-vs-inline dialog never appeared because
processNewDocumentAttachments bailed out on missing currentThreadId.
Additionally, attachments were cleared from the store before the thread
detail page could transfer them, and embeddings started generating
eagerly at attach time rather than at send time.
- processNewDocumentAttachments now only collects the user's mode
preference via the dialog and stores it as parseMode on the
attachment. Actual ingestion is always deferred to send time.
- handleSendMessage (home screen) no longer clears attachments,
allowing the thread detail page to transfer and process them.
- processAndSendMessage shows a preview user message immediately so
the UI doesn't hang while embeddings are generated, with a shimmer
indicator ("Processing embeddings...") visible during ingestion.
- Removed the "Uploading attachments" progress bar from ChatInput as
it was redundant with the new send-time processing flow.
The shimmer was showing for inline documents too. Now it only appears when at least one unprocessed document has a non-inline parseMode.
- useChatAttachments: 11 tests covering get/set/clear/transfer operations, parseMode preservation through transfer, and the NEW_THREAD_ATTACHMENT_KEY default. - useAttachmentIngestionPrompt: 5 tests covering modal open/close, choose/cancel resolution, and sequential multi-document prompts. - processAttachmentsForSend: 11 tests covering inline/embeddings routing, parseMode handling, project file override, per-file choices, fallback on parse failure, skip-if-processed, mixed attachment types, and callback invocations.
Contributor
Code Review — first reviewSummaryThis PR reworks the document attachment flow so that:
This is a significant UX fix for the first-message-of-a-thread flow where documents were attached but the embeddings dialog never appeared. Files Changed
Detailed ReviewChatInput.tsx — Simplification (positive)
ChatInput.tsx — processNewDocumentAttachments simplification
$threadId.tsx — Preview message pattern
Potential issue — attachment clearing timing
Variable shadowing
Test coverage (positive)
Dependency array changes
Risks
Minor
Recommendation: improve needed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe Your Changes
When documents were attached in the first message of a thread, the
embeddings-vs-inline dialog never appeared because
processNewDocumentAttachments bailed out on missing currentThreadId.
Additionally, attachments were cleared from the store before the thread
detail page could transfer them, and embeddings started generating
eagerly at attach time rather than at send time.
processNewDocumentAttachments now only collects the user's mode
preference via the dialog and stores it as parseMode on the
attachment. Actual ingestion is always deferred to send time.
handleSendMessage (home screen) no longer clears attachments,
allowing the thread detail page to transfer and process them.
processAndSendMessage shows a preview user message immediately so
the UI doesn't hang while embeddings are generated, with a shimmer
indicator ("Processing embeddings...") visible during ingestion.
Removed the "Uploading attachments" progress bar from ChatInput as
it was redundant with the new send-time processing flow.
Screencast.From.2026-04-14.12-35-24.mp4
Fixes Issues
Self Checklist