Repository navigation
fix(trace): 本地轨迹默认不限数量,改由 10GB 体积兜底 - #227
Merged
Merged
Conversation
- pruneOldSessions 默认不再按 100 个截断;超过 sessionRetention.maxTotalSize(默认 10GB) 才删,已上传优先、最旧优先;活跃进程在写的会话与 minRetention 窗口内的目录不删 - 淘汰选择抽成纯函数 trace/retention.ts;init-helpers 接入 sessionRetention - 显式 trace.maxSessionsRetained 仍生效;sessionRetention.enabled:false 时不按体积删 - 同步 observability 文档、settings 参考页、disk-usage 登记表与相关注释 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
njfuzrs
enabled auto-merge
October 10, 2026 06:46
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.
改了什么
本地轨迹目录(
~/.sid-code/trajectories/sessions/)的清理从「默认留最近 100 个」改为与会话保留(#218)同口径:trace.maxSessionsRetained)sessionRetention.maxTotalSize(10GB),超了才删minRetention(1d)窗口内的目录不删packages/core/src/trace/retention.ts:已上传优先、最旧优先。init-helpers.ts把sessionRetention接进 collector;enabled:false时不按体积删。website/team/observability.md「本地保留多少」、website/ref/settings.md、disk-usage.ts登记表,以及collector.ts/session-index.ts/backfill.ts里引用旧默认 100 的注释。.agents/notes/implemented/bug-fix/2026-10-10-轨迹保留默认不限数量改体积兜底.md为什么
#218 遗留的已知边界:一天几十个会话时,轨迹先于会话被 100 截断。实测开发者本机已顶到 100 个,最早只到 2026-09-11(约 2~4 周)。调试要用的
raw.jsonl/session.traj/events.jsonl(trace-digest、provider-health的数据源)回头就找不到了。旧注释「不要调大上限」的前提是「原始轨迹 ≈45MB/会话」,实测 100 个目录合计 37MB(p50 24KB / p95 1.3MB / max 3.2MB),差了一个数量级以上。长期指标仍由
session-index.jsonl/usage-ledger.jsonl承担,不受影响。测试
packages/core/tests/trace/retention.test.ts(9 个用例):反向门禁「150 个旧目录默认全部保留」、体积超限按已上传优先 + 最旧优先、保护窗口与活跃进程不删、非法数量不会解读成「保留 0 个」、maxTotalBytes=0不删。?? 100,反向门禁变红(8 pass / 1 fail),还原后全绿。bun run affected-tests:run:2502 pass / 0 fail;make build和自检都通过(没有will always be undefined警告);lint/lint:boundary/format:check/docs:gen-reference --check都通过。🤖 Generated with Claude Code