openclaw - ✅(Solved) Fix Feature: Respect userTimezone in memory file timestamps and naming [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#63454Fetched 2026-04-09 07:53:33
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×1referenced ×1

Memory files generated during auto-flush/compaction always use UTC timestamps in both the filename and the header content (e.g. 2026-04-09 00:44:38 UTC), even when userTimezone is configured (e.g. Asia/Jakarta).

Root Cause

Memory files generated during auto-flush/compaction always use UTC timestamps in both the filename and the header content (e.g. 2026-04-09 00:44:38 UTC), even when userTimezone is configured (e.g. Asia/Jakarta).

PR fix notes

PR #63583: feat(hooks): respect userTimezone in session-memory timestamps #63454

Description (problem / solution / changelog)

Summary

  • Problem: The bundled session-memory hook always derived the dated filename prefix and # Session header from UTC (toISOString()), so users with agents.defaults.userTimezone set still saw UTC in saved memory files—misaligned with the system prompt and Issue #63454.
  • Why it matters: Operators in non-UTC zones could not line up memory filenames/headers with local conversation time.
  • What changed: session-memory now uses resolveUserTimezone plus shared formatDateStampInTimezone / formatWallClockHmsInTimezone for the date prefix, header line, and fallback HHMM slug; header ends with the resolved IANA zone id. formatDateStampInTimezone is exported via the memory host runtime / openclaw/plugin-sdk/memory-core and reused by extensions/memory-core/src/flush-plan.ts to avoid duplicate date logic.
  • What did NOT change (scope boundary): Pre-compaction memory flush behavior beyond sharing the same date-stamp helper; no new config keys; no gateway protocol or channel changes.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Fixes #63454

User-visible / Behavior Changes

  • session-memory hook: saved files under memory/YYYY-MM-DD-<slug>.md use the calendar day in agents.defaults.userTimezone (fallback: host zone or UTC). First line is # Session: <date> <time> <IANA zone> instead of ... UTC.
  • Plugin SDK: formatDateStampInTimezone is now part of the openclaw/plugin-sdk/memory-core export surface (additive).

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No

Repro + Verification

Environment

  • OS: Linux (CI / local dev)
  • Runtime/container: Node 22+ / Vitest
  • Relevant config (redacted): agents.defaults.userTimezone: "Asia/Jakarta" (or any valid IANA zone)

Steps

  1. Enable session-memory and set agents.defaults.userTimezone to a non-UTC zone (e.g. Asia/Jakarta).
  2. Trigger /new or /reset so the hook writes a memory file.
  3. Open the new file under memory/.

Expected

  • Filename date and # Session header reflect local wall time in the configured timezone; header suffix matches the IANA zone name.

Actual (before)

  • UTC-based date/time and UTC suffix in the header.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

(Add in PR if useful: new Vitest case in src/hooks/bundled/session-memory/handler.test.ts pins 2026-04-09T00:44:38.000Z with Asia/Jakarta and asserts 2026-04-09 + 07:44:38 + Asia/Jakarta.)

Human Verification (required)

  • Verified scenarios: pnpm test src/hooks/bundled/session-memory/handler.test.ts; pnpm test extensions/memory-core/index.test.ts -t buildMemoryFlushPlan; pnpm check via scripts/committer on commit.
  • Edge cases checked: invalid/missing timezone falls back via existing resolveUserTimezone behavior.
  • What I did not verify: Full `pnpm

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • docs/automation/hooks.md (modified, +1/-1)
  • extensions/memory-core/src/flush-plan.ts (modified, +1/-16)
  • src/agents/date-time.ts (modified, +44/-0)
  • src/hooks/bundled/session-memory/HOOK.md (modified, +2/-2)
  • src/hooks/bundled/session-memory/handler.test.ts (modified, +25/-0)
  • src/hooks/bundled/session-memory/handler.ts (modified, +12/-8)
  • src/memory-host-sdk/runtime-core.ts (modified, +1/-0)
  • src/plugin-sdk/memory-core.ts (modified, +1/-0)

Code Example

# Session: 2026-04-09 00:44:38 UTC

---

# Session: 2026-04-09 07:44:38 Asia/Jakarta
RAW_BUFFERClick to expand / collapse

Summary

Memory files generated during auto-flush/compaction always use UTC timestamps in both the filename and the header content (e.g. 2026-04-09 00:44:38 UTC), even when userTimezone is configured (e.g. Asia/Jakarta).

Current Behavior

  • System prompt correctly shows local time via userTimezone
  • Message envelopes can be configured via envelopeTimezone
  • Memory files always use UTC in filename pattern (YYYY-MM-DD-*.md) and header timestamp ❌

Example memory file:

# Session: 2026-04-09 00:44:38 UTC

When the actual local time is 2026-04-09 07:44:38 Asia/Jakarta.

Expected Behavior

Memory file timestamps should respect agents.defaults.userTimezone (or a dedicated config like memoryFlushTimezone), so the filename date and header timestamp use the configured timezone.

# Session: 2026-04-09 07:44:38 Asia/Jakarta

Use Case

Users in non-UTC timezones (especially UTC+7, UTC+8, etc.) see a mismatch between their local time in the system prompt and the UTC timestamps in memory files. This makes it harder to correlate memory entries with actual conversation times.

Environment

  • OpenClaw version: latest
  • Config: agents.defaults.userTimezone: "Asia/Jakarta" is set and working for system prompt

extent analysis

TL;DR

Configure a dedicated timezone setting for memory files, such as memoryFlushTimezone, to match the userTimezone configuration.

Guidance

  • Review the OpenClaw configuration options to see if a memoryFlushTimezone or similar setting is available to override the default UTC timezone for memory files.
  • If no such setting exists, consider submitting a feature request to add this functionality.
  • Verify that the userTimezone configuration is correctly applied to system prompts and message envelopes to ensure consistency.
  • Test the behavior with different timezone configurations to identify any potential issues with the proposed solution.

Example

No code snippet is provided as the issue does not imply a specific code change, but rather a configuration or feature request.

Notes

The solution assumes that the OpenClaw version being used is the latest, and that the agents.defaults.userTimezone configuration is correctly applied to other parts of the system.

Recommendation

Apply a workaround by configuring a dedicated timezone setting for memory files, such as memoryFlushTimezone, if available, to ensure consistency with the userTimezone configuration. If not available, consider submitting a feature request to add this functionality.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING