Skip to content

feat(store): conversation 归档——trim 裁剪行落盘 conversation-archive.jsonl - #90

Merged
lloydzhou merged 3 commits into
mainfrom
feature/conversation-archive
Sep 10, 2026
Merged

feat(store): conversation 归档——trim 裁剪行落盘 conversation-archive.jsonl#90
lloydzhou merged 3 commits into
mainfrom
feature/conversation-archive

Conversation

@lloydzhou

Copy link
Copy Markdown
Owner

概要

compact 裁剪掉的 conversation 行不再丢弃,归档到 session_dir/conversation-archive.jsonl;SubAgent fork 继承归档文件。

改动(Bash/C/Go/Rust 四版本同步)

  • session init:touch conversation-archive.jsonl
  • SubAgent fork:归档随 conversation.jsonl / summary / plan 一并拷贝
  • store_conv_trim_tail:trim 前把被裁剪行追加进归档(Bash head -n $((total-keep)) >> archive
  • C build_claude_request:跳过空物理行,与 Bash store_conv_get_messages 对齐(请求体一致性)
  • Rust store_conv_total_lines:改字节扫描计数;trim 重写避免 >64KiB 的 JSONL 记录被拆行

测试

  • bash e2e:226/226(新增 fork 归档继承、compact 归档内容断言)
  • Go:单测全过 + e2e 226/226
  • Rust:e2e 226/226
  • C:e2e 226/226 + test-continue 9/9 + test-transport 37/37

顺带修复

  • go/agent_test.gobytes import(编译失败)
  • tests/fixtures/mock_server.py 存活 120s→600s:bash 版全套约 4 分钟,server 中途自杀导致后半段 10 个 mock 依赖测试连坐失败

…ve.jsonl

- Bash/C/Go/Rust: trim 前把被裁剪的 conversation 行追加到 conversation-archive.jsonl
- session init 时 touch 归档文件;SubAgent fork 时随 conversation/summary/plan 一并继承
- C transport: build_claude_request 跳过空物理行,与 Bash store_conv_get_messages 对齐
- Rust store_conv_total_lines 改为字节扫描计数;trim 重写避免大记录(>64KiB)被拆行
- 测试:bash e2e fork/compact 归档断言、C test-continue 9 例、Go 单测扩展
bash 版全套 e2e 约 4 分钟,server 在 120s 自杀导致后半段 10 个
mock 依赖测试连坐失败(device-write/x-app/golden/PlanConfirm/
SubAgent-fork-ctx/stats-speed 等)
@lloydzhou
lloydzhou merged commit 0576d0a into main Sep 10, 2026
40 checks passed
@lloydzhou

Copy link
Copy Markdown
Owner Author

自审完成。

  • 核对 Bash、C、Go、Rust 的会话初始化、fork 与 compact 裁剪路径:归档仅持久化,不进入正常模型请求。
  • 复查 CRLF、空物理行与长 JSONL 记录的裁剪字节边界。
  • 全量 Bash 测试已通过:226 通过、0 失败。
  • 当前主分支工作区无任务改动;未跟踪的 claude-bash-guard/ 保持未纳入提交。

未发现需要阻塞合并的问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant