#10836: feat(session_status): include ISO-8601 and Unix timestamps for scheduling (fixes #10841)
agents
stale
Cluster:
Error Handling in Agent Tools
## Problem
Fixes: #10841
The cron scheduler requires ISO-8601 timestamps for `schedule.at` jobs, but agents don't have access to the current time in a machine-readable format. When users ask to "set a reminder in 30 minutes", the agent has to guess the target timestamp — often getting it wrong.
The system prompt only includes the timezone (e.g., `Time zone: America/Chicago`), not the actual time. The existing hint says to call `session_status`, but that tool only returned human-readable time like:
```
🕒 Time: Friday, February 6th, 2026 — 2:32 PM (America/New_York)
```
This isn't useful for calculating `now + 1800 seconds` or formatting an ISO-8601 timestamp.
## Solution
Enhance `session_status` to include machine-readable timestamps:
```
🕒 Time: Friday, February 6th, 2026 — 2:32 PM (America/New_York)
ISO-8601: 2026-02-06T19:32:45.123Z | Unix: 1738874365
```
Also update the system prompt hint to mention these formats are available for scheduling.
## Why not inject time into the system prompt?
Several PRs have attempted to add current time to the system prompt:
- #4637, #4901, #7435, #3698, #2154, #4816, #1915
The problem is **prompt cache stability**. The system prompt is cached, and injecting a timestamp that changes every second/minute breaks caching. This was an intentional design decision (see commit 66eec29).
Our approach keeps the system prompt stable while giving agents access to precise timestamps when they need them via a tool call.
## Related Issues
Main tracking issue: #10841
- #7650 — System prompt: include actual date/time instead of just timezone
- #9899 — Include day of week in system prompt date/time injection
- #10071 — Add timezone-aware local time to CONTEXT ENTRY
- #4706 — Session Date Context Drift Causes Memory File Fragmentation
## Test Plan
- [x] `session_status` now returns ISO-8601 and Unix timestamps
- [x] System prompt hint updated to mention scheduling formats
- [x] Tests added for new timestamp output
- [x] All existing tests pass
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
- Extends the `session_status` tool output to include machine-readable current timestamps (`ISO-8601` and Unix seconds) alongside the existing human-readable time.
- Updates the agent system prompt hint to explicitly mention the new scheduling-friendly timestamp formats.
- Adds/updates tests to assert the presence of the ISO-8601 and Unix timestamp lines in `session_status` output and the system prompt hint text.
- Implementation is localized to `src/agents/tools/session-status-tool.ts` and prompt construction in `src/agents/system-prompt.ts`, aligning with the repo’s existing “tool call for current time” approach rather than injecting time into the system prompt.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk.
- Changes are small and well-scoped (string formatting + prompt hint + tests). No behavior changes outside `session_status` output formatting. Only noted issue is a brittle test/implicit contract around Unix timestamp digit length, which is easy to adjust.
- src/agents/openclaw-tools.session-status.test.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#12358: fix: Sessions format timestamps in sessions_history using userTimezone
by xialonglee · 2026-02-09
82.3%
#5624: add support_human_readable_time_format in cron
by simran122 · 2026-01-31
78.2%
#20188: fix: Update sessionFile path when rolling to new session in cron jobs
by jriff · 2026-02-18
77.7%
#23562: feat: add sessionFreshness config for isolated cron jobs (#23539)
by MunemHashmi · 2026-02-22
77.6%
#6315: fix(cron): persist isolated sessions (fixes #6217) - attempt 2
by ChaitanyaSai-Meka · 2026-02-01
76.7%
#13510: Enable Dynamic Date Injection in System Resolve #12616
by Harrrdik18 · 2026-02-10
76.0%
#8097: fix: auto-convert one-shot reminders for reliable delivery
by Gerrald12312 · 2026-02-03
75.8%
#15784: fix: timestamp parsing should convert seconds to milliseconds
by murasame-desu-ai · 2026-02-13
75.6%
#8307: fix(cron): improve tool description with reliable reminder guidance
by vishaltandale00 · 2026-02-03
74.9%
#22387: fix: session_status context tracking undercount for cached providers
by 1ucian · 2026-02-21
74.8%