Skip to content

fix: separate Current time from Reference UTC#42654

Open
chencheng-li wants to merge 2 commits intoopenclaw:mainfrom
chencheng-li:fix/reference-utc-separate
Open

fix: separate Current time from Reference UTC#42654
chencheng-li wants to merge 2 commits intoopenclaw:mainfrom
chencheng-li:fix/reference-utc-separate

Conversation

@chencheng-li
Copy link
Copy Markdown

Summary

  • keep Current time: anchored to the user-local timezone
  • move UTC onto a separate Reference UTC: line
  • avoid putting two competing calendar dates on the same primary time line

Why

The previous format could present two competing calendar dates on the same line, for example:

Current time: Tuesday, March 10th, 2026 — 5:49 PM (America/Los_Angeles) / 2026-03-11 00:49 UTC

In evening hours for US timezones, models can latch onto the UTC date and treat it as "today", even though the user-facing local date is still March 10.

This PR keeps UTC available for log reconciliation, but demotes it to a clearly secondary line so the local-time anchor remains unambiguous.

New format

Current time: Tuesday, March 10th, 2026 — 5:49 PM (America/Los_Angeles)
Reference UTC: 2026-03-11 00:49 UTC

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 11, 2026

Greptile Summary

This PR changes the timeLine string produced by resolveCronStyleNow from a single combined line (Current time: ... (tz) / YYYY-MM-DD HH:MM UTC) to two separate lines (Current time: ...\nReference UTC: ...). The motivation — avoiding model confusion when local and UTC dates straddle midnight — is sound.

The change itself in src/agents/current-time.ts is minimal and correct. The cron isolated-agent test was updated accordingly. However, three other test files that assert on the old single-line format were not updated and will fail:

  • src/auto-reply/reply/memory-flush.test.ts:28 — asserts toContain("... (America/New_York) / 2026-02-16 15:00 UTC")
  • src/auto-reply/reply/session-reset-prompt.test.ts:20 — asserts toContain("... (America/New_York) / 2026-03-03 14:00 UTC")
  • src/auto-reply/reply/post-compaction-context.test.ts:215 — asserts toContain("... (America/New_York) / 2026-03-03 14:00 UTC")

Each of these needs to be split into two separate toContain checks matching the new format.

Confidence Score: 2/5

  • Not safe to merge — three existing tests assert on the old combined timeLine format and will fail.
  • The production logic change is correct and intentional, but the PR is incomplete: memory-flush.test.ts, session-reset-prompt.test.ts, and post-compaction-context.test.ts all contain toContain(...) assertions matching the old "... / YYYY-MM-DD HH:MM UTC" format that no longer exists in the output. These tests will fail in CI without being updated.
  • src/auto-reply/reply/memory-flush.test.ts, src/auto-reply/reply/session-reset-prompt.test.ts, and src/auto-reply/reply/post-compaction-context.test.ts all need their timeLine format assertions updated.

Comments Outside Diff (3)

  1. src/auto-reply/reply/memory-flush.test.ts, line 28-29 (link)

    Test will fail with new timeLine format

    resolveMemoryFlushPromptForRun calls resolveCronStyleNow directly and appends its timeLine to the prompt. After this PR, timeLine is now two lines separated by \n, so the old combined string "... (America/New_York) / 2026-02-16 15:00 UTC" no longer exists in the output. This toContain assertion will fail.

    The test needs to be split to match the new two-line format:

  2. src/auto-reply/reply/session-reset-prompt.test.ts, line 19-21 (link)

    Test will fail with new timeLine format

    buildBareSessionResetPrompt ultimately calls appendCronStyleCurrentTimeLine, which now produces a two-line timeLine. The old combined string "... (America/New_York) / 2026-03-03 14:00 UTC" will no longer be present in the prompt output. This assertion will fail.

    The test needs to be updated to match the new format:

  3. src/auto-reply/reply/post-compaction-context.test.ts, line 214-216 (link)

    Test will fail with new timeLine format

    readPostCompactionContext calls resolveCronStyleNow and appends the resulting timeLine to the output. After this PR, timeLine is two lines, so the single-string assertion "... (America/New_York) / 2026-03-03 14:00 UTC" will no longer match.

    The test should be updated to check both lines separately:

Last reviewed commit: 8cd9090

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant