agent-Specialization/test
JOJO 26f31a09ec fix(versioning): 修复 shallow 快照日志重复行导致的 diff 配对错误
根因:state.jsonl 采用只追加日志,track_edit 的中间半成品快照与
make_snapshot 的完整快照各自成行;加载时每行都被回放为独立快照,
_find_snapshot_pair 简单取下标-1 作为上一快照,导致 diff 基准落在
同一条消息自己的半成品行上——半成品中缺失的已跟踪文件被全部判为
added 并按全文件计新增(如 +1928 -0)。

彻底修复(非补丁):
- 持久化改为原子全量重写(temp + os.replace),结构性保证磁盘上
  一条 message_id 永远只有一行
- _load_state 幂等重载并在加载时折叠历史重复行(保留每消息最后一行),
  旧脏数据无需迁移即可透明愈合
- track_edit / make_snapshot 在按 state 文件加锁的临界区内执行
  重载->变更->保存,避免短生命周期实例间丢行
- _find_snapshot_pair 防御性跳过同 message_id 行
- 新增 6 个回归测试(test/test_shallow_versioning.py)

验证:新测试 6/6 通过;test_server_refactor_smoke 6/6 通过;
用 conv_20260721_175016_796 真实数据只读复算,seq8 由 +1295/-0
修正为 +796/-7(3 文件),seq10 由 +1928/-0 修正为 +592/-3(4 文件),
seq31 与历史正确记录 +482/-1 完全一致。
2026-07-22 15:48:11 +08:00
..
all_icons docs: refresh readme and phase2 summary 2025-11-23 21:24:09 +08:00
upload_samples feat: add upload quarantine scanning and ui toasts 2025-11-24 14:31:13 +08:00
deepseek_ocr_tutorial.md <fix thinking chunk> 2025-11-19 20:47:56 +08:00
demo.html docs: refresh readme and phase2 summary 2025-11-23 21:24:09 +08:00
snake.html docs: refresh readme and phase2 summary 2025-11-23 21:24:09 +08:00
test_api_client_multimodal_sanitize.py refactor(models): use dynamic api model registry 2026-05-29 00:20:54 +08:00
test_config_paths_resolution.py refactor(paths): 统一迁移运行态数据路径到 Astrion 命名空间 2026-07-10 00:35:15 +08:00
test_conversation_model_persistence.py fix(web_terminal): 程序启动自动恢复最近对话时不恢复模型,避免 /new 页面显示旧对话模型;显式加载对话时仍恢复保存的模型 2026-07-13 21:43:51 +08:00
test_conversation_workspace_storage.py feat(memory): refactor proactive memory and conversation recall 2026-05-27 03:09:42 +08:00
test_file_manager_read_empty_file.py feat(host-security+ui): unify host execution/approval behavior, runtime notices, and approval overlay UX 2026-05-12 19:16:38 +08:00
test_host_workspace_manager.py feat: add host workspace manager, mcp-tool-config skill, and UI enhancements 2026-04-28 13:04:51 +08:00
test_mcp_integration.py fix(prompt): merge disabled-tool notice into leading system prompts 2026-05-09 18:56:49 +08:00
test_media_store_and_mcp_content.py fix: avoid fake MCP completion text for empty results 2026-04-27 13:17:22 +08:00
test_server_refactor_smoke.py feat: 移除实验性间隔思考模式,推理强度前置到前端 2026-07-21 13:47:53 +08:00
test_shallow_versioning.py fix(versioning): 修复 shallow 快照日志重复行导致的 diff 配对错误 2026-07-22 15:48:11 +08:00
test_skills_manager.py refactor(paths): 统一迁移运行态数据路径到 Astrion 命名空间 2026-07-10 00:35:15 +08:00
test_sub_agent_regression.py fix(sub_agent): 移除 search_workspace 工具并清理内存调试代码 2026-07-17 14:05:35 +08:00
test_token_usage_extractor.py refactor(models): use dynamic api model registry 2026-05-29 00:20:54 +08:00
test_tool_result_formatter.py refactor(paths): 统一迁移运行态数据路径到 Astrion 命名空间 2026-07-10 00:35:15 +08:00
截屏2025-11-18 16.12.11.png <fix thinking chunk> 2025-11-19 20:47:56 +08:00