Skip to content

fix(status): return current time from session_status and harden time-hint prompt#100187

Closed
connermo wants to merge 1 commit into
openclaw:mainfrom
connermo:fix/session-status-current-time
Closed

fix(status): return current time from session_status and harden time-hint prompt#100187
connermo wants to merge 1 commit into
openclaw:mainfrom
connermo:fix/session-status-current-time

Conversation

@connermo

@connermo connermo commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The session_status card exposed a "Current time" slot, and the agent system prompt told the model to run session_status whenever it needed the date/time. But buildStatusMessage never populated the time line — args.timeLine was always undefined — so the tool returned no clock value. The model, having no real time to read, would fall back to guessing from stale training data (wrong day/date), breaking anything time-dependent (scheduling, "today/now", elapsed/age math).

Why This Change Was Made

Make the status card actually carry a live wall-clock line so the documented "call session_status for the time" contract works. The time is derived from now + the configured userTimezone via resolveCronStyleNow, so every render path (the /status command and the session_status tool) surfaces the same value. The prompt hint is also hardened to explicitly forbid guessing the current moment and to name the Current time field to read.

User Impact

Agents now get an accurate current date/time from session_status instead of guessing. No config or API changes; the time line renders from existing config/timezone.

Evidence

  • New behavior test in src/status/status-message.test.ts asserts the rendered card contains Current time:, the timezone, and the fixed Reference UTC line for a known now.
  • node scripts/run-vitest.mjs src/status/status-message.test.ts → 3 passed.

🤖 Generated with Claude Code

…hint prompt

The session_status status card had a timeLine render slot that was never
populated, so the model was told to call session_status for the date/time
yet got none back and would guess (time hallucination). Derive the live
Current time line from now + config timezone in buildStatusMessage so both
the /status command and session_status tool surface it, and strengthen the
system-prompt hint to forbid guessing the current time.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS labels Jul 5, 2026
@clawsweeper

clawsweeper Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 5, 2026, 2:03 AM ET / 06:03 UTC.

Summary
The branch computes a current-time line in buildStatusMessage from the existing config/clock helper, strengthens the system-prompt time hint, and adds status-message regression coverage.

PR surface: Source +7, Tests +20. Total +27 across 3 files.

Reproducibility: yes. by source inspection: current main documents session_status as the live-time source, but the status renderer only emits args.timeLine and the canonical caller does not supply it. I did not run a live runtime repro because this review is read-only.

Review metrics: none identified.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🧂 unranked krab
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted live output or a terminal screenshot/recording from /status or session_status showing Current time and Reference UTC after the fix.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body only reports a unit test command; before merge, the contributor should add redacted terminal output, logs, screenshot, or recording from a real /status or session_status run showing the after-fix time line. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] The only merge-readiness gap found is proof: the contributor has not shown a real /status or session_status run after the fix, so reviewers cannot yet compare live user-visible output against the unit test.

Maintainer options:

  1. Decide the mitigation before merge
    Land the centralized status-renderer fix after the contributor adds redacted real behavior proof showing Current time and Reference UTC in /status or session_status output.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] This PR needs contributor-supplied real behavior proof before merge; there is no narrow automated code repair to queue.

Security
Cleared: The diff only touches TypeScript status/prompt code and a focused test; it does not change dependencies, workflows, permissions, secrets, package metadata, or code-download paths.

Review details

Best possible solution:

Land the centralized status-renderer fix after the contributor adds redacted real behavior proof showing Current time and Reference UTC in /status or session_status output.

Do we have a high-confidence way to reproduce the issue?

Yes by source inspection: current main documents session_status as the live-time source, but the status renderer only emits args.timeLine and the canonical caller does not supply it. I did not run a live runtime repro because this review is read-only.

Is this the best way to solve the issue?

Yes: computing the missing line inside the shared status renderer with the existing resolveCronStyleNow helper is the narrowest maintainable fix because it covers both /status and session_status without duplicating time formatting at each caller.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 062f88e3e3af.

Label changes

Label changes:

  • add P2: This is a normal-priority core agent/status bug fix for a documented time-handling contract, with limited blast radius and no emergency signal.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body only reports a unit test command; before merge, the contributor should add redacted terminal output, logs, screenshot, or recording from a real /status or session_status run showing the after-fix time line. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P2: This is a normal-priority core agent/status bug fix for a documented time-handling contract, with limited blast radius and no emergency signal.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body only reports a unit test command; before merge, the contributor should add redacted terminal output, logs, screenshot, or recording from a real /status or session_status run showing the after-fix time line. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +7, Tests +20. Total +27 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 9 2 +7
Tests 1 20 0 +20
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 29 2 +27

What I checked:

Likely related people:

  • steipete: Recent commits touched both status rendering and the system-prompt area, and current local blame on the status render slot points at the broad refactor/import commit authored by Peter Steinberger. (role: recent area contributor; confidence: high; commits: 062f88e3e3af, 4d181b62a96d, ea5d4b794327; files: src/status/status-message.ts, src/status/status-text.ts, src/agents/system-prompt.ts)
  • MoerAI: Authored the merged fix that refreshed stale Current time helper blocks for heartbeat/cron, adjacent to the helper this PR reuses. (role: current-time helper contributor; confidence: high; commits: 6451550cd7fd; files: src/agents/current-time.ts)
  • obviyus: Recent main history shows multiple agent/system-prompt and auto-reply prompt-related fixes near the changed prompt surface. (role: recent agents prompt contributor; confidence: medium; commits: 48e8965b1060, 4e6933c84f18, 568be74e159e; files: src/agents/system-prompt.ts)
  • Takhoffman: Remote current-time history shows the cron-style current-time prompt injection originated in the helper lineage later reused by this status fix. (role: original current-time behavior contributor; confidence: medium; commits: d2c2f4185b0e; files: src/agents/current-time.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 5, 2026
@AmirF194

AmirF194 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Confirmed the root cause and the fix. buildStatusMessage exposed a "Current time" slot but no caller ever set args.timeLine (status-text.ts builds the args without it), so session_status and /status rendered no clock and the model was left to guess from stale training data.

The fix is correct and well scoped:

  • It reuses the canonical resolveCronStyleNow helper instead of adding new time formatting.
  • args.timeLine ?? preserves an explicit caller override, so no regression on other paths.
  • Reading timezone and format from config.agents.defaults is consistent with every other time consumer in the tree (there is no per-agent timezone override), so it matches the value the system prompt already uses to decide whether to show the hint.

On the prompt-cache seam, which is the part most likely to bite: the live per-call time lands only in the tool result and status card, which is dynamic and sits after the cached system-prompt prefix. The system-prompt change is static instruction text with no embedded clock value, so the cached prefix stays byte-stable. No cache-busting, and it follows the existing cron/heartbeat current-time pattern.

The new test fails without the fix (pre-fix the Current time: line is absent) and anchors on the timezone-independent Reference UTC line, so it is not host-flaky. The fixture timestamp checks out to 2025-07-03 08:00 UTC.

One optional nit: the test only covers userTimezone: "UTC", so the localized-offset rendering is proven by current-time's own tests rather than here. Not blocking. Looks good to me.

@steipete

steipete commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Thank you for the contribution. This fix landed with contributor co-authorship preserved in #100258 (deac98eb7204fdb51589c5e369b95be128215e77).

I consolidated the source fixes into a maintainer takeover because the contributor branches were based on rewritten pre-main history; updating them directly would have pulled unrelated changes into the review surface. Closing this PR as superseded by the landed batch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants