Repository navigation
Conversation
每日记忆账本(memory/YYYY-MM-DD.md)的文件名与条目标题此前使用不同的 时间基准:文件名取请求 Clock 所在时区的日期,标题却是 UTC 瞬时 (Instant.toString(),以 Z 结尾)。在 UTC+09:00 的部署里,22:30 UTC 的 一次 flush 归入次日(03-02)的账本,条目标题却写着 03-01T22:30:00Z—— 与文件名相差一天(agentscope-ai#3433)。 修复:标题与文件名取自同一个 Clock,并以该 Clock 的时区渲染 (ISO-8601 带偏移,如 2026-03-02T07:30:00+09:00)。 时区通过 RuntimeContext 中的 Clock 配置(agentscope-ai#4154 引入,durable 运行时 恢复一轮对话时也是这样还原其时区),不另增配置项。本 PR 早期版本 提出的 ledgerZone 构造参数从未接入任何 builder,且会与 Clock 形成两套 时间来源,故移除。 测试:MemoryFlushManagerClockTest 共 5 例——账本按 Clock 时区的日期 归档、条目标题按该时区渲染、另一时区归入其本地日期、同一时区连续 flush 汇入同一账本、未提供 Clock 时沿用 JVM 默认时区。
d76f145 to
e6d45ea
Compare
|
Reworked on current What changed in the approach. The first version added a So the zone is configured by supplying a zoned What main already did. The ledger file already followed that clock's zone: with a clock fixed at What was still wrong. The entry's heading printed a UTC instant: Tests. New |
Fixes #3433
Problem
A daily memory ledger's file name and its entry heading used different time bases. The file was named for the date in the request clock's zone, while the heading printed a UTC instant. At UTC+09:00, a flush at
22:30Zon 1 March lands inmemory/2026-03-02.mdwith the heading## Memory Flush — 2026-03-01T22:30:00Z: a day apart from its own file.Fix
The heading is taken from the same
Clockas the file name and rendered in that clock's zone (ISO-8601 with offset):2026-03-02T07:30:00+09:00.The zone is configured by supplying a zoned
Clockin theRuntimeContext, whichMemoryFlushManagerhas read since #4154 (clock(rc)). There is no separate setting. An earlier revision of this PR added aledgerZoneconstructor parameter instead; it was never reachable from any builder and duplicated that clock, so it is dropped.Tests
MemoryFlushManagerClockTest, 5 cases:Against unmodified
main, only the heading case fails.