Skip to content

fix(session): preserve subsecond message timestamp order#3086

Merged
1 commit merged into
nesquena:masterfrom
ai-ag2026:fix/webui-message-timestamp-collisions
May 28, 2026
Merged

fix(session): preserve subsecond message timestamp order#3086
1 commit merged into
nesquena:masterfrom
ai-ag2026:fix/webui-message-timestamp-collisions

Conversation

@ai-ag2026
Copy link
Copy Markdown
Contributor

Thinking Path

Two write paths can assign multiple transcript rows the same integer-second timestamp: gateway-backed WebUI turns and batch stamping of timestamp-less messages after streaming/reconciliation. Equal timestamps later make display merges vulnerable to role/content fallback ordering.

What Changed

  • Use float timestamps for gateway-backed WebUI user rows.
  • Give the gateway assistant row a tiny subsecond offset so the turn order is stable.
  • Add _stamp_missing_message_timestamps() to assign subsecond sequences to timestamp-less message batches while preserving existing timestamp and _ts metadata.
  • Add regression tests for gateway ordering and batch stamping.
  • Add a changelog entry.

Why It Matters

This prevents new sidecar/state transcripts from collapsing many rows onto one timestamp and later rendering out of turn order.

Verification

  • python3 -m pytest tests/test_message_timestamp_stamping.py tests/test_webui_gateway_chat_backend.py -q -o addopts= -> 10 passed
  • python3 -m py_compile api/streaming.py api/gateway_chat.py -> passed
  • git diff --check -> passed
  • Added-line hygiene scan for private/local markers, secrets, shell injection, eval/exec, pickle -> 0 findings
  • Independent blocker review -> no blocker issues found

Contract Routing

Task type: runtime/session durability bugfix
Touched areas: gateway-backed chat persistence, streaming session save timestamp stamping, regression tests
Relevant public docs:

  • AGENTS.md
  • CONTRIBUTING.md
  • docs/CONTRACTS.md
    Scope boundaries: no contract document changes; this preserves transcript ordering metadata and does not change message content, storage format, or UI controls.
    Evidence needed before claiming done: regression tests for timestamp sequencing plus focused compile/diff checks.

Risks / Follow-ups

Low risk. Existing float timestamps are already consumed by session summary/display code. This complements the sidecar display-merge recovery PR but does not require it to be useful.

Model Used

OpenAI Codex provider, gpt-5.5, via Hermes/TARS with local git/pytest/gh tooling and an independent reviewer subagent.

@nesquena-hermes nesquena-hermes closed this pull request by merging all changes into nesquena:master in 20f8c7c May 28, 2026
@nesquena-hermes
Copy link
Copy Markdown
Collaborator

Shipped in v0.51.155 / Release EA (stage-batch37, commit 20f8c7c). Thanks for the contribution!

AJV20 pushed a commit to AJV20/hermes-webui that referenced this pull request May 28, 2026
# Conflicts:
#	CHANGELOG.md
AJV20 pushed a commit to AJV20/hermes-webui that referenced this pull request May 28, 2026
3-PR very low-risk cleanup:
- nesquena#3039 api(): timeoutToast:false opt-in for passive pollers
- nesquena#3085 _merged_session_messages_for_display: preserve sidecar order when longer
- nesquena#3086 subsecond timestamps for gateway turns + compaction batches
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants