Skip to content

fix: include day of week in date/time context injection (#4629)#4637

Closed
krishnpalchouhan wants to merge 4 commits intoopenclaw:mainfrom
krishnpalchouhan:fix/datetime-include-day-of-week
Closed

fix: include day of week in date/time context injection (#4629)#4637
krishnpalchouhan wants to merge 4 commits intoopenclaw:mainfrom
krishnpalchouhan:fix/datetime-include-day-of-week

Conversation

@krishnpalchouhan
Copy link
Copy Markdown

@krishnpalchouhan krishnpalchouhan commented Jan 30, 2026

The system prompt now displays the full formatted time including the day of week (e.g., "Current time: Monday, January 5th, 2026 — 3:26 PM (America/Chicago)") instead of just showing the timezone.

Greptile Overview

Greptile Summary

This PR updates the system prompt’s “Current Date & Time” section to include the fully formatted current time (optionally supplied via params.userTime) alongside the user’s timezone, while preserving the previous behavior of showing only the timezone when no formatted time is provided. Tests were adjusted to assert the new “Current time: … (TZ)” output for both 12-hour and 24-hour formats.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk.
  • The change is small, additive, and gated behind existing userTimezone presence; it preserves prior output when userTime is not provided, and the updated tests cover both 12-hour and 24-hour cases plus the fallback timezone-only case.
  • No files require special attention

(2/5) Greptile learns from your feedback when you react with thumbs up/down!

The system prompt now displays the full formatted time including the
day of week (e.g., "Current time: Monday, January 5th, 2026 — 3:26 PM
(America/Chicago)") instead of just showing the timezone.
Copy link
Copy Markdown
Author

@krishnpalchouhan krishnpalchouhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return []; lint fix

@jeanlucthumm
Copy link
Copy Markdown

FYI: #10841 addresses this from a different angle — instead of injecting time into the system prompt (which breaks caching), session_status now returns ISO-8601 and Unix timestamps. See #10836.

@HenryLoenwind
Copy link
Copy Markdown
Contributor

@greptile This is a 0/5 as it destroys an intentional feature.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 8, 2026

You're absolutely right — this PR undoes an intentional performance optimization.

What was destroyed:

Commit 66eec29 ("perf: stabilize system prompt time") deliberately removed the current time from the system prompt to improve prompt cache stability. Including a timestamp that changes every minute breaks Anthropic's prompt caching, significantly increasing costs and latency.

The intentional design is:

  • System prompt shows timezone only (cache-stable)
  • Agents call session_status tool when they need the current time

Why this PR is problematic:

  1. Breaks prompt caching — Every request now gets a different system prompt timestamp, destroying cache hit rates
  2. Ignores the documented architecture — see docs/date-time.md which explicitly states the design rationale
  3. Undoes perf work66eec29 made this change deliberately; ~10 duplicate issues (System prompt: include actual date/time instead of just timezone #7650, Include day of week in system prompt date/time injection #9899, Include current date and day of week in system prompt #11188, etc.) keep requesting to revert it

The correct approach:

Issue #10836 shows the right solution: enhance session_status tool to include machine-readable timestamps (ISO-8601 + Unix) so agents can calculate "30 minutes from now" without guessing.

This PR should be closed in favor of #10836's approach, which solves the underlying problem without sacrificing performance.

@krishnpalchouhan krishnpalchouhan closed this by deleting the head repository Feb 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants