Skip to content

fix: separate Current time from Reference UTC#42654

Merged
altaywtf merged 1 commit intoopenclaw:mainfrom
chencheng-li:fix/reference-utc-separate
May 8, 2026
Merged

fix: separate Current time from Reference UTC#42654
altaywtf merged 1 commit intoopenclaw:mainfrom
chencheng-li:fix/reference-utc-separate

Conversation

@chencheng-li
Copy link
Copy Markdown
Contributor

@chencheng-li chencheng-li commented Mar 11, 2026

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

Real behavior proof

  • Behavior or issue addressed: Local Current time should stay anchored to the user's configured timezone while UTC is shown only as secondary reference data.
  • Real environment tested: macOS local maintainer checkout of OpenClaw PR fix: separate Current time from Reference UTC #42654 at eaead0535faec81919c41142f3c12a5ec0a9e7cb, using Node with tsx to execute the patched production current-time helper.
  • Exact steps or command run after this patch: Ran node --import tsx --input-type=module -e <resolveCronStyleNow proof> from the rebased PR worktree with userTimezone America/Los_Angeles and fixed instant 2026-03-11T00:49:00.000Z.
  • Evidence after fix (screenshot, recording, terminal capture, console output, redacted runtime log, linked artifact, or copied live output): Copied terminal output:
$ node --import tsx --input-type=module -e <resolveCronStyleNow proof>
Current time: Tuesday, March 10th, 2026 - 5:49 PM (America/Los_Angeles)
Reference UTC: 2026-03-11 00:49 UTC
  • Observed result after fix: The local Current time: line keeps the March 10 America/Los_Angeles date, while the March 11 UTC value appears only on the separate Reference UTC: line.
  • What was not tested: Full local test suite was not run in this maintainer checkout; GitHub CI remains the broader validation path.

@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

@openclaw-barnacle
Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Apr 27, 2026
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented Apr 27, 2026

Codex review: needs maintainer review before merge.

Summary
This PR changes the shared cron-style current-time helper to emit Current time: and Reference UTC: on separate lines, then updates affected prompt, memory-core, cron, helper-test, and changelog expectations.

Reproducibility: yes. for the formatting symptom: current main constructs Current time: ... / ... UTC, and current-main tests still assert the combined line. I did not run a live model-turn reproduction of date misinterpretation in this read-only review.

Real behavior proof
Sufficient (terminal): Sufficient terminal proof is present: the PR body includes copied after-fix output from a real macOS checkout running the patched production helper, and latest head preserves the same production helper change.

Next step before merge
No repair job is needed; the remaining action is normal maintainer merge/review handling for the current PR head.

Security
Cleared: The diff only changes prompt text formatting, tests, and changelog text, with no dependency, CI, permission, secret, download, or code-execution surface change.

Review details

Best possible solution:

Land the two-line helper contract with its focused prompt expectations, while leaving ISO timestamp formatting and prompt-cache placement to the separate follow-up issues at #55935 and #71973.

Do we have a high-confidence way to reproduce the issue?

Yes for the formatting symptom: current main constructs Current time: ... / ... UTC, and current-main tests still assert the combined line. I did not run a live model-turn reproduction of date misinterpretation in this read-only review.

Is this the best way to solve the issue?

Yes. Updating the shared helper and the direct prompt assertions found by source search is the narrowest maintainable fix for this PR’s scope.

Acceptance criteria:

  • CI check-runs for b8eba4a11a6fef60d46d9ab4b42bddbe4ffc0df1 are green as polled via the GitHub checks API.
  • If maintainers want local proof before landing, run pnpm test src/cron/isolated-agent.session-identity.test.ts src/auto-reply/reply/session-reset-prompt.test.ts src/auto-reply/reply/post-compaction-context.test.ts extensions/memory-core/index.test.ts extensions/memory-core/src/dreaming.test.ts and the changed gate selected by pnpm check:changed.

What I checked:

  • current_main_combined_line: Current main still builds timeLine as one combined Current time: ... / ... UTC prompt line. (src/agents/current-time.ts:29, 82ef15840359)
  • current_main_old_expectations: Source search found active current-main expectations for the old combined local/UTC line in session reset, post-compaction, memory-core, dreaming, cron, and prompt-composition coverage. (src/auto-reply/reply/session-reset-prompt.test.ts:54, 82ef15840359)
  • pr_helper_change: The latest PR patch changes the shared helper to Current time: ...\nReference UTC: ..., keeping UTC available but off the primary local-time line. (src/agents/current-time.ts:29, b8eba4a11a6f)
  • pr_test_coverage: The latest PR patch updates direct assertions in cron, session reset, post-compaction, prompt-composition, memory-core flush, and memory-core dreaming coverage to expect the two-line format. (src/cron/isolated-agent.session-identity.test.ts:58, b8eba4a11a6f)
  • changelog_present: The latest PR patch adds an Unreleased changelog entry for splitting UTC onto a separate Reference UTC: prompt line. (CHANGELOG.md:642, b8eba4a11a6f)
  • real_behavior_proof_supplied: The PR body includes copied terminal output from a macOS checkout running the patched production helper against a Los Angeles/UTC cross-date instant; the proof names earlier head eaead0535faec81919c41142f3c12a5ec0a9e7cb, and the latest head preserves the same helper diff. (b8eba4a11a6f)

Likely related people:

  • jriff: Authored the merged change that added the UTC suffix to the shared Current time: helper and related prompt expectations. (role: introduced behavior; confidence: high; commits: aad372e15fb9; files: src/agents/current-time.ts, src/auto-reply/reply/session-reset-prompt.test.ts, src/auto-reply/reply/post-compaction-context.test.ts)
  • Takhoffman: Introduced src/agents/current-time.ts and wired cron-style current-time injection into cron and heartbeat prompt paths before the UTC suffix work. (role: introduced helper; confidence: high; commits: d2c2f4185b0e; files: src/agents/current-time.ts, src/cron/isolated-agent/run.ts, src/infra/heartbeat-runner.ts)
  • altaywtf: The merged UTC-suffix commit records Altay as co-author/reviewer, and Altay updated the current PR branch and supplied real behavior proof. (role: reviewer and adjacent maintainer; confidence: medium; commits: aad372e15fb9, b8eba4a11a6f; files: src/agents/current-time.ts, src/cron/isolated-agent.session-identity.test.ts)
  • steipete: Recently maintained affected session reset, memory-core, and prompt-composition test surfaces that this PR updates. (role: recent maintainer; confidence: medium; commits: c1c217035d17, 540cbe24be4c, af7f651db36f; files: src/auto-reply/reply/session-reset-prompt.test.ts, extensions/memory-core/index.test.ts, extensions/memory-core/src/dreaming.test.ts)

Remaining risk / open question:

  • I did not reproduce live model date misinterpretation; this review proves the deterministic prompt-formatting symptom and the helper/test update.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 82ef15840359.

@openclaw-barnacle
Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added stale Marked as stale due to inactivity and removed stale Marked as stale due to inactivity labels May 3, 2026
@openclaw-barnacle
Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label May 4, 2026
@altaywtf altaywtf force-pushed the fix/reference-utc-separate branch from 767c90c to 843384b Compare May 7, 2026 12:31
@openclaw-barnacle openclaw-barnacle Bot added triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. extensions: memory-core Extension: memory-core and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 7, 2026
@altaywtf altaywtf force-pushed the fix/reference-utc-separate branch from 843384b to c14fe68 Compare May 7, 2026 12:33
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label May 8, 2026
@openclaw-barnacle
Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label May 8, 2026
@altaywtf altaywtf force-pushed the fix/reference-utc-separate branch from c14fe68 to eaead05 Compare May 8, 2026 10:14
@altaywtf
Copy link
Copy Markdown
Member

altaywtf commented May 8, 2026

Added maintainer-supplied real behavior proof to the PR description from the rebased head eaead0535faec81919c41142f3c12a5ec0a9e7cb.

The proof uses the patched production current-time helper with a cross-date instant: America/Los_Angeles stays on March 10 in Current time:, while UTC appears separately as Reference UTC: 2026-03-11 00:49 UTC. Full local test suite was intentionally not run here; GitHub CI remains the broader validation path.

@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 8, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 8, 2026
@altaywtf altaywtf force-pushed the fix/reference-utc-separate branch from eaead05 to 6bc1a02 Compare May 8, 2026 11:05
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 8, 2026
@altaywtf altaywtf force-pushed the fix/reference-utc-separate branch 3 times, most recently from b8eba4a to 8a1a006 Compare May 8, 2026 11:18
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 8, 2026
@altaywtf altaywtf force-pushed the fix/reference-utc-separate branch from 8a1a006 to 0829399 Compare May 8, 2026 11:18
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 8, 2026
@altaywtf altaywtf merged commit 15b3931 into openclaw:main May 8, 2026
36 checks passed
@altaywtf
Copy link
Copy Markdown
Member

altaywtf commented May 8, 2026

Merged via squash.

Thanks @chencheng-li!

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
Merged via squash.

Prepared head SHA: 0829399
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
rogerdigital pushed a commit to rogerdigital/openclaw that referenced this pull request May 9, 2026
Merged via squash.

Prepared head SHA: 0829399
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling extensions: memory-core Extension: memory-core proof: supplied External PR includes structured after-fix real behavior proof. size: XS stale Marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants