Repository navigation
perf(mapping-store): bound concurrent startup I/O reading (Refs #595) - #609
Closed
Tericerice wants to merge 4 commits into
Closed
Tericerice wants to merge 4 commits into
Tericerice wants to merge 4 commits into
Conversation
…hived threads (BytePioneer-AI#595) - Bound file reading concurrency during MappingStore.initialize() with configurable concurrency limit (default 16) - Persist archived thread index (archived-threads.json) to bypass reading archived files on startup - Lazily load archived threads and their metadata on demand - Preserve orphaned metadata cleanup semantics without deleting archived thread metadata - Add startup performance and lazy loading unit tests Fixes BytePioneer-AI#595 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…I#595 - Ensure all records (active and archived stubs) are present in memory for full session tree and uniqueness resolution (M6, B1, M3) - Retain createRequestId and nativeSessionKey indexes across all threads (M3) - Deduplicate in-flight lazy detail loading with Promise sharing (B2, M2) - Revert app-server-host list pre-filtering to preserve subagent session tree parent resolution (M6) - Handle mapConcurrent worker errors cleanly with allSettled before releasing locks (M5) - Clean up archived-threads.json.tmp-* residue in store root (Minor 2) - Enforce finite concurrency validation (Minor 1) - Add comprehensive regression tests for uniqueness, provisional conflict, and in-flight deduplication Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r-AI#595) - Introduce mapConcurrent worker pool in MappingStore.initialize() for bounded concurrent reading of thread files, orphaned metadata, and delegations (default concurrency 16, configurable via options.concurrency) - Safely drain in-flight workers via Promise.allSettled on error before releasing the store lock - Strictly validate concurrency input to ensure finite, positive integers - Retain 100% of existing thread and turn mapping semantics without altering in-memory record structures or index contracts - Add unit tests for bounded concurrency, concurrency option validation, and safe error handling Fixes BytePioneer-AI#595 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ests (BytePioneer-AI#595) - Use explicit boolean failed sentinel in mapConcurrent to guard against falsy rejections - Clean up archived-threads.json* residue in store root - Add integration test asserting failure propagation and store lock release on initialization error Co-Authored-By: Claude Opus 5.5 <[email protected]>
Owner
|
感谢贡献!我们已关注到这个 PR,会尽快安排审查。 |
Owner
|
感谢你的贡献!想确认一下,这个 PR 当前是否已经准备好转为正式 PR(Ready for review),进入评审? 如果已经准备好,欢迎取消草稿状态;如果仍在开发、存在阻塞或希望暂缓,也欢迎简单说明当前进展,方便我们安排后续评审。谢谢! |
Collaborator
|
感谢贡献!本草稿已停滞一段时间且未转 Ready,这边先致谢关闭;同时我们已保留“启动时 |
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.
目的 (Purpose)
缓解在机械硬盘(HDD)或较慢存储介质上,当历史会话积累较多(如 700+ 会话)时,
MappingStore.initialize()因串行读取每个线程文件及元数据导致累积耗时过长甚至可能超时的问题(#595 部分缓解)。关联 Issue (Linked Issues)
Refs #595(部分缓解)
实现范围 (Scope of Changes)
mapConcurrent异步工作池,在MappingStore.initialize()读取线程、孤儿元数据与委托记录时引入可配置的并发上限(默认 16,options.concurrency可定制,严格校验有限正整数),消除原串行for ... await的 I/O 寻道延迟累积。failed标志结合await Promise.allSettled(workers),确保遇到首个读取异常时终止后续任务派发,并等待所有在途 worker 安全退出后再释放锁与向上抛错。7ef776f64a1a033ed8b980040f02175eb08b8d70;dcd7999da9c9b56d607e4d590db80d736935416e系根据复核建议顺手追加的辅助性优化(增加独立布尔 failed 标志防范 falsy rejection、补全测试以及清理临时残留)。验证与性能实测 (Validation & Benchmarks)
packages/mapping-store/test/startup-performance.test.ts,验证并发上限限制、非法并发参数归一化及异常路径 worker 安全排空。packages/mapping-store74 个单元测试全部通过。npm run typecheck、npm run lint、tools/check-boundaries.mjs全部 0 错误。concurrency=1耗时 433ms →concurrency=16耗时 182ms(提速约 2.4 倍,4~16 并发后性能饱和)。后续工作 (Follow-up Work)
根据 Pi r3 与 Codex r3 复核建议,以下列入后续演进:
#cleanupResidue()改造为有界并发清理;initialize()内部记录列表增加按 ID 稳定排序契约(避免并发读取带来的微弱顺序不确定性);mapConcurrent补充泛型自保与独立微工具包沉淀。🤖 Generated with Claude Code