fix(qoder-cn): 解析新版 Qoder CN(com.qodercn.app.stable)的 ~/.qoder-cn/projects JSONL 会话 - #586
Conversation
The new CN app (com.qoder.app.stable sibling com.qodercn.app.stable, 2026-08+) stopped writing SharedClientCache/local.db and now writes Claude-style session JSONL under ~/.qoder-cn/projects. PR xiufengsun#549 assumed CN shared ~/.qoder/projects with the international edition, so resolveQoderCnProjectsDir pointed at the international directory and the CN-dir-diverges guard in sync.js/status.js always skipped parsing — new-version CN usage was silently untracked (legacy DB stalled 2026-08). - resolveQoderCnProjectsDir now defaults to ~/.qoder-cn/projects (QODER_CN_PROJECTS_DIR still overrides; WSL probes .qoder-cn) - strip the install-local BYOK provider UUID from CN model ids (qoder-custom-<uuid>/glm-5.3-flash -> glm-5.3-flash) so bucket keys stay stable instead of fragmenting per user - tests: CN default/override resolver regression + end-to-end CN parser case (precise Anthropic-style usage, streamed duplicate message ids, subagent transcripts, 'auto' rows without usage)
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughQoder CN project resolution now uses ChangesQoder CN session handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to 此变更将新版 Qoder CN 会话发现切换到独立目录,并稳定化 BYOK 模型统计键。现有覆盖验证了目录隔离、解析聚合、去重与重复同步无新增数据,当前可合并。 Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant CNSessionFiles
participant parseQoderNewIncremental
participant qoderNewModelFromRecord
participant BucketAndCursorState
CNSessionFiles->>parseQoderNewIncremental: Provide CN transcript and subagent JSONL rows
parseQoderNewIncremental->>qoderNewModelFromRecord: Normalize model identifier
qoderNewModelFromRecord->>BucketAndCursorState: Use bare model id and preserve cursor identifier
parseQoderNewIncremental->>BucketAndCursorState: Aggregate usage and update cursor
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. (1 skipped: 1 too large.)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
已通过 #589 合并,保留了你的原始提交。已验证 CN 独立目录、BYOK 模型归一化、去重及重复同步幂等性,完整回归和跨平台 CI 均通过。无需再修改;本次尚未发布新的 npm/桌面版本,谢谢! |
背景
PR #549 修复了国际版新版 Qoder(com.qoder.app.stable)的 JSONL 会话追踪,并为 CN 预留了完整的接线(sync 块、qoderCnNew 游标、status 展示),但当时假设 CN 与国际版共享
~/.qoder/projects,resolveQoderCnProjectsDir的默认值也指向了国际目录。实测新版 Qoder CN(
com.qodercn.app.stable,app 0.1.8 / agent 1.1.44)把会话写在兄弟目录~/.qoder-cn/projects,于是 sync.js / status.js 中「CN 目录与国际目录分离才解析」的防重复守卫恒为假——新版 CN 的 usage 从未被解析(而旧 CN 库QoderCN/SharedClientCache/cache/db/local.db已于 2026-08 停写,CN 计数就此断流)。改动
resolveQoderCnProjectsDir默认改~/.qoder-cn/projects(QODER_CN_PROJECTS_DIR仍可覆盖;Windows WSL 探测.qoder-cn);QODER_HOME/QODER_PROJECTS_DIR(国际版专属)不会影响 CN 解析qoder-custom-<uuid>/glm-5.3-flash→glm-5.3-flash),桶键跨重装稳定、不按用户碎片化;官方 id(qmodel_*)原样保留sync.js/status.js逻辑零改动,仅更新过时注释(目录修正后守卫自动生效)auto行跳过、二次同步幂等)验证
npm test:2643 项 / 2635 过;6 个失败为 upstream/main 基线同集合的环境性失败(stash 对比确认,零回归)Summary by CodeRabbit
~/.qoder-cn/projectsdirectory, preventing duplicate reporting with international projects.