feat: preserve last chat order after sync#10
Open
songsongshuo785-art wants to merge 2 commits intoDailin521:mainfrom
Open
feat: preserve last chat order after sync#10songsongshuo785-art wants to merge 2 commits intoDailin521:mainfrom
songsongshuo785-art wants to merge 2 commits intoDailin521:mainfrom
Conversation
Dailin521
requested changes
Apr 20, 2026
Owner
Dailin521
left a comment
There was a problem hiding this comment.
感谢提交,这个方向有价值,但当前实现里有一个我认为需要先处理的阻塞点。
阻塞问题:
- 这次改动把 provider sync 的热路径重新变成了按文件扫描完整 rollout 内容。JS 侧在
src/session-files.js的readLastActivityTimestampMs()中直接readFile()整个文件并逐行JSON.parse,而collectSessionChanges()会在每个需要改写 provider 的 rollout 上调用它。.NET侧的ReadLastActivityTimeUtcTicksAsync()也在同一个收集阶段逐行扫描完整文件。 - 这意味着原本只读首行
session_meta的收集路径,重新退化成了按变更文件扫描整份 rollout 内容。对于首次全量 sync 或大量历史会话场景,这会直接落回我们之前刚处理过的性能敏感区,尤其 JS 路径还会把整文件读入内存。
建议先把“排序归一化时间”的来源改成不会在 sync 热路径里全量读取 rollout 的方式,或者至少把这条路径和已有性能基线一起验证清楚,再考虑合入。
Author
|
Thanks for calling this out. I agreed this needed to be fixed before merge, so I updated the branch to remove the rollout full-scan from the sync hot path. What changed:
So the sync path no longer reintroduces per-rollout full-content reads, and the JS path no longer loads the whole rollout into memory just to derive last activity time. Validation I ran locally:pm test
I also added coverage for:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Why
After provider sync, Codex session visibility comes back, but the visible ordering can drift because the rollout file mtime changes during rewrite. Preserving the latest activity timestamp keeps transferred sessions sorted by the most recent chat instead of the sync time.
Validation
npm testdotnet restore desktop/CodexProviderSync.Core.Tests/CodexProviderSync.Core.Tests.csproj --configfile ./NuGet.Configdotnet test desktop/CodexProviderSync.Core.Tests/CodexProviderSync.Core.Tests.csproj --no-restore