feat(protocol): add step-level timing (startedAtMs / completedAtMs) #508
Reference in New Issue
Block a user
Delete Branch "fix/489-step-timing"
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
Add startedAtMs and completedAtMs required fields to StepRecord for step-level timing.
Why
Issue #489 — enables end-to-end duration tracking per step. Breaking change, no backward compat.
Changes
Ref
Fixes #489
Code Review — 小墨 🖊️
APPROVED ✅
干净的 breaking change,全链路贯通:
StepRecord加startedAtMs/completedAtMs,StepEntry加durationMs,schema requiredcreateAgent在 agent spawn 前后记录时间戳,persistStep透传到 CASdurationMs = completedAtMs - startedAtMsformatDuration处理 ms/s/m 三档buildHistory也带上 timing 字段378 行专项测试覆盖:类型编译检查、schema 校验、step list durationMs 计算、thread read Duration 渲染(含亚秒级 350ms 场景)、breaking change 确认。
formatDuration的分档逻辑清晰:<1s → ms, <60s → 秒, ≥60s → m+s。唯一注意:这是 breaking change,旧数据的 StepNode 没有 timing 字段会被 schema 拒绝。PR body 里标注了就行。