Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

fix: Enrich attachment-only task descriptions for title generation - #1980

Merged
charlesvien merged 11 commits into
mainfrom
05-02-enrich_attachment-only_task_descriptions_for_title_generation
May 4, 2026
Merged

fix: Enrich attachment-only task descriptions for title generation#1980
charlesvien merged 11 commits into
mainfrom
05-02-enrich_attachment-only_task_descriptions_for_title_generation

Conversation

@charlesvien

@charlesviencharlesvien commented May 2, 2026

Copy link
Copy Markdown
Member

Problem

Tasks created with only file attachments (pasted text or images) produce generic titles because the LLM has no meaningful text to work with.

Changes

  1. Add enrichDescriptionWithFileContent to read attached file contents and build a meaningful description for the title generator
  2. Fire onEmptyChange when attachments change so the editor correctly tracks emptiness
  3. Move title generation from the creation saga to useChatTitleGenerator hook, generating on the first prompt instead
  4. Pass a plain-text fallback as title on task creation so titles are never blank
  5. Cap generated titles to 255 chars and skip the manual-set check on first generation
  6. Add comprehensive tests for enrichDescriptionWithFileContent

How did you test this?

Manually

@charlesviencharlesvien changed the title Enrich attachment-only task descriptions for title generationfix: Enrich attachment-only task descriptions for title generationMay 2, 2026
@charlesvien
charlesvien marked this pull request as ready for review May 3, 2026 17:55
@greptile-apps

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---### Issue 1 of 1
apps/code/src/renderer/utils/generateTitle.test.ts:75-94
**Prefer parameterised tests for fallback cases**
These three tests all verify that the `[Attached: <filename>]` hint is returned, and differ only in the setup (binary extension, read throws, read returns null). Per the project's testing conventions, these should be collapsed into a single `it.each` table.
```tsit.each([
{
label: "binary file",
description: '1. <file path="/tmp/screenshot.png" />',
setup: () => {},
expected: "[Attached: screenshot.png]",
},
{
label: "read throws",
description: '1. <file path="/tmp/missing.ts" />',
setup: () =>mockReadAbsoluteFile.mockRejectedValue(newError("ENOENT")),
expected: "[Attached: missing.ts]",
},
{
label: "read returns null",
description: '1. <file path="/tmp/empty.ts" />',
setup: () =>mockReadAbsoluteFile.mockResolvedValue(null),
expected: "[Attached: empty.ts]",
},
])(
"falls back to filename hint — $label",
async ({ description, setup, expected }) => {
setup();
expect(awaitenrichDescriptionWithFileContent(description)).toBe(expected);
},
);
```

Reviews (1): Last reviewed commit: "Add tests for enrichDescriptionWithFileC..." | Re-trigger Greptile

Comment threadapps/code/src/renderer/utils/generateTitle.test.ts Outdated
@charlesvienGraphite App

charlesvien commented May 4, 2026

Copy link
Copy Markdown
MemberAuthor

Merge activity

  • May 4, 6:05 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • May 4, 6:05 PM UTC: @charlesvien merged this pull request with Graphite.

@charlesvien
charlesvien merged commit b4404cc into mainMay 4, 2026
16 checks passed
@charlesvien
charlesvien deleted the 05-02-enrich_attachment-only_task_descriptions_for_title_generation branch May 4, 2026 18:05
posthogBot pushed a commit that referenced this pull request May 4, 2026
Resolve conflicts in task-creation.ts and task-creation.test.ts.
PR #1980 (now in main) implemented this PR's intent — enriching
attachment-only descriptions for title generation — via
enrichDescriptionWithFileContent in generateTitle.ts and moved
auto-title generation to useChatTitleGenerator. The inline
expandClipboardTextTags / generateTaskTitle from this PR are
redundant and have been dropped, along with the now-unused
readClipboardText route.
Generated-By: PostHog Code
Task-Id: 2a27dd7f-c22d-4ca3-abe8-06ad4b66cfc9
posthogBot pushed a commit that referenced this pull request May 4, 2026
Resolve conflicts in task-creation.ts and task-creation.test.ts.
PR #1980 (now in main) implemented this PR's intent — enriching
attachment-only descriptions for title generation — via
enrichDescriptionWithFileContent in generateTitle.ts and moved
auto-title generation to useChatTitleGenerator. The inline
expandClipboardTextTags / generateTaskTitle from this PR are
redundant and have been dropped, along with the now-unused
readClipboardText route.
Generated-By: PostHog Code
Task-Id: 2a27dd7f-c22d-4ca3-abe8-06ad4b66cfc9
posthogBot pushed a commit that referenced this pull request May 4, 2026
Resolve conflicts in task-creation.ts and task-creation.test.ts.
PR #1980 (now in main) implemented this PR's intent — enriching
attachment-only descriptions for title generation — via
enrichDescriptionWithFileContent in generateTitle.ts and moved
auto-title generation to useChatTitleGenerator. The inline
expandClipboardTextTags / generateTaskTitle from this PR are
redundant and have been dropped, along with the now-unused
readClipboardText route.
Generated-By: PostHog Code
Task-Id: 2a27dd7f-c22d-4ca3-abe8-06ad4b66cfc9
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@charlesvien@jonathanlab