fix(coderd): use pasted-text attachments as chat title input - #27067
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7d1ee8cc4b
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
A chat created with only a pasted-text attachment (the chat UI collapses large pastes into synthetic .txt files) had no title input: the create path, async auto-titling, and manual title generation all derived text only from text and file-reference parts, leaving such chats permanently named "New Chat" with generation silently skipped. Add chatprompt.TitleText as the single title-input derivation, with synthetic paste content as a fallback when text parts yield nothing, plus chatprompt.SyntheticPasteFileIDs and chatprompt.FallbackTitle to consolidate the duplicated fallback-title logic. Wire it through chat creation, GenerateChatTitleAsync, and the manual propose/regenerate paths, which resolve paste file content only when a user message has no other title text.
…t parsing Mixed messages with text parts and synthetic pasted-text attachments copied every paste blob to a string that TitleText then ignored. Retain blob references during part validation and materialize strings only when text and file-reference parts yield no title input.
da178eb to
ae3d9f3
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: da178eb6b5
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ae3d9f39ce
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a93b02ed91
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Closes https://linear.app/codercom/issue/CODAGT-268
Problem
The chat UI collapses large pastes (>=10 lines or >=1000 chars) into a synthetic
pasted-text-*.txtattachment. A chat created with only such an attachment had no title input anywhere: the create path derivedtitleSourceonly from text and file-reference parts (so the chat was named "New Chat"), async auto-titling extracted text the same way and silently skipped generation, and the manual propose/regenerate paths returned an empty title for the same reason. The regular prompt path already inlines these files for the model; only the title paths were blind.Fix
Add a single title-input derivation in
chatpromptand use it everywhere:chatprompt.TitleTextjoins text and file-reference parts (unchanged formatting), and falls back to synthetic pasted-text attachment content (truncated to a 16 KiB title budget) when they yield nothing.chatprompt.SyntheticPasteFileIDsidentifies paste attachments;chatprompt.FallbackTitleconsolidates the previously duplicatedchatTitleFromMessage/fallbackChatTitle.titleSourceviaTitleText. Only the create path derives titles; message send and edit reuse the same validation without copying any blob data.GenerateChatTitleAsyncand the manual propose/regenerate paths resolve paste content viatitlePasteText, which only queries when a visible user message has no other title text, so chats with typed text never incur a file fetch.GetChatFileDataPrefixesByIDsquery returns only asubstrprefix (chatprompt.TitlePasteBytePrefix, 64 KiB = 4 bytes x the 16 Ki-rune title budget) so full blobs (up to 10 MiB each) never leave the database for titling, andchatprompt.TitlePasteTextapplies the same bound to the create path which already holds the loaded row.Deliberate side effect: because generation-time extraction now matches create-time
titleSourceexactly, file-reference-only chats also become eligible for AI titles. They were previously skipped by the same derivation mismatch.Non-goals: no frontend changes (attachment chip UX stays as is), and non-synthetic user-uploaded
.txtfiles still yield "New Chat".Testing
TitleText,TitlePasteText,SyntheticPasteFileIDs,FallbackTitle,titleInput,titlePasteText, and paste-awareextractManualTitleTurns.GetChatFileDataPrefixesByIDs(prefix shorter and longer than stored data) plus dbauthz coverage for the new query.RegenerateChatTitleworks on a paste-only chat.