[PR #7148] [MERGED] fix(ltm): refresh LTM after effective embedding-connection changes (#7042) #7501

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7148
Author: @Promansis
Created: 10/6/2026
Status: ✅ Merged
Merged: 10/6/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix(ltm)/7042-embedding-refresh


📝 Commits (2)

  • 4a0d8a1 fix(ltm): refresh LTM after effective embedding-connection changes (#7042)
  • d8ed0c9 Merge remote-tracking branch 'upstream/staging' into fix(ltm)/7042-embedding-refresh

📊 Changes

7 files changed (+142 additions, -14 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 packages/client/src/lib/api-client.ts (+9 -0)
📝 packages/client/src/localization/locales/en.json (+5 -0)
📝 packages/server/src/routes/agents.routes.ts (+8 -1)
📝 packages/server/src/routes/connections.routes.ts (+20 -11)
📝 packages/server/src/services/generation/long-term-memory-runtime.ts (+61 -0)
📝 scripts/regressions/capability-package-lifecycle.regression.ts (+37 -2)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #7042

Why this change

Saving an effective embedding-connection configuration change did not notify the active Long-Term Memory (LTM) package or await its index refresh. The save finished before memory indexing was attempted, so rebuild latency and failures surfaced on a later recall instead of with the configuration change that caused them.

What changed

  • Added an optional refresh({ signal }) to the long-term-memory:runtime capability service contract. The package owns freshness checks, locking and rebuilding.
  • Added withLongTermMemoryEmbeddingChange in packages/server/src/services/generation/long-term-memory-runtime.ts. It snapshots the effective embedding configuration before saving, persists the change first, then awaits the optional package refresh only when the effective selection/identity changed. Save success stays independent of the refresh outcome.
  • Wrapped connection create, update, default-parameters and delete handlers, plus both LTM agent connection-selection PATCH paths.
  • The server reports the refresh outcome via X-Marinara-LTM-Refresh (refreshed, deferred, failed, timeout, unavailable). Existing response bodies and the DELETE 204 are preserved.
  • The connected client shows localized Sonner feedback for each refresh outcome.
  • Extended the existing capability lifecycle regression with a compact Engine host wiring check and added a [Unreleased] changelog entry.

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

Manual verification notes

  • Locally ran pnpm check on the merged HEAD (Impeccable guard, localization, Prettier, lint, e2e types, token-estimation types, production build) and node scripts/run-regressions.mjs --filter capability-package-lifecycle. Both passed.
  • Manually verify in the app: saving a connection that is the effective LTM embedding source shows the correct refresh toast, and the connection is still saved when refresh fails, is deferred, times out or is unavailable.
  • Manually verify in the app: editing an unrelated connection or a non-LTM agent does not show an LTM refresh notice.
  • Not yet verified: a real installed Long-Term Memory package that exports the new refresh operation. The current published package does not export it, so the Engine path is currently only proven against the synthetic host contract in the regression. Real indexing and next-recall freshness still need an Agents-side companion change.

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 (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

  • Feedback uses the existing Sonner toast surface; no screenshots were captured for this draft.

Summary by CodeRabbit

  • New Features
    • When a connection change affects Long-Term Memory, the configuration is saved independently of the embedding-index refresh result.
    • You’ll see a success or warning message indicating whether the refresh completed, was deferred, failed, timed out, or was unavailable.
    • Unrelated connection and agent changes do not trigger a refresh. Saves remain available when a package is older or inactive.

🔄 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/7148 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 10/6/2026 **Status:** ✅ Merged **Merged:** 10/6/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix(ltm)/7042-embedding-refresh` --- ### 📝 Commits (2) - [`4a0d8a1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4a0d8a10b5e6294d324bbfb265c52a26cf6d757b) fix(ltm): refresh LTM after effective embedding-connection changes (#7042) - [`d8ed0c9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d8ed0c954d8f0e11d2612929f1c21a784eac97b5) Merge remote-tracking branch 'upstream/staging' into fix(ltm)/7042-embedding-refresh ### 📊 Changes **7 files changed** (+142 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `packages/client/src/lib/api-client.ts` (+9 -0) 📝 `packages/client/src/localization/locales/en.json` (+5 -0) 📝 `packages/server/src/routes/agents.routes.ts` (+8 -1) 📝 `packages/server/src/routes/connections.routes.ts` (+20 -11) 📝 `packages/server/src/services/generation/long-term-memory-runtime.ts` (+61 -0) 📝 `scripts/regressions/capability-package-lifecycle.regression.ts` (+37 -2) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #7042 ## Why this change Saving an effective embedding-connection configuration change did not notify the active Long-Term Memory (LTM) package or await its index refresh. The save finished before memory indexing was attempted, so rebuild latency and failures surfaced on a later recall instead of with the configuration change that caused them. ## What changed - Added an optional `refresh({ signal })` to the `long-term-memory:runtime` capability service contract. The package owns freshness checks, locking and rebuilding. - Added `withLongTermMemoryEmbeddingChange` in `packages/server/src/services/generation/long-term-memory-runtime.ts`. It snapshots the effective embedding configuration before saving, persists the change first, then awaits the optional package refresh only when the effective selection/identity changed. Save success stays independent of the refresh outcome. - Wrapped connection create, update, default-parameters and delete handlers, plus both LTM agent connection-selection PATCH paths. - The server reports the refresh outcome via `X-Marinara-LTM-Refresh` (`refreshed`, `deferred`, `failed`, `timeout`, `unavailable`). Existing response bodies and the DELETE `204` are preserved. - The connected client shows localized Sonner feedback for each refresh outcome. - Extended the existing capability lifecycle regression with a compact Engine host wiring check and added a `[Unreleased]` changelog entry. ## 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` ### Manual verification notes - Locally ran `pnpm check` on the merged HEAD (Impeccable guard, localization, Prettier, lint, e2e types, token-estimation types, production build) and `node scripts/run-regressions.mjs --filter capability-package-lifecycle`. Both passed. - Manually verify in the app: saving a connection that is the effective LTM embedding source shows the correct refresh toast, and the connection is still saved when refresh fails, is deferred, times out or is unavailable. - Manually verify in the app: editing an unrelated connection or a non-LTM agent does not show an LTM refresh notice. - Not yet verified: a real installed Long-Term Memory package that exports the new `refresh` operation. The current published package does not export it, so the Engine path is currently only proven against the synthetic host contract in the regression. Real indexing and next-recall freshness still need an Agents-side companion change. ## 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 (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) - Feedback uses the existing Sonner toast surface; no screenshots were captured for this draft. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * When a connection change affects Long-Term Memory, the configuration is saved independently of the embedding-index refresh result. * You’ll see a success or warning message indicating whether the refresh completed, was deferred, failed, timed out, or was unavailable. * Unrelated connection and agent changes do not trigger a refresh. Saves remain available when a package is older or inactive. <!-- 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:20:26 +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#7501
No description provided.