Skip to content

fix(system-prompt): hint session_status for date/time instead of embedding it#3677

Merged
Takhoffman merged 2 commits intoopenclaw:mainfrom
conroywhitney:fix/1897-session-status-time-hint
Feb 1, 2026
Merged

fix(system-prompt): hint session_status for date/time instead of embedding it#3677
Takhoffman merged 2 commits intoopenclaw:mainfrom
conroywhitney:fix/1897-session-status-time-hint

Conversation

@conroywhitney
Copy link
Copy Markdown
Contributor

@conroywhitney conroywhitney commented Jan 29, 2026

The system prompt intentionally excludes the current date/time for cache stability (see 66eec29). This leaves agents without date awareness, causing wrong day-of-week claims (#1897, #1928, #2108).

Instead of reverting the cache optimization, add a one-line hint directing agents to use session_status when they need the current date/time. This keeps the prompt stable while teaching frontier models where to look.

Also adds a negative test ensuring the date/time is NOT re-added to the system prompt, with comments explaining why and pointing to #3658 for the complementary gateway-level timestamp injection approach.

Refs: #1897, #1928, #3658


QA Results

Before Fix (no hint in prompt)

Test 1:

What day of the week is it today?
→ "Today is Thursday." (wrong)
Is it the weekend?
→ "Nope, not yet! Thursday means you've still got one more day" (wrong day)
How many days until February 1st?
→ "199 days until February 1st, 2026." (wildly wrong — actual: 4 days)

Test 2:

How many days until February 1st?
→ "Today is July 11, 2025. February 1st, 2026 is 205 days away." (hallucinated date)

Test 3:

Is it the weekend?
→ "Yes! It's Saturday, July 19, 2025." (hallucinated — it was Wednesday Jan 28, 2026)

After Fix — Main Session (full prompt)

Test 1:

How many days until February 1st?
→ "It's January 28, 2026 — so 4 days until February 1st." ✅ (used session_status)

Test 2:

What day of the week is it today?
→ "It's Wednesday, January 28th, 2026." ✅ (used session_status)
Is it the weekend?
→ "Nope — it's Wednesday evening. Middle of the week." ✅

Test 3:

How many days until February 1st?
→ "It's currently January 28th, so February 1st is 4 days away." ✅

After Fix — Spawned Subagent Sessions (minimal prompt)

We verified via debug logging that isMinimal does not strip the time hint — buildTimeSection is not gated by isMinimal, only by userTimezone. Confirmed: promptMode=minimal | hasTimeHint=true.

However, spawned agents behave differently:

Test Round Tool Used Correct?
"What day?" 1 exec date
"Weekend?" 1 none (hallucinated "Thursday July 17, 2025")
"Days til Feb 1?" 1 exec python3
"What day?" 2 exec date
"Weekend?" 2 none (hallucinated "Thursday")
"Days til Feb 1?" 2 exec python3
"Weekend?" 3 exec date
"Weekend?" 4 exec date

Key findings:

  • The hint IS present in minimal (subagent) prompts — confirmed via subsystem logging
  • When models check, they prefer exec over session_status (reasonable — more direct)
  • Simple yes/no date questions ("is it the weekend?") are non-deterministic — sometimes the model checks, sometimes it hallucates
  • Computation questions ("how many days until...") reliably trigger tool use
  • Zero session_status calls across all spawned tests — exec is the natural instinct

Complementary Fix: Gateway Timestamp Injection (#3658)

This hint helps frontier models that think to check, but doesn't help when models skip checking entirely. #3658 (gateway timestamp injection) is the stronger complement — it injects the date into the user message itself so models don't need to look it up.

However, #3658 as proposed injects timestamps into incoming user messages at the gateway level. Spawned subagent tasks may need the same treatment — the task text passed via sessions_spawn goes through callGateway({ method: "agent", params: { message: task } }) and currently has no timestamp injected. If #3658 only covers inbound channel messages (TUI/web), spawned agents would still be blind.

🤖 AI-Assisted

This PR was developed and tested collaboratively between a human and an AI agent (Claude, running in Moltbot). Testing included spawned-session tests across multiple rounds, debug logging verification, and live main-session QA. We understand what the code does — it's a one-line hint + a guardrail test.

…dding it

The system prompt intentionally excludes the current date/time for cache
stability (see 66eec29). This leaves agents without date awareness,
causing wrong day-of-week claims (openclaw#1897, openclaw#1928, openclaw#2108).

Instead of reverting the cache optimization, add a one-line hint directing
agents to use session_status when they need the current date/time. This
keeps the prompt stable while teaching frontier models where to look.

Also adds a negative test ensuring the date/time is NOT re-added to the
system prompt, with comments explaining why and pointing to openclaw#3658 for the
complementary gateway-level timestamp injection approach.

Refs: openclaw#1897, openclaw#1928, openclaw#3658
@openclaw-barnacle openclaw-barnacle bot added the agents Agent runtime and tooling label Jan 29, 2026
Copy link
Copy Markdown

@orzelig orzelig left a comment

Choose a reason for hiding this comment

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

Excellent fix! The hint preserves cache stability while giving models the right tool to check date/time. Comprehensive QA shows it works well for main sessions. Good negative test ensuring the date isn't re-added. The detailed testing documentation is super helpful. LGTM!

@Takhoffman
Copy link
Copy Markdown
Contributor

Lgtmi

@clawd-conroy
Copy link
Copy Markdown

Same note as on #3705 — the macOS CI jobs were cancelled with 0 steps executed (self-hosted runner likely needs approval for external contributors). All non-macOS checks pass. Thanks! 🦞

@Takhoffman Takhoffman self-assigned this Jan 31, 2026
Takhoffman added a commit that referenced this pull request Feb 1, 2026
@Takhoffman Takhoffman merged commit a393ae7 into openclaw:main Feb 1, 2026
11 of 23 checks passed
uxcu pushed a commit to uxcu/kook-openclaw that referenced this pull request Feb 5, 2026
…status-time-hint

fix(system-prompt): hint session_status for date/time instead of embedding it
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…status-time-hint

fix(system-prompt): hint session_status for date/time instead of embedding it
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.

4 participants