[PR #6475] [MERGED] fix: unblock Advanced Memory and reuse Chat Summaries #7194

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

📋 Pull Request Information

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

Base: staging ← Head: codex/sept21-memory-swipe-reuse


📝 Commits (3)

  • 3d6e548 chore: coordinate Advanced Memory swipe reuse
  • 874103f fix: unblock Advanced Memory and reuse ranged Chat Summaries
  • 558c7b5 fix: scope connection tests and skip fitting summary groups

📊 Changes

27 files changed (+1374 additions, -611 deletions)

View changed files

📝 CHANGELOG.md (+7 -0)
📝 docs/agents/memory.md (+13 -8)
📝 e2e/advanced-memory.e2e.ts (+32 -7)
📝 e2e/drag-list-scroll.e2e.ts (+8 -1)
📝 e2e/fal-image.e2e.ts (+78 -0)
➕ e2e/summary-controls.e2e.ts (+82 -0)
📝 packages/client/src/components/chat/AdvancedMemoryInspector.tsx (+10 -7)
📝 packages/client/src/components/chat/SummaryPopover.tsx (+15 -6)
📝 packages/client/src/components/connections/ConnectionEditor.tsx (+64 -21)
📝 packages/client/src/hooks/use-advanced-memory.ts (+9 -1)
📝 packages/client/src/hooks/use-chats.ts (+6 -4)
📝 packages/client/src/localization/locales/en.json (+6 -4)
📝 packages/server/src/routes/advanced-memory.routes.ts (+1 -1)
📝 packages/server/src/routes/chats.routes.ts (+12 -4)
📝 packages/server/src/routes/generate.routes.ts (+15 -1)
📝 packages/server/src/services/advanced-memory.ts (+443 -307)
📝 packages/server/src/services/chat-summary/connection-resolution.ts (+3 -2)
📝 packages/server/src/services/generation/advanced-memory-context.ts (+68 -2)
📝 packages/server/src/services/prompt/advanced-memory-prompt.ts (+2 -1)
📝 scripts/regressions/advanced-memory-context.regression.ts (+32 -0)

...and 7 more files

📄 Description

Linked issue

Closes #6474

Why this change

A ready Roleplay chat could start continuity processing before the main reply and stall at 0/1 work units. Regeneration also repeated recall, while generated constants bypassed existing ranged Chat Summaries. Activating one summary locked the whole list. This patch restores the existing summary workflow and keeps model-powered archive maintenance after the main generation.

What changed

  • Main generation reads prepared memory without starting or waiting for summary work. Compatible regenerations reuse the earliest saved swipe recall; source edits, visibility changes and manual summary/settings changes still invalidate unsafe reuse.
  • Post-generation maintenance reuses existing enabled and disabled summary ranges, adds only uncovered archived content to Chat Summaries, and combines only active archived constants when their own token total exceeds the constant-summary budget. Combining receives only those summaries and disables the replaced entries, retaining the originals.
  • Memory helper calls use the selected helper connection and Chat Summary's Maximum output size. Live/recalled messages do not count toward the constant-summary threshold. Whole-request context limits still apply; oversized ongoing history uses bounded source excerpts without a pre-generation model call or destructive edits.
  • Scene memories remain in Access memories for this chat. Legacy continuity/ongoing records are ignored as constants and have a confirmed Delete summary action at the bottom, alongside scene deletion. No archive reset or migration into duplicate active Chat Summaries is required.
  • Individual activation saves leave other summary rows usable. Activate/Deactivate All saves once; ordered cache updates replace redundant chat-list refetches.
  • Fix the staging browser failures: retain fal.ai connection-test results across save hydration and measure drag coordinates/scroll after the restarted drag is established.

Validation

Human verification tasks (intentionally left unchecked):

  • 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

Automated/local evidence:

  • pnpm check passed, including localization, formatting, TypeScript, E2E types and production build.
  • The complete 345-case Node regression suite passed on GitHub. All seven Advanced Memory suites passed locally; the post-generation suite passed again after the review guard that skips already-fitting audience groups.
  • All 30 affected browser cases are covered by passing local runs across desktop Chromium, mobile Chromium and mobile WebKit. Final reruns passed the expanded memory scenario and all six connection tests, including delayed results after a selection/configuration change and same-connection save hydration. The expanded memory scenario has a 150-second overall allowance for setup/resume, deletion retries and both-theme screenshots; individual action/assertion limits remain unchanged. The initial full Safari CI run exhausted its previous 90-second overall allowance during those screenshots and left duplicate fixtures for a later test; the trace confirmed the cause.
  • Built a runtime container from the existing production dependency image plus current shared/server/client build artifacts; /api/health and the SPA returned HTTP 200. This is not a fresh dependency-image build; GitHub's container checks cover that path.
  • Local CodeRabbit review and incremental review completed. Both GitHub findings are addressed: all five test result types belong to the selected connection and ignore stale callbacks, and already-fitting summary groups skip the helper. Manual configuration edits also invalidate pending test results without confusing save hydration with a selection change. Earlier local findings were fixed except historical swipe snapshot pruning, deliberately declined because pruning them with the last-two-prompt cache would break older-message recall reuse.

Manual verification notes

Browser automation exercised light/dark memory views, resumable preparation, scene/legacy continuity/ongoing deletion, cancellation and failed deletion retry, quiet main-generation activity, and summary controls with a held save request. Provider regressions use deterministic mocks; they verify streaming and request ordering, not live model quality or cost.

Manually verify the existing large chat on a physical iPhone app: generate and regenerate with ready memory, confirm no pre-reply Updating continuity, confirm original ranged summaries are reused, and confirm the saved archive remains usable without Reset memory. Also manually verify the selected real provider's output-size behavior and scene-summary quality.

Claim boundaries: no new database schema; source messages and replaced Chat Summary entries are preserved. Legacy records remain deletable. Source/access/settings validation, imported malformed snapshots, cancellation, reset races and changed visibility were covered by negative regression cases. Real provider calls and physical iPhone/PWA behavior remain manual verification items.

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)

Updated CHANGELOG.md, docs/agents/memory.md and canonical English UI copy. Translation follow-up: #6467. No version bump or installation/update behavior change.

UI evidence (if applicable)

Browser proof screenshots: mobile legacy continuity/ongoing Delete summary actions, confirmation, and usable summary controls during a pending save. These are synthetic test chats, not user conversation data. Static SVG wrappers contain unchanged screenshots; download/open as described in the gist. No before screenshots were captured.

Summary by CodeRabbit

  • New Features

    • Advanced Memory prepares replies without waiting for background summary work.
    • Existing Chat Summary entries are reused, with uncovered history consolidated after replies.
    • Regenerated replies reuse compatible memory and recalled scenes.
    • Saved scene memories, continuity records, and ongoing summaries can be deleted with confirmation.
    • Summary entries can be toggled individually while other entries remain usable; bulk changes save together.
  • Bug Fixes

    • Connection test results persist after saving or refreshing.
    • Improved mobile drag-and-scroll behavior.
    • Chat Summary output limits are applied consistently.
    • Background updates now refresh Chat Summaries automatically.

🔄 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/6475 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/20/2026 **Status:** ✅ Merged **Merged:** 9/21/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `codex/sept21-memory-swipe-reuse` --- ### 📝 Commits (3) - [`3d6e548`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3d6e548e14517429c24d25ddeb0dcea7d4a38822) chore: coordinate Advanced Memory swipe reuse - [`874103f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/874103f32eeeed0d901c43aedb1c75a3fcae723e) fix: unblock Advanced Memory and reuse ranged Chat Summaries - [`558c7b5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/558c7b596866b1c3b2a50a49de41d02a4b3da003) fix: scope connection tests and skip fitting summary groups ### 📊 Changes **27 files changed** (+1374 additions, -611 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+7 -0) 📝 `docs/agents/memory.md` (+13 -8) 📝 `e2e/advanced-memory.e2e.ts` (+32 -7) 📝 `e2e/drag-list-scroll.e2e.ts` (+8 -1) 📝 `e2e/fal-image.e2e.ts` (+78 -0) ➕ `e2e/summary-controls.e2e.ts` (+82 -0) 📝 `packages/client/src/components/chat/AdvancedMemoryInspector.tsx` (+10 -7) 📝 `packages/client/src/components/chat/SummaryPopover.tsx` (+15 -6) 📝 `packages/client/src/components/connections/ConnectionEditor.tsx` (+64 -21) 📝 `packages/client/src/hooks/use-advanced-memory.ts` (+9 -1) 📝 `packages/client/src/hooks/use-chats.ts` (+6 -4) 📝 `packages/client/src/localization/locales/en.json` (+6 -4) 📝 `packages/server/src/routes/advanced-memory.routes.ts` (+1 -1) 📝 `packages/server/src/routes/chats.routes.ts` (+12 -4) 📝 `packages/server/src/routes/generate.routes.ts` (+15 -1) 📝 `packages/server/src/services/advanced-memory.ts` (+443 -307) 📝 `packages/server/src/services/chat-summary/connection-resolution.ts` (+3 -2) 📝 `packages/server/src/services/generation/advanced-memory-context.ts` (+68 -2) 📝 `packages/server/src/services/prompt/advanced-memory-prompt.ts` (+2 -1) 📝 `scripts/regressions/advanced-memory-context.regression.ts` (+32 -0) _...and 7 more files_ </details> ### 📄 Description ## Linked issue Closes #6474 ## Why this change A ready Roleplay chat could start continuity processing before the main reply and stall at 0/1 work units. Regeneration also repeated recall, while generated constants bypassed existing ranged Chat Summaries. Activating one summary locked the whole list. This patch restores the existing summary workflow and keeps model-powered archive maintenance after the main generation. ## What changed - Main generation reads prepared memory without starting or waiting for summary work. Compatible regenerations reuse the earliest saved swipe recall; source edits, visibility changes and manual summary/settings changes still invalidate unsafe reuse. - Post-generation maintenance reuses existing enabled and disabled summary ranges, adds only uncovered archived content to Chat Summaries, and combines only active archived constants when their own token total exceeds the constant-summary budget. Combining receives only those summaries and disables the replaced entries, retaining the originals. - Memory helper calls use the selected helper connection and Chat Summary's Maximum output size. Live/recalled messages do not count toward the constant-summary threshold. Whole-request context limits still apply; oversized ongoing history uses bounded source excerpts without a pre-generation model call or destructive edits. - Scene memories remain in Access memories for this chat. Legacy continuity/ongoing records are ignored as constants and have a confirmed Delete summary action at the bottom, alongside scene deletion. No archive reset or migration into duplicate active Chat Summaries is required. - Individual activation saves leave other summary rows usable. Activate/Deactivate All saves once; ordered cache updates replace redundant chat-list refetches. - Fix the staging browser failures: retain fal.ai connection-test results across save hydration and measure drag coordinates/scroll after the restarted drag is established. ## Validation Human verification tasks (intentionally left unchecked): - [ ] `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` Automated/local evidence: - `pnpm check` passed, including localization, formatting, TypeScript, E2E types and production build. - The complete 345-case Node regression suite passed on GitHub. All seven Advanced Memory suites passed locally; the post-generation suite passed again after the review guard that skips already-fitting audience groups. - All 30 affected browser cases are covered by passing local runs across desktop Chromium, mobile Chromium and mobile WebKit. Final reruns passed the expanded memory scenario and all six connection tests, including delayed results after a selection/configuration change and same-connection save hydration. The expanded memory scenario has a 150-second overall allowance for setup/resume, deletion retries and both-theme screenshots; individual action/assertion limits remain unchanged. The initial full Safari CI run exhausted its previous 90-second overall allowance during those screenshots and left duplicate fixtures for a later test; the trace confirmed the cause. - Built a runtime container from the existing production dependency image plus current shared/server/client build artifacts; `/api/health` and the SPA returned HTTP 200. This is not a fresh dependency-image build; GitHub's container checks cover that path. - Local CodeRabbit review and incremental review completed. Both GitHub findings are addressed: all five test result types belong to the selected connection and ignore stale callbacks, and already-fitting summary groups skip the helper. Manual configuration edits also invalidate pending test results without confusing save hydration with a selection change. Earlier local findings were fixed except historical swipe snapshot pruning, deliberately declined because pruning them with the last-two-prompt cache would break older-message recall reuse. ### Manual verification notes Browser automation exercised light/dark memory views, resumable preparation, scene/legacy continuity/ongoing deletion, cancellation and failed deletion retry, quiet main-generation activity, and summary controls with a held save request. Provider regressions use deterministic mocks; they verify streaming and request ordering, not live model quality or cost. Manually verify the existing large chat on a physical iPhone app: generate and regenerate with ready memory, confirm no pre-reply Updating continuity, confirm original ranged summaries are reused, and confirm the saved archive remains usable without Reset memory. Also manually verify the selected real provider's output-size behavior and scene-summary quality. Claim boundaries: no new database schema; source messages and replaced Chat Summary entries are preserved. Legacy records remain deletable. Source/access/settings validation, imported malformed snapshots, cancellation, reset races and changed visibility were covered by negative regression cases. Real provider calls and physical iPhone/PWA behavior remain manual verification items. ## 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) Updated `CHANGELOG.md`, `docs/agents/memory.md` and canonical English UI copy. Translation follow-up: #6467. No version bump or installation/update behavior change. ## UI evidence (if applicable) [Browser proof screenshots](https://gist.github.com/SpicyMarinara/b798b72db44729c1e4eeb95aaed5ce77): mobile legacy continuity/ongoing Delete summary actions, confirmation, and usable summary controls during a pending save. These are synthetic test chats, not user conversation data. Static SVG wrappers contain unchanged screenshots; download/open as described in the gist. No before screenshots were captured. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Advanced Memory prepares replies without waiting for background summary work. - Existing Chat Summary entries are reused, with uncovered history consolidated after replies. - Regenerated replies reuse compatible memory and recalled scenes. - Saved scene memories, continuity records, and ongoing summaries can be deleted with confirmation. - Summary entries can be toggled individually while other entries remain usable; bulk changes save together. - **Bug Fixes** - Connection test results persist after saving or refreshing. - Improved mobile drag-and-scroll behavior. - Chat Summary output limits are applied consistently. - Background updates now refresh Chat Summaries automatically. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:17:24 +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#7194
No description provided.