fix(api): paginate compacted session history - #69321
Conversation
00b7c6e to
52950f7
Compare
|
Thanks for preserving the distinction between compaction archives and rewound rows; current main confirms the underlying gap: Problems
Suggested changes
Automated hermes-sweeper review. |
52950f7 to
b8f1384
Compare
|
Addressed all requested surfaces on current main's read-connection implementation. The dashboard client requests compacted history, loads the newest 500 messages, and can page backward through the complete transcript. The external Sessions API now exposes the same |
# Conflicts: # gateway/platforms/api_server.py # hermes_cli/web_routers/sessions.py # hermes_state.py # tests/test_hermes_state.py # web/src/lib/api.ts
|
Refreshed and reduced against current Merged #86595 owns the core compacted-history behavior, so this branch no longer duplicates it. The surviving contract adds external Sessions API parity, dashboard backward paging, explicit-profile compatibility, and documentation. A quality review found moving-tail offsets unstable when messages append between requests; the final implementation adds stable Verification on the exact head:
Rewound rows remain excluded, and legacy active-only/unbounded defaults plus offset/order callers remain compatible. Hosted workflows still require maintainer approval. |
|
CI follow-up: the refreshed head has two unrelated timing failures:
I attempted a failed-job rerun, but GitHub requires repository admin rights. A maintainer rerun should distinguish these apparent timing flakes from persistent failures. |
Summary
include_compactedmessage visibility mode that restorescompression-archived rows without exposing rewound/undone rows
from_endpagination and an additivepagination.totalfield so clientscan fetch the newest full-history page without first knowing its total size
parameters
Why
In-place compaction intentionally retains the original transcript as
active = 0, compacted = 1, but the dashboard messages endpoint only exposedactive rows. Transcript clients therefore reached the post-compaction boundary
and could not paginate to the beginning even though the history remained in the
database. Related to the full-history behavior reported in #32561.
Test plan
uv run pytest -q tests/test_hermes_state.py::TestGetMessagesPaginationuv run pytest -q tests/hermes_cli/test_web_server.py::TestWebServerEndpoints::test_get_session_messages_follows_compression_tip tests/hermes_cli/test_web_server.py::TestWebServerEndpoints::test_get_session_messages_pages_compacted_history_from_enduv run ruff check hermes_state.py hermes_cli/web_server.py tests/test_hermes_state.py tests/hermes_cli/test_web_server.pyTestClientagainst a SQLite backup ofa real compacted session; the returned tail offset and total matched direct
SessionDBcounts, and rewound rows remained excludedPlatform tested
uv