Skip to content

fix(session): preserve sidecar order in display merges#3085

Merged
1 commit merged into
nesquena:masterfrom
ai-ag2026:fix/webui-sidecar-order-merge
May 28, 2026
Merged

fix(session): preserve sidecar order in display merges#3085
1 commit merged into
nesquena:masterfrom
ai-ag2026:fix/webui-sidecar-order-merge

Conversation

@ai-ag2026
Copy link
Copy Markdown
Contributor

Thinking Path

A Telegram/messaging session can have a WebUI sidecar transcript plus mirrored Agent/state rows. When many sidecar rows share the same timestamp precision, the existing display merge can sort by (timestamp, role, content) and change transcript order.

What Changed

  • Preserve sidecar transcript order when the sidecar already has at least as many rows as the mirrored CLI/state transcript.
  • Keep the older chronological merge path for cases where state/CLI has additional rows to append.
  • Add regression coverage for collapsed timestamps that previously grouped assistant rows ahead of user rows.
  • Add a changelog entry.

Why It Matters

This prevents valid messaging transcripts from rendering as if assistant replies vanished or moved when timestamp precision collapses during sidecar/state reconciliation.

Verification

  • python3 -m pytest tests/test_issue2472_fork_from_here_messaging.py -q -o addopts= -> 7 passed
  • python3 -m py_compile api/routes.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 display bugfix
Touched areas: api/routes.py, messaging/session display merge tests
Relevant public docs:

  • AGENTS.md
  • CONTRIBUTING.md
  • docs/CONTRACTS.md
    Scope boundaries: no contract document changes; this preserves the existing display transcript invariant instead of redefining it.
    Evidence needed before claiming done: regression test plus focused route compile/diff checks.

Risks / Follow-ups

Low risk. The sidecar-order path only applies when the sidecar transcript is at least as complete as the mirrored state transcript. Separate timestamp-write hardening is handled in a companion PR.

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