perf: use incremental chat message fingerprinting#40
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a4bd258c76
ℹ️ 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".
| if (part.type === "text") { | ||
| textPartLength += part.text.length | ||
| } else if (part.type === "file") { | ||
| filePartCount += 1 | ||
| } else if (part.type === "reasoning") { |
There was a problem hiding this comment.
Include tool invocation state in message fingerprint
This fingerprint only tracks message count plus coarse metadata from the last message (text length and part counts), so updates to tool-invocation parts are not detected when their count stays the same. In this component, addToolResult(...) mutates existing tool-call parts in place; if the tool state/output changes but lengths/counts do not, usePersistMessagesOnChange treats the chat as unchanged and skips cloud/local persistence, which can leave restored sessions with stale or incomplete tool-call state.
Useful? React with 👍 / 👎.
This comment has been minimized.
This comment has been minimized.
39e27c4 to
998ca72
Compare
|
Bugbot Autofix prepared fixes for 2 of the 2 bugs found in the latest run.
|
647c478 to
f72af4c
Compare
Summary
Validation
pnpm buildCloses #28
Note
Low Risk
Localized performance change in sync change-detection; main risk is missing updates when older messages change or metadata is absent, potentially delaying a save.
Overview
Replaces the chat history change-detection fingerprint from a full
JSON.stringifyof all messages to a lightweight string based on message count plus the latest message’s id/role/timestamp and a summary of its parts (text length, file/reasoning counts).This reduces repeated serialization cost during local/cloud persistence and invalidation logic, while keeping behavior centered on detecting changes to the most recent message state.
Written by Cursor Bugbot for commit f72af4c. This will update automatically on new commits. Configure here.