← Back to PRs

#13510: Enable Dynamic Date Injection in System Resolve #12616

by Harrrdik18 open 2026-02-10 16:31 View on GitHub →
docker agents stale
Summary This PR updates the system prompt generation logic to include the current user date and time when provided. This ensures the agent has accurate temporal context without needing an additional tool call at the start of every session. Motivation Currently, the system prompt only includes the user's timezone but omits the actual date and time to improve prompt cache stability. However, this causes the agent to often guess the wrong date or day of the week, or requires it to run session_status immediately upon startup, which is inefficient. By injecting the date into the ## Current Date & Time section, we eliminate this friction and ensure the agent always knows "when" it is. Changes src/agents/system-prompt.ts : Updated buildTimeSection to accept and render a userTime string (e.g., "Monday, January 5th, 2026"). Updated buildAgentSystemPrompt to pass userTime through to the time section builder. src/agents/system-prompt.test.ts : Removed the test case that explicitly enforced exclusion of the date/time. Added a new test case validating that userTime is correctly included in the generated prompt. Verification Run npx vitest src/agents/system-prompt.test.ts Verified that the system prompt now contains the Date: line when userTime is provided. All 30 tests passed. <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR changes system prompt generation to optionally inject a user-provided date string into the `## Current Date & Time` section. Key changes: - `buildTimeSection` now accepts `userTime` and appends a `Date: ...` line when present (`src/agents/system-prompt.ts`). - The system prompt tests were updated to assert that the injected date appears when `userTime` is provided, and the prior cache-stability test expectation was removed (`src/agents/system-prompt.test.ts`). Main issues to address before merge: - The tests/comments and in-prompt guidance still contain stale/contradictory rationale about *not* injecting date/time for caching, and the `session_status` hint may be wrong when a date is already injected. - If prompt caching is still a requirement for some flows, there’s currently no guard/flag preventing per-session prompt variability when `userTime` is passed. <h3>Confidence Score: 3/5</h3> - This PR is moderately safe to merge, but has clear documentation/guidance contradictions that should be fixed first. - Core change is small and tested, but it introduces prompt variability and leaves contradictory comments and `session_status` guidance that will cause confusion and likely regress intended caching behavior in flows that rely on stable prompts. - src/agents/system-prompt.ts, src/agents/system-prompt.test.ts <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs