Skip to content

fix(chat): persist article conversations - #1039

Merged
WCY-dt merged 1 commit into
DevXDojo:release/v1.3.28from
marcomarcogd:codex/fix-chat-persistence
Aug 27, 2026
Merged

fix(chat): persist article conversations#1039
WCY-dt merged 1 commit into
DevXDojo:release/v1.3.28from
marcomarcogd:codex/fix-chat-persistence

Conversation

@marcomarcogd

Copy link
Copy Markdown
Contributor

Description

Persist article AI chat exchanges in the existing chat session tables so conversations remain accessible after creating a new conversation, switching sessions, or restarting the app.

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✅ Test addition/update

Related Issues

Fixes #1038

Changes Made

  • Accept and validate the existing article/session context in AI chat requests.
  • Save the user question before the provider call and retain it when the provider call fails.
  • Save successful assistant responses and thinking content to the same session.
  • Return the resolved session ID and history-save state without breaking older clients.
  • Reload session history after success or failure and prevent session mutation while a request is running.
  • Add stable ID tie-breakers to session and message ordering.
  • Avoid logging endpoints, provider responses, prompts, or thinking content in the chat handler.

Testing

Test Configuration

  • OS: macOS 15
  • MrRSS Version: current main
  • Go Version: 1.27
  • Node Version: 24 for lint/build

Test Steps

  1. Run GOCACHE=/private/tmp/mrss-chat-gocache go test -v -timeout=5m ./internal/database ./internal/handlers/chat.
  2. Run cd frontend && npm run lint.
  3. Run cd frontend && npm run build.
  4. Run the existing article-operations Cypress spec and verify the new chat persistence case passes.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective
  • New and existing targeted backend tests pass locally
  • Frontend lint and build pass locally
  • This change has no dependent changes

Additional Notes

The new Cypress chat regression passed. Two pre-existing filter tests in the same spec did not find their UI labels in the browser-only harness; the remaining seven cases passed.

Breaking Changes

None. Requests without article_id continue to work without persistence.

@WCY-dt
WCY-dt changed the base branch from main to release/v1.3.28 August 25, 2026 14:16
@marcomarcogd
marcomarcogd marked this pull request as ready for review August 26, 2026 00:52
@WCY-dt

WCY-dt commented Aug 26, 2026

Copy link
Copy Markdown
Member

麻烦解决一下冲突

@marcomarcogd
marcomarcogd force-pushed the codex/fix-chat-persistence branch from 98a9801 to 89a76b0 Compare August 27, 2026 01:40
@marcomarcogd

Copy link
Copy Markdown
Contributor Author

冲突已解决,已基于最新 release/v1.3.28@085e9ff 完成 rebase,官方 AI 搜索回归与聊天持久化回归均独立保留。新提交为 89a76b0c。本地 make check、前端 lint/单测/构建、相关 Go 测试及 macOS 构建均通过;相同 Test 工作流的 Backend、Frontend、Build、Skills 也已全部通过:https://github.com/marcomarcogd/MRSS/actions/runs/33030941332 。麻烦复审。

@WCY-dt
WCY-dt merged commit 2ade02a into DevXDojo:release/v1.3.28 Aug 27, 2026
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.

[BUG] Article AI chat conversations are not persisted

2 participants