feat(builtin-agent): persist ReAct loop turns as session JSONL #434
Reference in New Issue
Block a user
Delete Branch "feat/turn-jsonl-session"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
ReAct loop 每轮实时写 JSONL,完成后转存 CAS。
Why
Changes
session.ts:JSONL 文件管理(init/append/read/remove),路径~/.uncaged/workflow/sessions/<sessionId>.jsonlloop.ts:每轮 append JSONL(assistant turn + tool results),不再内存攒 turns[]detail.ts:读 session JSONL → 逐个store.putturn CAS node → 存 detail(turns: string[]正序数组)agent.ts:传 storageRoot/sessionId 给 loop,完成后 removeSession 清理types.ts:TurnPayload 去掉index(顺序由 JSONL/数组隐含)schemas.ts:同步 type 变更设计
appendFile一行 JSON 到sessions/<sessionId>.jsonl,天然正序,零竞争tail -f sessions/<id>.jsonl实时看进度Ref: #433
JSONL session 设计干净,loop 重构合理,detail 简化到位。Lint 修复纯格式变更没问题。
🔴 Blocking
Skipped tests 缺少 issue 编号 — 团队规范要求 skip 注释必须引用 issue number:
acp-client.test.ts:it.skip("prompt() collects structured messages...")resume-e2e.test.ts:it.skip("resume() after close...")请开 issue 跟踪这两个 flaky test,然后在 skip 注释里加上
// Flaky: #<issue-number>。🟡 Non-blocking
readSessionTurns的JSON.parse(l) as BuiltinTurnPayload无运行时校验,corrupted line 会静默产生畸形对象BuiltinSessionStateexport 移除是 breaking change,确认无外部消费者6474de3419to50cd93aa05LGTM ✅ Skip 注释已引用 #435,规范合规。