Commit ff47aae
authored
fix(copilot): stop async chat auto-titling from clobbering an explicit rename (#7414)
Chat title generation is fired at turn start and resolves asynchronously, but
its write was unconditional (`WHERE id = chatId`), re-checking nothing. The
guard that decides whether to generate reads a snapshot taken at request start,
so a title generated from that snapshot could land long after the user renamed
the chat and overwrite the rename — a classic check-then-write race. A user who
renames a chat shortly after their first message could silently lose the rename.
Make the write conditional on the title still being unset, so the generated
title fills an empty slot and can never overwrite an explicit one, and skip the
follow-up notification when the write lost the race (so we never announce a
title the row no longer holds).
Both auto-title call sites are fixed: the interactive turn path
(lib/copilot/request/lifecycle/start.ts) and the inbox task path
(lib/mothership/inbox/executor.ts), which had the identical unconditional write.1 parent d218534 commit ff47aae
2 files changed
Lines changed: 24 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
489 | 489 | | |
490 | 490 | | |
491 | 491 | | |
492 | | - | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
493 | 503 | | |
494 | 504 | | |
495 | 505 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
171 | 181 | | |
172 | 182 | | |
173 | 183 | | |
| |||
0 commit comments