fix(tasks): show renames instantly in sidebar and never overwrite them#2154
fix(tasks): show renames instantly in sidebar and never overwrite them#2154pauldambra wants to merge 3 commits into
Conversation
Two related issues with manual task renames: 1. The sidebar task list reads from the ["tasks", "summaries"] query cache (via useTaskSummaries), but the rename optimistic update and onSuccess invalidation only touched ["tasks", "list"]. The sidebar therefore waited up to 30s (the polling interval) to show the new title, even though the header updated instantly. Now both caches are updated optimistically and invalidated on success. 2. useChatTitleGenerator skipped the title_manually_set check on the first generation, so if a user renamed a task before the first prompt's auto- title finished, their rename got clobbered. title_manually_set is now respected unconditionally. Generated-By: PostHog Code Task-Id: 07a0cd34-65e0-4e58-bbc9-d9d103d1f251
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 900df3ba1d
ℹ️ 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".
The auto-title path calls client.updateTask directly (not via useUpdateTask), so the onSuccess invalidation added earlier in this PR doesn't fire here. Without this, an auto-generated title would still take up to 30 s to appear in the sidebar — the same root cause this PR fixes for manual renames. Generated-By: PostHog Code Task-Id: 07a0cd34-65e0-4e58-bbc9-d9d103d1f251
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
apps/code/src/renderer/features/sessions/hooks/useChatTitleGenerator.test.ts:119-122
**Missing coverage for summaries cache update**
The PR's main new line in `useChatTitleGenerator.ts` — the `setQueriesData` call that updates `["tasks", "summaries"]` — has no corresponding test assertion. The "generates title on first prompt" test only verifies `mockUpdateTask` was called; it never checks that `mockSetQueriesData` was also called with `{ queryKey: ["tasks", "summaries"] }`. A test covering the happy path should assert that both the list and summaries caches are updated so future regressions to that line are caught.
Reviews (2): Last reviewed commit: "fix(tasks): also write auto-titles into ..." | Re-trigger Greptile |
Regression guard for the previous commit so the summaries-cache write in useChatTitleGenerator can't be silently dropped. Generated-By: PostHog Code Task-Id: 07a0cd34-65e0-4e58-bbc9-d9d103d1f251
|
Reviews (3): Last reviewed commit: "test(tasks): assert auto-title writes to..." | Re-trigger Greptile |
Summary
Two related bugs with manual task renames:
["tasks", "summaries"]query cache (viauseTaskSummaries), but the rename flow only touched["tasks", "list"]. So the header updated instantly while the sidebar waited for the next poll. Now both caches are written optimistically inSidebarMenu.handleTaskEditSubmit, invalidated inuseUpdateTask.onSuccess, and rolled back in the catch branch.useChatTitleGeneratorhad a!isFirstGenerationcarve-out that bypassed thetitle_manually_setguard. If the user renamed a task before the first prompt's auto-title finished, their rename was overwritten. The carve-out is removed —title_manually_setis now respected unconditionally.Files changed
apps/code/src/renderer/features/sidebar/components/SidebarMenu.tsx— optimistic write + rollback for the summaries cache.apps/code/src/renderer/features/tasks/hooks/useTasks.ts— invalidate summaries inuseUpdateTask.onSuccess.apps/code/src/renderer/features/sessions/hooks/useChatTitleGenerator.ts— drop the first-generation carve-out.apps/code/src/renderer/features/sessions/hooks/useChatTitleGenerator.test.ts— flipped the test that documented the old behavior.Test plan
pnpm --filter code typecheckpnpm --filter code test— 1224 tests pass