Repository navigation
fix(periodic-report): order milestone events by UTC instant - #9524
Conversation
Signed-off-by: aihop <4408344+hhyykk@users.noreply.github.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
查看阶段进展报告的用户,会从已提交的事件得知哪个阶段刚通过验证。 旧版按日期字符串排序。同一秒内,09:00:00.000001Z 排在 09:00:00Z 前。报告会挑到后一个阶段,漏掉或提前计入正在边界附近的交付。 修复后用 UTC 时间点选阶段,用同一个时间点计算已完成事项,保留原报告时间格式。 交付范围是阶段报告的本地日志评估及测试。
改动思路 / Approach
复用原 UTC 规范化和触发评估器。内部保留解析后的比较键,公开收据继续采用原序列化。 交付范围是阶段报告的本地日志评估及测试。 继续使用已经验证的报告来源和本地准入边界。把行为收进现有入口,可以直接拿原例与现头对照,下一次读回也沿原来的凭证。恰在阶段边界的完成仍被计入。稍晚完成和同一 Todo 的重复记录不会改变这次报告。
具体改动 / Changes
本次复核精确提交 986516f6e3c93f3c4cb3b3e5ba9d137f8bd33596,相对主干基线 2302e42d9cad35a8a4150e24496ffecfbfdce8cb。三个文件 +169/-4。生产代码净增两行用于保留解析时间。其余是 CLI 回归与有限列表模型。 earliest-stage 已通过选已验证时间窗内最早的阶段,事件 ID 保持并列规则。inclusive-todo-cutoff 已通过边界完成计入,较晚完成保留在后续范围。 周期报告协议
关键代码讲解
_safe_durable_event沿用原 UTC 字符串,记录本地 datetime 比较值。 解析并校准时间build_periodic_report_runtime_trigger_decision先按时间点排序再以 ID 打破并列。 选择最早有效阶段completions_at_boundary同一时刻纳入,严格较晚的完成留在后面。 计算阶段边界完成数
对主干的风险 / Risks
用真实 CLI 读取同一组 JSONL。基线选中晚一微秒的阶段。现头选中整秒阶段,反转日志顺序结果一致。同一时刻的两种时区写法等价,事件 ID 仍打破并列。恰在边界的完成被计入,稍晚完成和同一 Todo 的重复完成没有改变决策标识。超出窗口仍不触发。 基线新增的两个真实 CLI 反例均失败。运行时配对还验证同时间事件 ID、日志反序、边界前后的完成。 现头运行报告测试的结果为 515 passed in 74.94s (0:01:14),Ruff 与 Git diff 检查通过。两份证据独立。Lean 4.22.0 检查抽象模型通过,篡改包含边界的条件后证明失败。实际行为由隔离运行时重验。 两份提案在同一基线可合成,改动落在不同的报告阶段。实际报告评估使用隔离日志和合成事件。外部生成、发布与托管 CI 未运行。
我的整体评价 / Verdict
APPROVE。把报告选中的里程碑和工作计数放回真实时序。 既有入口和已验证来源持续作为报表的依据。当前范围内没有发现阻塞项。实际报告评估使用隔离日志和合成事件。外部生成、发布与托管 CI 未运行。
English verdict: APPROVE at 986516f. Independent tests confirm the real CLI selects the earliest UTC stage, preserves tie order, and includes exactly the cutoff completions.
Goal And Delivered Outcome
The periodic-report CLI could choose a stage logged at
09:00:00.5Zahead of one logged at09:00:00Z. Both timestamps are valid. Lexical comparison sorts the fraction before theZsuffix, which can also count a later Todo completion toward the earlier stage.The runtime producer now sorts and applies the completion cutoff using parsed UTC datetimes. Event IDs still break ties at the same instant. Public timestamps use the existing serializer.
Author Declaration
bounded_segment_milestonecontract indocs/reference/protocols/periodic-report-v0.mdand the reproduced CLI behavior onmain.regression/PeriodicReportChronology.leanproves selection and cutoff for finite lists and checks the old lexical counterexample.Validation
mainand pass with the fix. Restoring only the old completion cutoff also fails both cases. Logs use synthetic events in temporary files.PYTHONPATH="$PWD" python3 -m pytest -q tests/capabilities/test_periodic_report*.pylean -DwarningAsError=true regression/PeriodicReportChronology.lean. Reversing the model's ordering or making its cutoff strict causes the check to fail.python3 -m loopx.entrypoint canary premerge --from-git-diff --git-diff-base origin/main --tier quickThe Lean model starts after event validation and assumes the producer's existing deduplication. The CLI regression exercises parsing, event selection, and the cutoff together. This change covers the rollout-log evaluation path. Test execution used local fixtures and exercised no external delivery.
Scope And Continuation
This PR addresses the stage chronology defect. Calendar admission and report delivery are outside this change.
Frontend / Visual Evidence
Type Of Change
LoopX Area
Shared-authority RFC fixture impact
N/A.
Boundary Checklist
Signed-off-bytrailer.