Skip to content

fix(chat-history): create the store after the auth database is opened - #12788

Merged
mudler merged 1 commit into
mudler:masterfrom
walcz-de:fix/chat-history-store-after-auth-db
Oct 20, 2026
Merged

mudler merged 1 commit into
mudler:masterfrom
walcz-de:fix/chat-history-store-after-auth-db

Conversation

@walcz-de

Copy link
Copy Markdown
Contributor

Description

Follow-up fix to #12663 (server-side chat history).

The conversation routes are only registered when the chat history store exists, and the store needs the auth database. It was created in start(), which New() runs before it opens the auth database (core/application/startup.go). So the store was always nil and /api/conversations answered 404 even with auth enabled; the React UI then fell back to localStorage and nothing synced between devices.

The route tests from #12663 register the routes with a store directly and never went through New(), which is why this slipped through. We found it while probing a build of current master with auth on.

Change: create the store right after the auth database is opened (initChatHistoryStore()).

Notes for Reviewers

  • New test core/application/chat_history_store_test.go (//go:build auth) goes through New(): with auth the store exists; without auth, or with the WebUI disabled, it stays nil. Without the fix the first case fails.
  • No behaviour change when auth is off.

Signed commits

  • Yes, I signed my commits.
  • Documentation updated (docs/content/) for user-facing changes, or not applicable (bug fix: the documented server-side chat history now works as described; Docs-Not-Needed trailer in the commit)

AI assistance is disclosed via the Assisted-by: trailer.

🤖 Generated with Claude Code

The conversation routes are only registered when the chat history store
exists, and the store needs the auth database. It was created in start(),
which New() runs before it opens the auth database, so the store was always
nil and /api/conversations answered 404 with auth enabled; the React UI fell
back to localStorage and nothing was synced between devices.

The route tests register the routes with a store directly and never went
through New(). Create the store right after the auth database is opened,
and cover it through New(): with auth the store exists, without auth or with
the WebUI disabled it stays nil.

Docs-Not-Needed: bug fix; the documented server-side chat history now works as described
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Stefan Walcz <stefan.walcz@walcz.de>
@mudler
mudler merged commit 6fc2bc4 into mudler:master Oct 20, 2026
1 check passed
@mudler-agent mudler-agent added the bug Something isn't working label Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants