Repository navigation
feat(chat): support deleting a chat turn (soft delete) - #784
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
Thank you @rcpeken to take this issue, it is not the first issue for new user, and your PR shows you understand the codebase very well :). Could you sign the CLA then I can merge? |
|
@haiphucnguyen Thanks a lot for the kind words! I've signed the CLA. |
haiphucnguyen
left a comment
There was a problem hiding this comment.
Thank you @rcpeken for this great PR!
|
Thanks a lot @haiphucnguyen , it was a pleasure working on this! I'd be happy to keep contributing to Askimo. #345 (source-aware RRF in HybridContentRetriever) caught my eye since I'm focusing on ML and retrieval. I'll take a closer look at the code and comment on the issue before starting. |
|
Sure, can you discuss in that ticket then I can assign to you. In fact, the quality of RAG is what I am concerning :). I also plan to look into the knowledge graph to increase the precisity of the AI answer. I am looking forward to your contribution! |
Closes #778
What
Adds turn-level delete for chat messages, as discussed in #778.
chat_messages.deleted_atcolumn (66.sqm+ guardedAfterVersion(66)callback, anchored at the same number as the.sqmfile per the rule documented inSqlDelightSchemaMigrations).deleted_at IS NULL: session messages and pagination (also used by export), per-session and global search,selectRecentActive(LLM memory), all bookmark queries, and the phrase-habit/suggestion queries.ChatMessageRepository.softDeleteTurnsoft-deletes the user message and every message after it up to the next user message. This covers the normal response, a failed or missing response, and regenerated responses (the outdated attempts plus the active one).ChatSessionService.deleteTurndeletes the persisted session memory and reloads the recent non-deleted messages vialoadFromFilteredMemory, the same pattern asmarkMessagesAsOutdatedAfter. Unlike that method, it also rebuilds when the session isn't cached, because the persisted summary would otherwise bring the deleted turn back.Deliberately left out
selectUnsynced/updateMessageFromServeruntouched).deletedAton theChatMessagedomain model: all reads filter deleted rows, so it would always be null.countByRole(lifetime prompt count) is not filtered.Testing
ChatMessageRepositoryIT: 7 new tests (normal turn, no response, failed response, regenerated responses, invalid ids, hidden from pagination/search/memory reads, hidden bookmarks).ChatSessionServiceIT: 2 new tests (stale persisted session memory is dropped on delete; deleting an assistant message is a no-op).SchemaMigrationEquivalenceTest: new upgrade test that takes a version 66 database withoutdeleted_atand migrates it to the current version.spotlessCheck,detekt,checkI18nKeys,detectMissingLocalizationspass.Notes