mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 02:20:44 +00:00
fix: separate Current time from Reference UTC (#42654)
Merged via squash.
Prepared head SHA: 0829399ebd
Co-authored-by: chencheng-li <49442600+chencheng-li@users.noreply.github.com>
Co-authored-by: altaywtf <9790196+altaywtf@users.noreply.github.com>
Reviewed-by: @altaywtf
This commit is contained in:
@@ -642,6 +642,7 @@ Docs: https://docs.openclaw.ai
|
||||
- Gateway/nodes: preserve the live node registry session and invoke ownership when an older same-node WebSocket closes after reconnecting. (#78351) Thanks @samzong.
|
||||
- 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.
|
||||
- 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.
|
||||
- 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.
|
||||
|
||||
## 2026.5.3-1
|
||||
|
||||
|
||||
@@ -84,8 +84,9 @@ describe("buildMemoryFlushPlan", () => {
|
||||
|
||||
expect(plan?.prompt).toContain("memory/2026-02-16.md");
|
||||
expect(plan?.prompt).toContain(
|
||||
"Current time: Monday, February 16th, 2026 - 10:00 AM (America/New_York) / 2026-02-16 15:00 UTC",
|
||||
"Current time: Monday, February 16th, 2026 - 10:00 AM (America/New_York)",
|
||||
);
|
||||
expect(plan?.prompt).toContain("Reference UTC: 2026-02-16 15:00 UTC");
|
||||
expect(plan?.relativePath).toBe("memory/2026-02-16.md");
|
||||
});
|
||||
|
||||
|
||||
@@ -1943,7 +1943,8 @@ describe("short-term dreaming trigger", () => {
|
||||
const result = await runShortTermDreamingPromotionIfTriggered({
|
||||
cleanedBody: [
|
||||
"[cron:e795558c-a273-4124-ba88-d4916688d977 Memory Dreaming Promotion] __openclaw_memory_core_short_term_promotion_dream__",
|
||||
"Current time: Thursday, April 16th, 2026 - 3:10 PM (America/Los_Angeles) / 2026-04-16 22:10 UTC",
|
||||
"Current time: Thursday, April 16th, 2026 - 3:10 PM (America/Los_Angeles)",
|
||||
"Reference UTC: 2026-04-16 22:10 UTC",
|
||||
].join("\n"),
|
||||
trigger: "cron",
|
||||
workspaceDir,
|
||||
|
||||
@@ -26,7 +26,7 @@ export function resolveCronStyleNow(cfg: TimeConfigLike, nowMs: number): CronSty
|
||||
const formattedTime =
|
||||
formatUserTime(new Date(nowMs), userTimezone, userTimeFormat) ?? new Date(nowMs).toISOString();
|
||||
const utcTime = new Date(nowMs).toISOString().replace("T", " ").slice(0, 16) + " UTC";
|
||||
const timeLine = `Current time: ${formattedTime} (${userTimezone}) / ${utcTime}`;
|
||||
const timeLine = `Current time: ${formattedTime} (${userTimezone})\nReference UTC: ${utcTime}`;
|
||||
return { userTimezone, formattedTime, timeLine };
|
||||
}
|
||||
|
||||
|
||||
@@ -262,9 +262,8 @@ Never modify memory/YYYY-MM-DD.md destructively.
|
||||
expect(result).not.toBeNull();
|
||||
expect(result).toContain("memory/2026-03-03.md");
|
||||
expect(result).not.toContain("memory/YYYY-MM-DD.md");
|
||||
expect(result).toContain(
|
||||
"Current time: Tuesday, March 3rd, 2026 - 9:00 AM (America/New_York) / 2026-03-03 14:00 UTC",
|
||||
);
|
||||
expect(result).toContain("Current time: Tuesday, March 3rd, 2026 - 9:00 AM (America/New_York)");
|
||||
expect(result).toContain("Reference UTC: 2026-03-03 14:00 UTC");
|
||||
});
|
||||
|
||||
it("appends current time line even when no YYYY-MM-DD placeholder is present", async () => {
|
||||
|
||||
@@ -50,9 +50,8 @@ describe("buildBareSessionResetPrompt", () => {
|
||||
// 2026-03-03 14:00 UTC = 2026-03-03 09:00 EST
|
||||
const nowMs = Date.UTC(2026, 2, 3, 14, 0, 0);
|
||||
const prompt = buildBareSessionResetPrompt(cfg, nowMs);
|
||||
expect(prompt).toContain(
|
||||
"Current time: Tuesday, March 3rd, 2026 - 9:00 AM (America/New_York) / 2026-03-03 14:00 UTC",
|
||||
);
|
||||
expect(prompt).toContain("Current time: Tuesday, March 3rd, 2026 - 9:00 AM (America/New_York)");
|
||||
expect(prompt).toContain("Reference UTC: 2026-03-03 14:00 UTC");
|
||||
});
|
||||
|
||||
it("does not append a duplicate current time line", () => {
|
||||
|
||||
@@ -55,7 +55,8 @@ describe("runCronIsolatedAgentTurn session identity", () => {
|
||||
const lines = call?.prompt?.split("\n") ?? [];
|
||||
expect(lines[0]).toContain("[cron:job-1");
|
||||
expect(lines[0]).toContain("do it");
|
||||
expect(lines[1]).toMatch(/^Current time: .+ \(.+\) \/ \d{4}-\d{2}-\d{2} \d{2}:\d{2} UTC$/);
|
||||
expect(lines[1]).toMatch(/^Current time: .+ \(.+\)$/);
|
||||
expect(lines[2]).toMatch(/^Reference UTC: \d{4}-\d{2}-\d{2} \d{2}:\d{2} UTC$/);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -594,7 +594,8 @@ async function createMaintenanceScenario(workspaceDir: string): Promise<PromptSc
|
||||
"Store durable memories only in memory/2026-03-15.md (create memory/ if needed).",
|
||||
"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.",
|
||||
"If nothing to store, reply with NO_REPLY.",
|
||||
"Current time: Sunday, March 15th, 2026 - 9:30 PM (America/Los_Angeles) / 2026-03-16 04:30 UTC",
|
||||
"Current time: Sunday, March 15th, 2026 - 9:30 PM (America/Los_Angeles)",
|
||||
"Reference UTC: 2026-03-16 04:30 UTC",
|
||||
].join("\n");
|
||||
const memoryFlushSystemPrompt = buildSystemPrompt({
|
||||
workspaceDir,
|
||||
@@ -618,7 +619,8 @@ async function createMaintenanceScenario(workspaceDir: string): Promise<PromptSc
|
||||
"## Red Lines",
|
||||
"Do not delete production data.",
|
||||
"",
|
||||
"Current time: Sunday, March 15th, 2026 - 9:30 PM (America/Los_Angeles) / 2026-03-16 04:30 UTC",
|
||||
"Current time: Sunday, March 15th, 2026 - 9:30 PM (America/Los_Angeles)",
|
||||
"Reference UTC: 2026-03-16 04:30 UTC",
|
||||
].join("\n");
|
||||
const postCompactionSystemPrompt = buildSystemPrompt({
|
||||
workspaceDir,
|
||||
|
||||
Reference in New Issue
Block a user