Repository navigation
fix(agents): keep date reasoning current in long-running sessions - #116090
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 29, 2026, 6:06 PM ET / 22:06 UTC. ClawSweeper reviewWhat this changesThis PR replaces the system prompt’s timezone-only section with a user-local calendar date and time zone below the prompt-cache boundary, updates embedded, CLI, command, and compaction prompt assembly, and refreshes tests and documentation. Merge readinessKeep this PR open for maintainer review. The supplied exact-head evidence and CI results support the prompt change, but it intentionally aligns OpenClaw temporal context with Codex’s per-turn contract, which still needs the repository-required direct sibling-Codex source check before a merge verdict. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw builds a system prompt for embedded agents, CLI agents, command flows, and compaction. Configuration supplies the user time zone, prompt assembly computes the local date, and the resulting volatile suffix guides agent date reasoning without invalidating the stable prompt-cache prefix. flowchart LR
A[Agent configuration] --> B[Resolve user time zone]
B --> C[Compute local calendar date]
C --> D[Build volatile temporal context]
D --> E[System prompt cache boundary]
E --> F[Embedded, CLI, command, and compaction prompts]
F --> G[Agent date reasoning]
Decision needed
Why: The branch deliberately adopts a dependency-informed temporal-context model, and repository policy reserves Codex-related verdicts for a reviewer who has personally inspected the exact sibling runtime behavior. Before merge
Agent review detailsSecurityNone. PR surfaceSource +1, Tests +24, Docs +1. Total +26 across 21 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the date and IANA time zone in the cache-volatile prompt suffix, retain exact time as tool-backed guidance only when that tool exists, and merge only after direct Codex-contract confirmation plus normal maintainer approval. Do we have a high-confidence way to reproduce the issue? Unclear: the original temporal-grounding failure is source-reproducible from the prior timezone-only prompt shape, and this branch adds date-rollover tests, but this review did not independently run a current-main live long-session reproduction. Is this the best way to solve the issue? Unclear: the shared prompt-builder approach is the narrowest apparent fix because it reaches embedded, CLI, command, and compaction paths, but the claimed Codex semantic match still requires direct dependency-source confirmation. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against 51241c4e00ff. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
ClawSweeper rank-up move resolution for exact head
The completed review on @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
56882a3 to
d064c20
Compare
|
ClawSweeper finding resolution for exact head
Expanded immutable-head Blacksmith Testbox proof passed 252 tests across every touched prompt entry point plus compaction: https://github.com/openclaw/openclaw/actions/runs/30494288303 GitHub CI is running on this exact head. Maintainer dependency-contract gate completed directly against sibling Codex source at
This confirms the PR's contract: refresh calendar date and timezone below the stable prompt-cache prefix, while keeping exact clock time tool-backed. ClawSweeper's remaining rank-up move is satisfied. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…enclaw#116090) * fix(agents): ground date reasoning below cache boundary Co-authored-by: Deepak Jain <[email protected]> * docs: refresh temporal context map * chore: leave release notes to release curation * test(agents): keep compaction date mock complete --------- Co-authored-by: Deepak Jain <[email protected]>
Fixes #63181
Supersedes #91250 with a fix for the underlying temporal-grounding failure rather than a heading-only rename.
What Problem This Solves
Fixes an issue where users asking date-relative questions could get incorrect "today", "yesterday", or deadline reasoning in long-running sessions because the system prompt exposed only a time zone and relied on the model to notice message timestamps or call
session_status.Why This Change Was Made
OpenClaw now recomputes the user-local calendar date for every prompt build and places it with the IANA time zone at the front of the volatile system-prompt suffix. The live clock stays out of the prompt, exact time remains tool-backed, and date rollover or time-zone changes cannot invalidate the stable prompt-cache prefix.
The replacement design follows the stronger current harness pattern: Codex supplies current date plus time zone in per-turn environment context, while OpenCode emits a date baseline and rollover updates. Gemini CLI's first-message-only date context can become stale across resumed multi-day sessions, and Pi's date removal left users reporting random-date behavior. A heading rename alone would not fix the reported failure.
User Impact
Agents receive an explicit local calendar date on every turn, including after day rollover, while preserving prompt-cache reuse. Restricted agents are only told to use
session_statusfor exact time when that tool is actually available.Before:
After:
Evidence
session_statusinstruction.node scripts/check-changed.mjs -- <20 touched files>passed on Blacksmith Testbox, including all policy guards, deadcode, three typecheck lanes, full core lint fanout, scripts, docs, and tooling: https://github.com/openclaw/openclaw/actions/runs/30490674386git diff --checkand targetedoxfmt --checkpassed.