[PR #6780] [MERGED] feat: add message bookmarks, notes, pins and optional recovery #7329

Closed
opened 2026-10-23 04:18:42 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6780
Author: @SirAdoni
Created: 9/27/2026
Status: ✅ Merged
Merged: 9/28/2026
Merged by: @SpicyMarinara

Base: staging ← Head: contrib/6698-message-tools


📝 Commits (10+)

  • e452399 feat: add message bookmarks notes pins and optional recovery
  • cd83b17 Merge staging and preserve message trash on downgrade
  • 5a4acfc fix: align message recovery results and enforce restored pin limits
  • 31b65c3 Merge staging inventory update into message tools
  • 517e4a7 fix: clean expired message recovery records safely
  • 822363c Merge staging ruleset inventory update into message tools
  • ba08173 style: format message trash maintenance setup
  • c08a4ba fix: preserve message recovery and context edit consistency
  • 8efebee fix: keep hidden bookmarks and Mari retries out of message lists
  • 5758252 fix: avoid nested context-start metadata queue deadlock

📊 Changes

38 files changed (+3229 additions, -150 deletions)

View changed files

📝 CHANGELOG.md (+23 -1)
➕ e2e/message-marks-trash.e2e.ts (+216 -0)
➕ e2e/message-trash-batching.e2e.ts (+183 -0)
📝 packages/client/src/components/chat/ChatInput.tsx (+1 -1)
📝 packages/client/src/components/chat/ChatMessage.tsx (+7 -0)
➕ packages/client/src/components/chat/ChatMessageMarksPanels.tsx (+255 -0)
📝 packages/client/src/components/chat/ChatMessageSearch.tsx (+76 -31)
📝 packages/client/src/components/chat/ConversationInput.tsx (+1 -1)
📝 packages/client/src/components/chat/ConversationMessage.tsx (+2 -0)
📝 packages/client/src/components/chat/ConversationMessageActions.tsx (+3 -1)
📝 packages/client/src/components/chat/ConversationMessageGrouped.tsx (+2 -0)
📝 packages/client/src/components/chat/HomeProfessorMariChat.tsx (+2 -2)
📝 packages/client/src/components/chat/MessageActionButton.tsx (+65 -1)
➕ packages/client/src/components/chat/MessageMarks.tsx (+287 -0)
📝 packages/client/src/components/panels/SettingsPanel.tsx (+17 -0)
📝 packages/client/src/components/panels/settings/FeatureSwitchesSettings.tsx (+1 -0)
📝 packages/client/src/hooks/use-chats.ts (+100 -6)
📝 packages/client/src/localization/locales/en.json (+52 -0)
📝 packages/client/src/stores/ui.store.ts (+8 -0)
📝 packages/server/src/app.ts (+12 -0)

...and 18 more files

📄 Description

Linked issue

Closes #6808. Partial implementation of #6698; the umbrella issue remains open.

Why this change

Users need persistent bookmarks, private notes and optional message recovery without losing queued edits or blocking chat metadata changes.

What changed

  • Reuse existing chat menus and storage for bookmarks, private notes, context pins and default-off message retention/recovery.
  • Fix metadata queue re-entry, queued-edit snapshots, stale restore, partial restore cleanup and feedback. Keep Game restoration blocked and existing recovery available when retention is disabled.
  • Keep deletion permanent for turns with saved Game state even after a chat mode change; mixed selections report only messages actually retained for recovery.
  • Keep marks visible outside hover actions, make note saving usable in short/panned mobile viewports, and exclude private notes from prompts and default exports.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

pnpm check; prompt and focused storage/route regressions; six conversation/roleplay desktop/mobile Chromium/WebKit browser cases; seven shell smoke cases passed. Strengthened contributor history-start and feature-settings regressions also passed. The combined six-feature browser run passed 28 applicable cases with two intentional mobile skips; the final combined trash regression also passed.

Local CodeRabbit completed: two valid findings fixed; three suggestions rejected with code-based reasons recorded in review discussion. Latest hosted findings are fixed and published in d035de970, including the outside-diff saved Game-state recovery boundary. Full pnpm check passed on that exact revision. Current-head review and checks remain merge gates.

Manual verification

Manually verify marks and note saving with the real mobile keyboard, pin/history limits, partial recovery, retention disabled and export privacy. Recovery restores messages and swipes; it does not undo other world-state effects.

Automated browser evidence does not claim physical-device or manual container verification. Human checklist states are preserved.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened
  • Version/release files updated (only if this PR includes a version bump)

Added an Unreleased changelog entry. No release metadata or user-facing docs changed.

UI evidence

Browser evidence (download the HTML to view the embedded screenshots). Captions distinguish before/after captures from current feature screenshots.

Summary by CodeRabbit

  • New Features
    • Bookmark messages, add private notes, and pin important messages to keep them in prompt context.
    • View and manage bookmarks and deleted messages from the chat panel. When message recovery is enabled (off by default), restore messages for up to 30 days, restore them in bulk, or permanently delete them. Game Mode messages can’t be recovered.
    • Choose whether private notes are included in exports; they’re excluded from exports and model prompts by default.
    • See message marks in conversation and roleplay chats, including across message swipes.
  • Bug Fixes
    • Message limits preserve pinned messages, and pin limits are enforced when marking or restoring.
    • Improved keyboard focus and notifications when managing bookmarks and deleted messages, including notices about partial restores and conflicts. Partial restores can be retried, including when restoring more than 5,000 messages.

Maintainer verification

The latest fix, 9b9d929ba, keeps message marks atomic across all swipes by reusing the existing writer. Inactive-swipe pinning immediately counts toward the chat limit, and a concurrent swipe switch cannot restore stale marks. Swipe-specific fields remain scoped to their target. Mixed mark/scan updates still schedule stored-scan compaction, only after the transaction succeeds.

At this commit, pnpm check and all four focused regressions pass: message-trash, message-marks, lorebook-scan-compaction, and advanced-memory-history-start. The retained proofs cover inactive pin limits, mark clearing, mixed fields, concurrent swipe selection, private-note isolation, recovery behavior and mixed PATCH compaction. The independent race reproduction previously allowed 11 pins; the fix preserves marks, rejects the extra pin with HTTP 409 and keeps the count at 10. Independent source review found no substantive issue. Local CodeRabbit completed with zero findings across the five-file delta.

Earlier fixes preserve retryable restoration failures, results from completed batches (including conflicts-only batches), Game snapshot safeguards, queue ordering and partial-restore memory reconciliation. The existing UI shows the later error as a warning and keeps unresolved entries retryable. All six batching cases were verified across focused desktop Chromium, mobile Chromium and mobile WebKit runs; shell smoke passed 7/7. The UI is unchanged by this final backend fix. Markdown/HTML private-note exclusion is covered with export opt-in both off and on.

Current-head hosted CodeRabbit and required GitHub checks remain merge gates. Human checklist states are preserved.

Local build and container verification

Tested commit: 2bb529a97e. Full local pnpm check passed. The full Docker image built successfully and ran with synthetic data; HTTP readiness and embedded build commit were verified. These results do not claim completion of the remaining manual and UI edge-case checklist.

Agent-operated production-container browser verification at the tested commit completed the delete-to-trash and restore workflow using synthetic messages. Restored content, bookmark, pin and note indicator returned; the trash became empty. This is browser interaction, not physical-device testing. Broader theme, empty-state and error-path verification remains pending.

Additional evidence for tested revision 2bb529a97e

Every named focused browser case has a passing result across runs, but this was not one clean 12/12 suite. The original matrix passed 10/12; an intermediate desktop retry passed 1/2. Both desktop large-batch cases subsequently passed individually with unchanged source, assertions and timeouts and tracing disabled. Desktop timing remains flaky. Light-desktop and dark-narrow supplements passed 2/2 for the marks dialog. This evidence applies to the stated tested revision, not automatically to later merged changes. General edge-case and overall completion boxes remain unchecked.

Merged-revision backend verification

At 9b9d929bae, the message-trash regression (including mark/swipe atomicity) and lorebook-scan-compaction regression each passed. Full local pnpm check passed. The full Docker image rebuilt and ran successfully, with HTTP readiness and its embedded commit verified. This updates the local-check and container evidence to the merged revision; prior browser results remain scoped to 2bb529a97 and retain the documented timing limitations. Overall manual and edge-case completion remain unchecked.

Current-revision interactive follow-up at 9b9d929bae: after refreshing the production client, synthetic message bookmark, pin and note state remained present. Editing a note, saving, reloading and reopening it preserved the exact updated text. This agent-operated UI walkthrough supports the interactive row on the merged revision alongside the local-check and Docker evidence above. No provider request was made. Broad edge-case and overall verification remain unchecked.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/6780 **Author:** [@SirAdoni](https://github.com/SirAdoni) **Created:** 9/27/2026 **Status:** ✅ Merged **Merged:** 9/28/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `contrib/6698-message-tools` --- ### 📝 Commits (10+) - [`e452399`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e452399fa76384d30fd60fadc41154afae0ed645) feat: add message bookmarks notes pins and optional recovery - [`cd83b17`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cd83b17ac4ed18cb78e78b0d45c434aed482c209) Merge staging and preserve message trash on downgrade - [`5a4acfc`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5a4acfce3ac0e5033dab3f299b41651a276ed15a) fix: align message recovery results and enforce restored pin limits - [`31b65c3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/31b65c3e1c88d1f7a9d82bf24b1e7939217744c4) Merge staging inventory update into message tools - [`517e4a7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/517e4a78289737fac42f0db889731d260b826318) fix: clean expired message recovery records safely - [`822363c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/822363c8ff7d961f147a117de969295699f0cf5c) Merge staging ruleset inventory update into message tools - [`ba08173`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ba081736342522baebed3d6dc95898f4a51542fb) style: format message trash maintenance setup - [`c08a4ba`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c08a4baa3480566b7d8b59ce3daf46d8c0f69f4d) fix: preserve message recovery and context edit consistency - [`8efebee`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8efebee63d3914dde9aac79bd58cb8c291f1ade9) fix: keep hidden bookmarks and Mari retries out of message lists - [`5758252`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5758252addd0b0b8a3ab4ab45e2cfd00964568b8) fix: avoid nested context-start metadata queue deadlock ### 📊 Changes **38 files changed** (+3229 additions, -150 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+23 -1) ➕ `e2e/message-marks-trash.e2e.ts` (+216 -0) ➕ `e2e/message-trash-batching.e2e.ts` (+183 -0) 📝 `packages/client/src/components/chat/ChatInput.tsx` (+1 -1) 📝 `packages/client/src/components/chat/ChatMessage.tsx` (+7 -0) ➕ `packages/client/src/components/chat/ChatMessageMarksPanels.tsx` (+255 -0) 📝 `packages/client/src/components/chat/ChatMessageSearch.tsx` (+76 -31) 📝 `packages/client/src/components/chat/ConversationInput.tsx` (+1 -1) 📝 `packages/client/src/components/chat/ConversationMessage.tsx` (+2 -0) 📝 `packages/client/src/components/chat/ConversationMessageActions.tsx` (+3 -1) 📝 `packages/client/src/components/chat/ConversationMessageGrouped.tsx` (+2 -0) 📝 `packages/client/src/components/chat/HomeProfessorMariChat.tsx` (+2 -2) 📝 `packages/client/src/components/chat/MessageActionButton.tsx` (+65 -1) ➕ `packages/client/src/components/chat/MessageMarks.tsx` (+287 -0) 📝 `packages/client/src/components/panels/SettingsPanel.tsx` (+17 -0) 📝 `packages/client/src/components/panels/settings/FeatureSwitchesSettings.tsx` (+1 -0) 📝 `packages/client/src/hooks/use-chats.ts` (+100 -6) 📝 `packages/client/src/localization/locales/en.json` (+52 -0) 📝 `packages/client/src/stores/ui.store.ts` (+8 -0) 📝 `packages/server/src/app.ts` (+12 -0) _...and 18 more files_ </details> ### 📄 Description ## Linked issue Closes #6808. Partial implementation of #6698; the umbrella issue remains open. ## Why this change Users need persistent bookmarks, private notes and optional message recovery without losing queued edits or blocking chat metadata changes. ## What changed - Reuse existing chat menus and storage for bookmarks, private notes, context pins and default-off message retention/recovery. - Fix metadata queue re-entry, queued-edit snapshots, stale restore, partial restore cleanup and feedback. Keep Game restoration blocked and existing recovery available when retention is disabled. - Keep deletion permanent for turns with saved Game state even after a chat mode change; mixed selections report only messages actually retained for recovery. - Keep marks visible outside hover actions, make note saving usable in short/panned mobile viewports, and exclude private notes from prompts and default exports. ## Validation - [x] `pnpm check` passes locally - [x] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` pnpm check; prompt and focused storage/route regressions; six conversation/roleplay desktop/mobile Chromium/WebKit browser cases; seven shell smoke cases passed. Strengthened contributor history-start and feature-settings regressions also passed. The combined six-feature browser run passed 28 applicable cases with two intentional mobile skips; the final combined trash regression also passed. Local CodeRabbit completed: two valid findings fixed; three suggestions rejected with code-based reasons recorded in review discussion. Latest hosted findings are fixed and published in d035de970, including the outside-diff saved Game-state recovery boundary. Full pnpm check passed on that exact revision. Current-head review and checks remain merge gates. ### Manual verification Manually verify marks and note saving with the real mobile keyboard, pin/history limits, partial recovery, retention disabled and export privacy. Recovery restores messages and swipes; it does not undo other world-state effects. Automated browser evidence does not claim physical-device or manual container verification. Human checklist states are preserved. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened - [ ] Version/release files updated (only if this PR includes a version bump) Added an Unreleased changelog entry. No release metadata or user-facing docs changed. ## UI evidence [Browser evidence](https://gist.github.com/SpicyMarinara/99a342440faacfb244df998a8fe8a0e1) (download the HTML to view the embedded screenshots). Captions distinguish before/after captures from current feature screenshots. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Bookmark messages, add private notes, and pin important messages to keep them in prompt context. * View and manage bookmarks and deleted messages from the chat panel. When message recovery is enabled (off by default), restore messages for up to 30 days, restore them in bulk, or permanently delete them. Game Mode messages can’t be recovered. * Choose whether private notes are included in exports; they’re excluded from exports and model prompts by default. * See message marks in conversation and roleplay chats, including across message swipes. * **Bug Fixes** * Message limits preserve pinned messages, and pin limits are enforced when marking or restoring. * Improved keyboard focus and notifications when managing bookmarks and deleted messages, including notices about partial restores and conflicts. Partial restores can be retried, including when restoring more than 5,000 messages. <!-- end of auto-generated comment: release notes by coderabbit.ai --> <!-- maintainer-final-review --> ### Maintainer verification The latest fix, `9b9d929ba`, keeps message marks atomic across all swipes by reusing the existing writer. Inactive-swipe pinning immediately counts toward the chat limit, and a concurrent swipe switch cannot restore stale marks. Swipe-specific fields remain scoped to their target. Mixed mark/scan updates still schedule stored-scan compaction, only after the transaction succeeds. At this commit, `pnpm check` and all four focused regressions pass: message-trash, message-marks, lorebook-scan-compaction, and advanced-memory-history-start. The retained proofs cover inactive pin limits, mark clearing, mixed fields, concurrent swipe selection, private-note isolation, recovery behavior and mixed PATCH compaction. The independent race reproduction previously allowed 11 pins; the fix preserves marks, rejects the extra pin with HTTP 409 and keeps the count at 10. Independent source review found no substantive issue. Local CodeRabbit completed with zero findings across the five-file delta. Earlier fixes preserve retryable restoration failures, results from completed batches (including conflicts-only batches), Game snapshot safeguards, queue ordering and partial-restore memory reconciliation. The existing UI shows the later error as a warning and keeps unresolved entries retryable. All six batching cases were verified across focused desktop Chromium, mobile Chromium and mobile WebKit runs; shell smoke passed 7/7. The UI is unchanged by this final backend fix. Markdown/HTML private-note exclusion is covered with export opt-in both off and on. Current-head hosted CodeRabbit and required GitHub checks remain merge gates. Human checklist states are preserved. <!-- /maintainer-final-review --> <!-- local-validation-20260928 --> ### Local build and container verification Tested commit: 2bb529a97ee67f9e36aebeaa3b14381e792ae391. Full local pnpm check passed. The full Docker image built successfully and ran with synthetic data; HTTP readiness and embedded build commit were verified. These results do not claim completion of the remaining manual and UI edge-case checklist. <!-- /local-validation-20260928 --> <!-- interactive-validation-20260928 --> Agent-operated production-container browser verification at the tested commit completed the delete-to-trash and restore workflow using synthetic messages. Restored content, bookmark, pin and note indicator returned; the trash became empty. This is browser interaction, not physical-device testing. Broader theme, empty-state and error-path verification remains pending. <!-- /interactive-validation-20260928 --> ### Additional evidence for tested revision 2bb529a97ee67f9e36aebeaa3b14381e792ae391 Every named focused browser case has a passing result across runs, but this was not one clean 12/12 suite. The original matrix passed 10/12; an intermediate desktop retry passed 1/2. Both desktop large-batch cases subsequently passed individually with unchanged source, assertions and timeouts and tracing disabled. Desktop timing remains flaky. Light-desktop and dark-narrow supplements passed 2/2 for the marks dialog. This evidence applies to the stated tested revision, not automatically to later merged changes. General edge-case and overall completion boxes remain unchecked. ### Merged-revision backend verification At 9b9d929bae96dfcb5e0fb7adb8cd6956e6e7a438, the message-trash regression (including mark/swipe atomicity) and lorebook-scan-compaction regression each passed. Full local pnpm check passed. The full Docker image rebuilt and ran successfully, with HTTP readiness and its embedded commit verified. This updates the local-check and container evidence to the merged revision; prior browser results remain scoped to 2bb529a97 and retain the documented timing limitations. Overall manual and edge-case completion remain unchecked. Current-revision interactive follow-up at 9b9d929bae96dfcb5e0fb7adb8cd6956e6e7a438: after refreshing the production client, synthetic message bookmark, pin and note state remained present. Editing a note, saving, reloading and reopening it preserved the exact updated text. This agent-operated UI walkthrough supports the interactive row on the merged revision alongside the local-check and Docker evidence above. No provider request was made. Broad edge-case and overall verification remain unchecked. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:18:42 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#7329
No description provided.