fix: separate Current time from Reference UTC (#42654) · openclaw/openclaw@15b3931
chencheng-li
·
2026-05-08
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -642,6 +642,7 @@ Docs: https://docs.openclaw.ai
|
642 | 642 | - Gateway/nodes: preserve the live node registry session and invoke ownership when an older same-node WebSocket closes after reconnecting. (#78351) Thanks @samzong. |
643 | 643 | - Browser/downloads: route explicit and managed browser download output directories through `fs-safe` validation before staging final files, so symlinked output roots are rejected before writes. (#78780) Thanks @jesse-merhi. |
644 | 644 | - Agents/PI: skip the idle wait during aborted embedded-run cleanup, so stopped or timed-out runs clear pending tool state and release the session lock promptly. (#74919) Thanks @medns. |
| 645 | +- Agents/current-time: split UTC into a separate `Reference UTC:` prompt line so local `Current time:` stays anchored to the user's timezone. (#42654) Thanks @chencheng-li. |
645 | 646 | |
646 | 647 | ## 2026.5.3-1 |
647 | 648 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -84,8 +84,9 @@ describe("buildMemoryFlushPlan", () => {
|
84 | 84 | |
85 | 85 | expect(plan?.prompt).toContain("memory/2026-02-16.md"); |
86 | 86 | expect(plan?.prompt).toContain( |
87 | | -"Current time: Monday, February 16th, 2026 - 10:00 AM (America/New_York) / 2026-02-16 15:00 UTC", |
| 87 | +"Current time: Monday, February 16th, 2026 - 10:00 AM (America/New_York)", |
88 | 88 | ); |
| 89 | +expect(plan?.prompt).toContain("Reference UTC: 2026-02-16 15:00 UTC"); |
89 | 90 | expect(plan?.relativePath).toBe("memory/2026-02-16.md"); |
90 | 91 | }); |
91 | 92 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1943,7 +1943,8 @@ describe("short-term dreaming trigger", () => {
|
1943 | 1943 | const result = await runShortTermDreamingPromotionIfTriggered({ |
1944 | 1944 | cleanedBody: [ |
1945 | 1945 | "[cron:e795558c-a273-4124-ba88-d4916688d977 Memory Dreaming Promotion] __openclaw_memory_core_short_term_promotion_dream__", |
1946 | | -"Current time: Thursday, April 16th, 2026 - 3:10 PM (America/Los_Angeles) / 2026-04-16 22:10 UTC", |
| 1946 | +"Current time: Thursday, April 16th, 2026 - 3:10 PM (America/Los_Angeles)", |
| 1947 | +"Reference UTC: 2026-04-16 22:10 UTC", |
1947 | 1948 | ].join("\n"), |
1948 | 1949 | trigger: "cron", |
1949 | 1950 | workspaceDir, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -26,7 +26,7 @@ export function resolveCronStyleNow(cfg: TimeConfigLike, nowMs: number): CronSty
|
26 | 26 | const formattedTime = |
27 | 27 | formatUserTime(new Date(nowMs), userTimezone, userTimeFormat) ?? new Date(nowMs).toISOString(); |
28 | 28 | const utcTime = new Date(nowMs).toISOString().replace("T", " ").slice(0, 16) + " UTC"; |
29 | | -const timeLine = `Current time: ${formattedTime} (${userTimezone}) / ${utcTime}`; |
| 29 | +const timeLine = `Current time: ${formattedTime} (${userTimezone})\nReference UTC: ${utcTime}`; |
30 | 30 | return { userTimezone, formattedTime, timeLine }; |
31 | 31 | } |
32 | 32 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -262,9 +262,8 @@ Never modify memory/YYYY-MM-DD.md destructively.
|
262 | 262 | expect(result).not.toBeNull(); |
263 | 263 | expect(result).toContain("memory/2026-03-03.md"); |
264 | 264 | expect(result).not.toContain("memory/YYYY-MM-DD.md"); |
265 | | -expect(result).toContain( |
266 | | -"Current time: Tuesday, March 3rd, 2026 - 9:00 AM (America/New_York) / 2026-03-03 14:00 UTC", |
267 | | -); |
| 265 | +expect(result).toContain("Current time: Tuesday, March 3rd, 2026 - 9:00 AM (America/New_York)"); |
| 266 | +expect(result).toContain("Reference UTC: 2026-03-03 14:00 UTC"); |
268 | 267 | }); |
269 | 268 | |
270 | 269 | it("appends current time line even when no YYYY-MM-DD placeholder is present", async () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -50,9 +50,8 @@ describe("buildBareSessionResetPrompt", () => {
|
50 | 50 | // 2026-03-03 14:00 UTC = 2026-03-03 09:00 EST |
51 | 51 | const nowMs = Date.UTC(2026, 2, 3, 14, 0, 0); |
52 | 52 | const prompt = buildBareSessionResetPrompt(cfg, nowMs); |
53 | | -expect(prompt).toContain( |
54 | | -"Current time: Tuesday, March 3rd, 2026 - 9:00 AM (America/New_York) / 2026-03-03 14:00 UTC", |
55 | | -); |
| 53 | +expect(prompt).toContain("Current time: Tuesday, March 3rd, 2026 - 9:00 AM (America/New_York)"); |
| 54 | +expect(prompt).toContain("Reference UTC: 2026-03-03 14:00 UTC"); |
56 | 55 | }); |
57 | 56 | |
58 | 57 | it("does not append a duplicate current time line", () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -55,7 +55,8 @@ describe("runCronIsolatedAgentTurn session identity", () => {
|
55 | 55 | const lines = call?.prompt?.split("\n") ?? []; |
56 | 56 | expect(lines[0]).toContain("[cron:job-1"); |
57 | 57 | expect(lines[0]).toContain("do it"); |
58 | | -expect(lines[1]).toMatch(/^Current time: .+ \(.+\) \/ \d{4}-\d{2}-\d{2} \d{2}:\d{2} UTC$/); |
| 58 | +expect(lines[1]).toMatch(/^Current time: .+ \(.+\)$/); |
| 59 | +expect(lines[2]).toMatch(/^Reference UTC: \d{4}-\d{2}-\d{2} \d{2}:\d{2} UTC$/); |
59 | 60 | }); |
60 | 61 | }); |
61 | 62 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -594,7 +594,8 @@ async function createMaintenanceScenario(workspaceDir: string): Promise<PromptSc
|
594 | 594 | "Store durable memories only in memory/2026-03-15.md (create memory/ if needed).", |
595 | 595 | "Treat workspace bootstrap/reference files such as MEMORY.md, SOUL.md, TOOLS.md, and AGENTS.md as read-only during this flush; never overwrite, replace, or edit them.", |
596 | 596 | "If nothing to store, reply with NO_REPLY.", |
597 | | -"Current time: Sunday, March 15th, 2026 - 9:30 PM (America/Los_Angeles) / 2026-03-16 04:30 UTC", |
| 597 | +"Current time: Sunday, March 15th, 2026 - 9:30 PM (America/Los_Angeles)", |
| 598 | +"Reference UTC: 2026-03-16 04:30 UTC", |
598 | 599 | ].join("\n"); |
599 | 600 | const memoryFlushSystemPrompt = buildSystemPrompt({ |
600 | 601 | workspaceDir, |
@@ -618,7 +619,8 @@ async function createMaintenanceScenario(workspaceDir: string): Promise<PromptSc
|
618 | 619 | "## Red Lines", |
619 | 620 | "Do not delete production data.", |
620 | 621 | "", |
621 | | -"Current time: Sunday, March 15th, 2026 - 9:30 PM (America/Los_Angeles) / 2026-03-16 04:30 UTC", |
| 622 | +"Current time: Sunday, March 15th, 2026 - 9:30 PM (America/Los_Angeles)", |
| 623 | +"Reference UTC: 2026-03-16 04:30 UTC", |
622 | 624 | ].join("\n"); |
623 | 625 | const postCompactionSystemPrompt = buildSystemPrompt({ |
624 | 626 | workspaceDir, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。