beatenevo commented on issue #1534: URL: https://github.com/apache/dubbo-admin/issues/1534#issuecomment-5307847202
## Implementation Plan 1. Define the `SessionStore`, `MessageStore`, and combined `Store`, basing [#1502 ](https://github.com/apache/dubbo-admin/issues/1502) 2. Move the existing in-memory Session, Turn, and Message logic into `MemoryStore` while preserving the current behavior. 3. Unify Store dependency injection so that Session Manager, Agent, and Memory Tool use the same Store instance. 4. Add Gorm models for Session, Turn, and Message. 5. Implement `GormStore` to persist and retrieve Session, Turn, and Message data. 6. Add configurable Memory/Gorm backend selection and MySQL/PostgreSQL database connections. 7. Add schema migration, transaction handling, message ordering constraints, and cascading deletion of session-related data. 8. Add shared contract tests for MemoryStore and GormStore, restart recovery tests, and multi-instance data-sharing tests. ## Expected Result The existing in-memory storage mode will remain available, while Gorm-backed persistent storage can be enabled through configuration. Agent sessions, turns, and messages will survive service restarts and can be shared across multiple AI service instances connected to the same database. But this does not implement tenant identity integration or HITL execution-state persistence because neither contract currently exists in the codebase,it provides the durable conversation storage foundation required for those scenarios. ## 实施方案 1. 基于 [#1502 ](https://github.com/apache/dubbo-admin/issues/1502)定义 `SessionStore`、`MessageStore` 和组合 `Store` 2. 将现有 Session、Turn、Message 的内存逻辑迁移为 `MemoryStore`,保持原有行为。 3. 统一 Store 依赖注入,确保 Session Manager、Agent 和 Memory Tool 使用同一个 Store 实例。 4. 增加 Session、Turn、Message 对应的 Gorm Model。 5. 实现 `GormStore`,完成 Session、Turn、Message 的持久化读写。 6. 增加 Memory/Gorm 后端配置切换,以及 MySQL、PostgreSQL 数据库连接。 7. 增加表迁移、事务处理、消息顺序约束和 Session 关联数据删除。 8. 增加 MemoryStore/GormStore Contract Test、重启恢复测试和多实例共享测试。 最终结果: > 保留现有 MemoryStore 模式,同时支持通过 Gorm 将 Agent Session、Turn 和 Message 持久化到共享数据库,使会话数据能够在服务重启后恢复,并在多个 AI 服务实例之间共享。但是由于缺失Tenant 身份模型与来源和当前没有HITL状态机,对于这两个场景只能提供会话持久化基础。 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
