Skip to content

feat(ai): add persistent conversation store backends - #1540

Open
beatenevo wants to merge 6 commits into
apache:aifrom
beatenevo:feat/ai-gorm-store
Open

feat(ai): add persistent conversation store backends#1540
beatenevo wants to merge 6 commits into
apache:aifrom
beatenevo:feat/ai-gorm-store

Conversation

@beatenevo

@beatenevo beatenevo commented Aug 22, 2026

Copy link
Copy Markdown

Please provide a description of this PR:

This PR adds pluggable persistence for AI conversation data.

Related to #1502.

Changes

  • Define SessionStore, MessageStore, and the combined Store interfaces.
  • Migrate the existing in-memory session, turn, and message logic to MemoryStore.
  • Inject one shared Store instance into the Session Manager, Agent, and Memory Tool.
  • Add GORM models for sessions, turns, and messages.
  • Implement GormStore for persistent session history.
  • Add Memory/GORM backend configuration and database connection initialization.
  • Add schema migration support.
  • Add transactional writes and deletions.
  • Enforce message ordering with a unique (turn_id, sequence) constraint.
  • Delete session-related messages and turns transactionally without database foreign keys.
  • Prevent expired-session cleanup from deleting sessions refreshed by another instance.
  • Add contract, rollback, restart recovery, multi-instance sharing, JSON codec, and component regression tests.

Testing

The following checks pass:

  • go test ./...
  • go test -race ./store/... ./component/agent/react ./component/tools/test ./component/server/engine ./component/server/engine/sse
  • go vet ./...

SQLite is used for local persistence and behavioral tests. MySQL and PostgreSQL drivers are included and compile successfully. Service-backed MySQL/PostgreSQL integration tests are outside the current PR because CI database services are not configured.

To help us figure out who should review this PR, please put an X in all the areas that this PR affects.

  • Docs
  • Installation
  • User Experience
  • Dubboctl
  • Console
  • Core Component

Please check any characteristics that apply to this pull request.

@sonarqubecloud

Copy link
Copy Markdown

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