[PR #6295] [MERGED] fix: address schedule limits, embeddings, lore and storage #7126

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

📋 Pull Request Information

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

Base: staging ← Head: fix/6291-6294-issue-sweep


📝 Commits (10+)

  • 69f4746 fix(lorebook): cascade agent lore when the message it came from is deleted
  • fd96ed6 Merge branch 'staging' into fix/lorebook-deleted-message-cascade
  • 8e72670 chore: start second issue sweep
  • 409a323 fix: preserve custom limits and scope database validation
  • 2dde0f6 fix(lorebook): cascade agent lore when the message it came from is deleted
  • cc93a12 fix(lorebook): address CodeRabbit review findings on the cascade
  • 2909fff fix(lorebook): bind tool writes to saved responses and preserve undo
  • 1a34a65 Merge contributor provenance review fixes without losing staging changes
  • e206b4d fix: reject invalid daily limits before saving or exporting
  • 970f2a2 Merge lorebook provenance and package tools for integration review

📊 Changes

33 files changed (+1837 additions, -142 deletions)

View changed files

📝 CHANGELOG.md (+10 -0)
📝 e2e/core-flows.e2e.ts (+28 -0)
📝 packages/client/src/components/chat/CharacterScheduleEditorModal.tsx (+19 -11)
📝 packages/client/src/components/chat/HomeCreditsModal.tsx (+21 -17)
📝 packages/client/src/lib/character-schedule-transfer.ts (+1 -1)
📝 packages/client/src/localization/locales/en.json (+2 -1)
📝 packages/server/src/db/file-backed-store.ts (+8 -1)
📝 packages/server/src/db/schema/lorebooks.ts (+12 -0)
📝 packages/server/src/routes/backup.routes.ts (+7 -1)
📝 packages/server/src/routes/chats.routes.ts (+16 -0)
📝 packages/server/src/routes/generate.routes.ts (+43 -4)
📝 packages/server/src/routes/generate/agent-write-approval.ts (+19 -1)
📝 packages/server/src/routes/generate/lorebook-keeper-utils.ts (+30 -0)
📝 packages/server/src/routes/generate/retry-agents-route.ts (+44 -1)
📝 packages/server/src/routes/lorebooks.routes.ts (+16 -3)
📝 packages/server/src/services/conversation/autonomous.service.ts (+3 -4)
📝 packages/server/src/services/generation/tool-resolution-runtime.ts (+73 -3)
📝 packages/server/src/services/lorebook/index.ts (+40 -0)
📝 packages/server/src/services/mari-db/mari-db.service.ts (+69 -58)
📝 packages/server/src/services/sidecar/sidecar-launch-plan.ts (+10 -1)

...and 13 more files

📄 Description

Linked issue

Closes #6298: the final CI run exposed an admitted storage flush racing with shutdown.

Closes #6291, #6293 and #6294. Owner: @SpicyMarinara; implementation by Codex.

Merged into staging through #6295 at 594e9b631, preserving the exact #6289 commits and contributor history. Both PRs passed their required checks and completed GitHub CodeRabbit reviews before merge; the outside contribution had current owner approval. Package tools from #6290 were merged first.

Why this change

Character schedules silently capped custom daily limits at eight, and local embedding batches above 2,048 were clamped by llama.cpp's unchanged logical batch. Small Professor Mari edits also validated the entire database repeatedly, permanently loading unrelated lazy tables and reporting plain-text agent memory as invalid JSON.

What changed

  • Let flushes admitted before shutdown join the existing close drain, while retaining rejection of new writes after close. The shutdown drain preserves admitted write errors even when its retry succeeds.

  • Include #6289’s message/swipe provenance so discarded turns stop contributing agent lore, with undo, human-edit protection and safe bulk cleanup. Repeated keeper writes retain the original snapshot; legacy profile imports clear foreign message references.

  • Reuse the schedule editor's numeric-input pattern; blank means Default and invalid fractions/zero receive an explicit validation message. Preserve custom caps through imports and scheduling while retaining the chat-wide cap.

  • Set both llama.cpp batch sizes, retaining the existing logical default for smaller physical batches.

  • Validate changed rows and their references before/after edits and undo. Explicit full validation remains available and still reports old broken references. Preserve both text and JSON agent memory without deleting user data.

Validation

Final combined commit d39ca9aad passed pnpm check and 290/290 Node regressions. The behavioral follow-ups passed local CodeRabbit with zero findings. Version and generated contributor-credit checks pass; the launcher format guard verifies both storage-format markers agree.

Real-store regressions cover atomic message/lore deletion, partial bulk failure, metadata queue ordering, repeated keeper/tool writes, scoped deletion, human edits, stale vectors, legacy profile imports, repeated query keys and shutdown retries. The added failures were reproduced before their fixes. Bulk cleanup deliberately performs one lore scan per nonempty 500-message chunk to preserve atomicity without a new index.

The schedule flow passes desktop Chromium, mobile Chromium and mobile WebKit, including custom limits, invalid input, import/export, reload and blank Default. All eight Mari suites pass; a small edit no longer loads 19 unrelated lazy tables, while invalid JSON and dangling references remain rejected. Earlier optional browser CI failures were investigated, passed focused local checks, and passed the affected CI jobs on rerun.

  • 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

Manual verification notes

Manually verify the schedule control in a live chat and local AMD HIP embedding with the reported Gemma model. The automated browser flow covers custom limits, export/import, save/reload and blank Default. Original reporter hardware and database are unavailable.

Docs and release impact

User-facing changes are recorded in CHANGELOG. Storage format 7 protects provenance from older builds that discard unknown columns; app version remains unchanged. Generated contributor credits are refreshed. Package API documentation was merged in #6290; all ten translated packs are in #6297.

  • 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)

UI evidence (if applicable)

Before/after screenshots: desktop Chromium, mobile Chromium and mobile WebKit, light and dark themes. Download the self-contained HTML gallery to view all twelve original PNG captures. The combined branch passes the schedule browser flow, including invalid input, import/export, save/reload and Default.

Post-merge verification: the fresh staging Node run at 594e9b631 passed all 290 regressions, including normal shutdown-test process exit (CI result). An earlier optional combined-PR job completed every shutdown assertion but its process timed out on exit; the other Linux PR run and final combined local run also passed. No assertion or timeout was weakened. The broader post-merge browser matrix is still running.


🔄 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/6295 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/17/2026 **Status:** ✅ Merged **Merged:** 9/17/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/6291-6294-issue-sweep` --- ### 📝 Commits (10+) - [`69f4746`](https://github.com/Pasta-Devs/Marinara-Engine/commit/69f47462a150c60f1b602f2dab157eacc3e766a7) fix(lorebook): cascade agent lore when the message it came from is deleted - [`fd96ed6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fd96ed69228570852b9b8950d4d4aaeb109f4558) Merge branch 'staging' into fix/lorebook-deleted-message-cascade - [`8e72670`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8e7267010476ce22bd8cf20a873d9ce91f2fb2c3) chore: start second issue sweep - [`409a323`](https://github.com/Pasta-Devs/Marinara-Engine/commit/409a323c034e523d8f096fb50214ed34c406e658) fix: preserve custom limits and scope database validation - [`2dde0f6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2dde0f6c0e223a4f329d427e60e71b0a0ee320d8) fix(lorebook): cascade agent lore when the message it came from is deleted - [`cc93a12`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cc93a12e49dd248f8ee7a851791de21e5ef0a4d0) fix(lorebook): address CodeRabbit review findings on the cascade - [`2909fff`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2909fff40f5950e0b1fcc249ac4bd34b7b961e2c) fix(lorebook): bind tool writes to saved responses and preserve undo - [`1a34a65`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1a34a65f141567c25267de0d75515d2e22700d14) Merge contributor provenance review fixes without losing staging changes - [`e206b4d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e206b4deb01306513f0a2874d2ca59f0921abff7) fix: reject invalid daily limits before saving or exporting - [`970f2a2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/970f2a25bc91f1034d214269dddffc67b7d74c51) Merge lorebook provenance and package tools for integration review ### 📊 Changes **33 files changed** (+1837 additions, -142 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+10 -0) 📝 `e2e/core-flows.e2e.ts` (+28 -0) 📝 `packages/client/src/components/chat/CharacterScheduleEditorModal.tsx` (+19 -11) 📝 `packages/client/src/components/chat/HomeCreditsModal.tsx` (+21 -17) 📝 `packages/client/src/lib/character-schedule-transfer.ts` (+1 -1) 📝 `packages/client/src/localization/locales/en.json` (+2 -1) 📝 `packages/server/src/db/file-backed-store.ts` (+8 -1) 📝 `packages/server/src/db/schema/lorebooks.ts` (+12 -0) 📝 `packages/server/src/routes/backup.routes.ts` (+7 -1) 📝 `packages/server/src/routes/chats.routes.ts` (+16 -0) 📝 `packages/server/src/routes/generate.routes.ts` (+43 -4) 📝 `packages/server/src/routes/generate/agent-write-approval.ts` (+19 -1) 📝 `packages/server/src/routes/generate/lorebook-keeper-utils.ts` (+30 -0) 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+44 -1) 📝 `packages/server/src/routes/lorebooks.routes.ts` (+16 -3) 📝 `packages/server/src/services/conversation/autonomous.service.ts` (+3 -4) 📝 `packages/server/src/services/generation/tool-resolution-runtime.ts` (+73 -3) 📝 `packages/server/src/services/lorebook/index.ts` (+40 -0) 📝 `packages/server/src/services/mari-db/mari-db.service.ts` (+69 -58) 📝 `packages/server/src/services/sidecar/sidecar-launch-plan.ts` (+10 -1) _...and 13 more files_ </details> ### 📄 Description ## Linked issue Closes #6298: the final CI run exposed an admitted storage flush racing with shutdown. Closes #6291, #6293 and #6294. Owner: @SpicyMarinara; implementation by Codex. Merged into `staging` through #6295 at `594e9b631`, preserving the exact #6289 commits and contributor history. Both PRs passed their required checks and completed GitHub CodeRabbit reviews before merge; the outside contribution had current owner approval. Package tools from #6290 were merged first. ## Why this change Character schedules silently capped custom daily limits at eight, and local embedding batches above 2,048 were clamped by llama.cpp's unchanged logical batch. Small Professor Mari edits also validated the entire database repeatedly, permanently loading unrelated lazy tables and reporting plain-text agent memory as invalid JSON. ## What changed - Let flushes admitted before shutdown join the existing close drain, while retaining rejection of new writes after close. The shutdown drain preserves admitted write errors even when its retry succeeds. - Include #6289’s message/swipe provenance so discarded turns stop contributing agent lore, with undo, human-edit protection and safe bulk cleanup. Repeated keeper writes retain the original snapshot; legacy profile imports clear foreign message references. - Reuse the schedule editor's numeric-input pattern; blank means Default and invalid fractions/zero receive an explicit validation message. Preserve custom caps through imports and scheduling while retaining the chat-wide cap. - Set both llama.cpp batch sizes, retaining the existing logical default for smaller physical batches. - Validate changed rows and their references before/after edits and undo. Explicit full validation remains available and still reports old broken references. Preserve both text and JSON agent memory without deleting user data. ## Validation Final combined commit `d39ca9aad` passed `pnpm check` and **290/290 Node regressions**. The behavioral follow-ups passed local CodeRabbit with zero findings. Version and generated contributor-credit checks pass; the launcher format guard verifies both storage-format markers agree. Real-store regressions cover atomic message/lore deletion, partial bulk failure, metadata queue ordering, repeated keeper/tool writes, scoped deletion, human edits, stale vectors, legacy profile imports, repeated query keys and shutdown retries. The added failures were reproduced before their fixes. Bulk cleanup deliberately performs one lore scan per nonempty 500-message chunk to preserve atomicity without a new index. The schedule flow passes desktop Chromium, mobile Chromium and mobile WebKit, including custom limits, invalid input, import/export, reload and blank Default. All eight Mari suites pass; a small edit no longer loads 19 unrelated lazy tables, while invalid JSON and dangling references remain rejected. Earlier optional browser CI failures were investigated, passed focused local checks, and passed the affected CI jobs on rerun. - [ ] `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` ### Manual verification notes Manually verify the schedule control in a live chat and local AMD HIP embedding with the reported Gemma model. The automated browser flow covers custom limits, export/import, save/reload and blank Default. Original reporter hardware and database are unavailable. ## Docs and release impact User-facing changes are recorded in CHANGELOG. Storage format 7 protects provenance from older builds that discard unknown columns; app version remains unchanged. Generated contributor credits are refreshed. Package API documentation was merged in #6290; all ten translated packs are in #6297. - [ ] 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) ## UI evidence (if applicable) [Before/after screenshots: desktop Chromium, mobile Chromium and mobile WebKit, light and dark themes](https://gist.github.com/SpicyMarinara/8610145550d7032aab8f911c69d9b7af). Download the self-contained HTML gallery to view all twelve original PNG captures. The combined branch passes the schedule browser flow, including invalid input, import/export, save/reload and Default. Post-merge verification: the fresh staging Node run at `594e9b631` passed all 290 regressions, including normal shutdown-test process exit ([CI result](https://github.com/Pasta-Devs/Marinara-Engine/actions/runs/35275434262/job/105384798212)). An earlier optional combined-PR job completed every shutdown assertion but its process timed out on exit; the other Linux PR run and final combined local run also passed. No assertion or timeout was weakened. The broader post-merge browser matrix is still running. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:16:46 +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#7126
No description provided.