Repository navigation
Conversation
Remove cursors.json file entries when the log file is gone but its parent directory still exists, and persist that cleanup even when a sync round produced no new usage rows.
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.
🏷️ 变动类型
🖥️ 影响范围
🔗 关联 Issue
关联 #266 中“各渠道
files在日志删除后不清理”的独立子问题;本 PR 不关闭该 Issue 的按渠道拆分和 Claude 状态上限事项。💡 改动说明
Summary
同步写回
cursors.json时,删除“绝对路径已不存在、但父目录仍在”的files游标;即使本轮没有新的用量行,也会把这次清理持久化。Root cause
除 TeleAgent 外,各解析器把已删除日志的路径留在 cursor 里。
saveCursors只在内容变化时重写整份 JSON,这些失效条目会随每轮同步一起序列化。Verification
prune-cursor-files/cursors-cache/cursors-atomic-write/cursor-json)。corepack pnpm --filter @juejin-opensource/jusage-core build通过。git diff --check通过。Before / after
cursors.json继续保留该文件偏移。Risk and scope
只清理各渠道 cursor 中的
files映射。不修改 token 解析、去重集合、ClaudeseenUsage上限,也不做cursors.json按渠道拆分。新增 core patch changeset。Not tested
cursors.json做端到端同步。📝 Changelog
@juejin-opensource/jusage-core☑️ 自查清单
<type>/<end>/<short-desc>:fix/cli/prune-stale-cursor-filespnpm build通过