perf+fix: 大历史量下仪表盘不再卡顿;setup 不再吞掉你的 Claude 配置#43
Conversation
IM-23: every dashboard poll (and every CLI command) re-parsed every JSONL under ~/.claude/projects serially — multi-second CPU+IO per request once history reaches a few thousand sessions. SessionMeta is now cached per file and invalidated by mtime+size, unchanged files skip parsing entirely, scans run with bounded concurrency (8), and entries for deleted files are pruned each pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…auth mode IM-7: legacy agent-api-key sessions resolve to mode anthropic-api-key with usesLegacyEnvVar set, but the bare mode was what got persisted — the next stored-config resolution treated the session as browser BYOK and failed with 'API key is required' although preflight passed. Sessions now persist 'agent-api-key' for legacy env-var runtimes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…dard-format hooks
IM-18: a settings.json that failed to parse fell back to {} and the
setup commands overwrote the user's file with a devlog-only object —
silently destroying hooks, model config, and permissions. Corrupt
files now abort with an actionable message and every write keeps a
.bak of the previous content.
IM-16: setup-tmux crashed on standard-format hook entries
({matcher, hooks:[...]}) because h.command.includes assumed the flat
shape; those entries are now preserved untouched.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Claude finished @moose-lab's task in 3m 38s —— View job Code Review
Findings
Verdict: APPROVE All three targeted bugs are real, correctly diagnosed, and fixed:
The should-fix (atomic write) is a real latent risk but extremely unlikely in practice, and the |
CodeQL flagged a TOCTOU between existsSync and copyFileSync in the settings backup path; both load and backup now handle ENOENT directly instead of pre-checking existence. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Claude finished @moose-lab's task in 1m 24s —— View job Code Review (follow-up — commit
|
用户视角:这次更新你会感受到什么
⚡ 会话历史越多,提速越明显
之前每次仪表盘轮询、每条 CLI 命令都把
~/.claude/projects下的所有 JSONL 从头到尾重新解析一遍(串行)——历史到几千个会话时,每次刷新都是数秒级 CPU+IO。现在扫描结果按文件(mtime+大小)缓存,只重读真正变化的文件,并以 8 路并发扫描;删除的文件自动清出缓存。日常使用下,仪表盘刷新从"每次全量解析"变成"几乎零开销"。🛟
devlog setup-statusline/setup-tmux不再破坏你的 Claude Code 配置.bak备份。{matcher, hooks:[...]})直接崩溃,这类条目原样保留。🔑 旧式后端环境变量鉴权的会话不再"第二回合失灵"
用
agent-api-key(后端环境变量)模式启动的会话,首回合正常、续聊时却报 "API key is required"——因为持久化时丢失了 legacy 标记,被误当成浏览器 BYOK。现在标记随会话持久化,续聊正常。范围与验证
🤖 Generated with Claude Code