refactor(auto-title): Untangle auto-title generator#2428
Merged
Conversation
This was referenced May 29, 2026
Member
Author
2 tasks
Contributor
What T-Rex did
ArtifactsVerbose rename edge-case test output
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
apps/code/src/renderer/features/sessions/hooks/useChatTitleGenerator.ts:111
**Preserve manual titles** The manual-title lock only checks `getCachedTask(taskId)`, but that helper scans task list queries and can return `undefined` when the detail page has the task but the sidebar list cache is missing or stale. In that state a task whose `task` prop already has `title_manually_set: true` is treated as unlocked, so the next generated title can overwrite a user rename.
```suggestion
const titleLocked = isAutoTitleLocked(getCachedTask(taskId) ?? task);
```
### Issue 2 of 2
apps/code/src/renderer/features/sessions/hooks/useChatTitleGenerator.ts:161-167
**Keep prompt counter** Description-based generation currently advances `lastGeneratedAtCount` to `1`. When the first real prompt event arrives, the `promptCount === 1 && lastGeneratedAtCount.current === 0` branch no longer runs, so the first prompt is skipped and prompt-based title/summary generation waits until several more prompts arrive. This can leave the session summary missing or stale after the conversation starts.
```suggestion
if (shouldGenerateFromTaskDescription) {
initialDescriptionHandled.current = true;
}
```
Reviews (1): Last reviewed commit: "clean up auto-title path and add rename ..." | Re-trigger Greptile |
7fad3b2 to
f205d09
Compare
aebda98 to
fb78347
Compare
918979c to
7b11dd7
Compare
k11kirky
approved these changes
May 29, 2026
This was referenced May 29, 2026
Merged
Contributor
7b11dd7 to
209767a
Compare
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.

Problem
The auto-title generator was broken. Layers of edge-case guards and duplicated rename logic across components had papered over the real flow until nothing worked reliably. This rips out the patches and rewires it end to end.
Closes #2397
Changes
How did you test this?
Manually
Automatic notifications