feat(phase8 #80 D8.6 chunk-1): hard-cut RedisChatMessageHistory + StoredChatMessage* legacy#1720
Merged
Merged
Conversation
…redChatMessage* legacy D8.6 destructive cleanup of legacy chat-history persistence path. Pre-launch system has no users / no data, so we simply delete instead of migrate (per earayu2 msg=9730bb6b — accept hard-cut). Removed ------- - ``RedisChatMessageHistory`` (the entire class) from ``aperag/utils/history.py``. Chat history is canonical at-rest in the ``agent_message`` table (D8.2 #74) and the read path now flows through ``UIMessageStore`` per turn. - ``aperag/chat/history/`` directory (``StoredChatMessage`` / ``StoredChatMessagePart`` legacy classes); replaced by ``UIMessagePart`` in #74. ``aperag.chat`` had no remaining surface so the dir is deleted. - ``RedisChatMessageHistory(...).clear()`` from ``chat_service.delete_chat`` — no Redis history to clear; the chat row delete cascades the canonical rows. - The legacy Redis read path from ``chat_title_service.generate_title`` — it now reads recent ``AgentTurn`` rows via ``query_agent_turns`` and composes OpenAI-format prompts from each turn's ``input_text`` (user) plus the persisted assistant ``UIMessage`` text parts via ``UIMessageStore.read``. Kept ---- - ``get_async_redis_client`` in ``aperag/utils/history.py`` — still used by ``aperag/utils/weixin/client.py`` for non-history Redis access. Caller sweep ------------ - Only remaining ``from aperag.utils.history import`` site is ``weixin/client.py`` (importing ``get_async_redis_client``). - Zero remaining ``RedisChatMessageHistory`` Python references; the remaining hits are doc / docstring mentions describing the removal. - Zero remaining ``StoredChatMessage`` / ``aperag.chat.history`` Python references. Tests ----- - Rewrote ``test_chat_title_service.py`` to drive the empty-history branch via an empty ``query_agent_turns`` result instead of monkey- patching the legacy Redis class. - Full unit suite: 996 passed, 29 skipped. Follow-up within #80 lane (subsequent chunk PR) ------------------------------------------------ - Wire ``UIMessageStore.write`` into the agent runtime emit path and drop ``snapshot_assembler`` + ``agent_artifact`` / ``agent_timeline_event`` tables (separate scope, separate PR).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Task #80 D8.6 hard-cut chunk 1 — destructive cleanup of legacy chat-history persistence layer. Pre-launch system has no users / no data, so we delete instead of migrate (per @earayu2 msg=9730bb6b — accept hard-cut).
What's removed
RedisChatMessageHistoryclass (entire) fromaperag/utils/history.py. Chat history is canonical at-rest inagent_message(D8.2 [Features] support preview and download documents #74); the read path now flows throughUIMessageStore.aperag/chat/history/directory (StoredChatMessage/StoredChatMessagePart); replaced byUIMessagePartin [Features] support preview and download documents #74.RedisChatMessageHistory(...).clear()inchat_service.delete_chat— no Redis history to clear.chat_title_service.generate_title— it now reads recentAgentTurnrows viaquery_agent_turnsand composes OpenAI-format prompts fromturn.input_text(user) + persisted assistantUIMessagetext parts viaUIMessageStore.read.What's kept
get_async_redis_clientinaperag/utils/history.py— still used byaperag/utils/weixin/client.pyfor non-history Redis access.Caller sweep
from aperag.utils.history importsite isweixin/client.py(importingget_async_redis_client).RedisChatMessageHistoryPython references; remaining hits are doc / docstring mentions describing the removal.StoredChatMessage/aperag.chat.historyPython references.Tests
test_chat_title_service.pyto drive the empty-history branch via emptyquery_agent_turnsinstead of monkey-patching the legacy Redis class.Follow-up within #80 lane (separate PR)
UIMessageStore.writeinto the agent runtime emit path and dropsnapshot_assembler+agent_artifact/agent_timeline_eventtables.Test plan
uv run pytest tests/unit_test/ -x— 996 passeduvx ruff check --fix && uvx ruff format— cleanRedisChatMessageHistory/StoredChatMessage/aperag.chat.historyPython references → zero call-sites remain