Skip to content

Fix websocket chat history ordering#152

Merged
pmbstyle merged 1 commit into
mainfrom
codex/fix-ws-chat-history-ordering
Jun 2, 2026
Merged

Fix websocket chat history ordering#152
pmbstyle merged 1 commit into
mainfrom
codex/fix-ws-chat-history-ordering

Conversation

@pmbstyle

@pmbstyle pmbstyle commented Jun 2, 2026

Copy link
Copy Markdown
Owner

What changed

  • order list_memory_entries_by_chat() by created_at DESC, rowid DESC instead of id DESC
  • add a regression test that proves UUID order can differ from message chronology

Why

Desktop WebSocket reconnect history now reads recent messages from stored memory entries. The SQLite query was sorting by random uuid4 IDs, so reconnects could show an arbitrary slice of history instead of the latest turns.

Impact

  • desktop chat history on reconnect now uses actual message time ordering
  • the regression is covered at the store layer where the bug originates

Validation

  • python3 -m py_compile src/octopal/infrastructure/store/sqlite.py tests/test_memory_system.py
  • git diff --check
  • uv run pytest tests/test_memory_system.py tests/test_gateway_ws_resolution.py -q could not complete in this environment because uv hit DNS/download failures fetching fsspec==2026.1.0

@pmbstyle pmbstyle changed the title [codex] fix websocket chat history ordering Fix websocket chat history ordering Jun 2, 2026
@pmbstyle pmbstyle self-assigned this Jun 2, 2026
@pmbstyle pmbstyle marked this pull request as ready for review June 2, 2026 13:31
@pmbstyle pmbstyle merged commit f889de2 into main Jun 2, 2026
4 checks passed
@pmbstyle pmbstyle deleted the codex/fix-ws-chat-history-ordering branch June 2, 2026 13:41
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.

1 participant