hermes - 💡(How to fix) Fix Add timestamp field to session JSON messages for proper ordering

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Code Example

{
  "role": "user",
  "content": "...",
  "timestamp": 1748301612.5,
  "tool_call_id": "..."
}
RAW_BUFFERClick to expand / collapse

Session JSON messages lack timestamp field for proper ordering

Problem

Session JSON files stored in ~/.hermes/sessions/session_*.json do not include a timestamp field on individual message objects. The messages database table has a NOT NULL constraint on the timestamp column.

When messages are recovered from JSON (e.g., after a crash), timestamps must be estimated proportionally from session_start and last_updated fields — making accurate message ordering impossible.

Impact

  • Cannot restore accurate message ordering across concurrent sessions
  • Cannot determine which messages were created within the same second
  • Time-based queries on session history return estimated values, not actual

Proposed Fix

Add a timestamp field (Unix epoch, integer or float) to each message object in the JSON file, populated at message creation time.

This is a non-breaking change:

  • Existing JSON files without timestamp fall back to proportional estimation
  • New JSON files written by Hermes include the field automatically
  • SessionDB JSON import logic already handles missing fields gracefully

Schema Change

Message objects in session_*.json should include:

{
  "role": "user",
  "content": "...",
  "timestamp": 1748301612.5,
  "tool_call_id": "..."
}

Files Likely Involved

  • Session JSON serialization/deserialization code (where messages are written to sessions/ directory)
  • SessionDB JSON import logic in hermes_agent/hermes_state.py

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING