Skip to content

refactor(auto-title): Untangle auto-title generator#2428

Merged
k11kirky merged 5 commits into
mainfrom
05-28-fix_task_titel_generation
May 29, 2026
Merged

refactor(auto-title): Untangle auto-title generator#2428
k11kirky merged 5 commits into
mainfrom
05-28-fix_task_titel_generation

Conversation

@charlesvien
Copy link
Copy Markdown
Member

@charlesvien charlesvien commented May 29, 2026

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

  1. Pass the Task into useChatTitleGenerator so it can run off description, not just session prompts
  2. Drop the manual "Untitled" fallback in task-creation.ts so the generator is the single source of truth
  3. Gate generation on auth state and skip when the user has manually renamed (isAutoTitleLocked)
  4. Collapse the duplicated rename flows in SidebarMenu and TaskDetail into one useRenameTask hook
  5. Thread currentTitle through onTaskEditSubmit so rename can no-op on unchanged input

How did you test this?

Manually

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

@charlesvien charlesvien changed the title fix task titel generation refactor(auto-title): Untangle auto-title generator May 29, 2026
@charlesvien charlesvien marked this pull request as ready for review May 29, 2026 02:34
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 29, 2026

T-Rex T-Rex Logs

What T-Rex did

  • Set up a focused renderer test harness for the task rename hook and confirmed the existing rename tests pass.
  • Added targeted checks for rapid consecutive renames, unchanged-title submission, and summary cache keys with different task-id arrays.
  • Observed that the rapid-rename check demonstrated a timing sequence where after rename Original -> A was in flight, rename A -> B succeeded, then the first request failed and the cached title was restored to Original.
  • The summary cache key check passed and unchanged-title submission was recorded as an observation rather than a verified condition.
Artifacts

Verbose rename edge-case test output

  • Detailed test run output for the rename edge-case tests, used to inspect rapid-consecutive-renames behavior and cache-key checks.

T-Rex Ran code and verified through T-Rex

Prompt To Fix All With AI
Fix 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

Comment thread apps/code/src/renderer/features/sessions/hooks/useChatTitleGenerator.ts Outdated
Comment thread apps/code/src/renderer/features/tasks/hooks/useTasks.ts
@charlesvien charlesvien force-pushed the 05-28-fix_task_titel_generation branch from 7fad3b2 to f205d09 Compare May 29, 2026 02:48
@charlesvien charlesvien force-pushed the 05-28-refactor_updates_introduce_state_machine_and_guard_staged_updates branch from aebda98 to fb78347 Compare May 29, 2026 05:19
@charlesvien charlesvien force-pushed the 05-28-fix_task_titel_generation branch from 918979c to 7b11dd7 Compare May 29, 2026 05:19
Copy link
Copy Markdown
Contributor

@k11kirky k11kirky left a comment

Choose a reason for hiding this comment

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

nice

Copy link
Copy Markdown
Contributor

k11kirky commented May 29, 2026

Merge activity

  • May 29, 10:26 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • May 29, 10:28 AM UTC: Graphite rebased this pull request as part of a merge.
  • May 29, 10:35 AM UTC: @k11kirky merged this pull request with Graphite.

@k11kirky k11kirky changed the base branch from 05-28-refactor_updates_introduce_state_machine_and_guard_staged_updates to graphite-base/2428 May 29, 2026 10:26
@k11kirky k11kirky changed the base branch from graphite-base/2428 to main May 29, 2026 10:26
@k11kirky k11kirky force-pushed the 05-28-fix_task_titel_generation branch from 7b11dd7 to 209767a Compare May 29, 2026 10:27
@k11kirky k11kirky merged commit c8fc4ab into main May 29, 2026
19 checks passed
@k11kirky k11kirky deleted the 05-28-fix_task_titel_generation branch May 29, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Title summarizer not working

2 participants