[PR #1405] [CLOSED] Fix memory recall provider embeddings #5072

Closed
opened 2026-10-22 04:12:58 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1405
Author: @Promansis
Created: 5/27/2026
Status: ❌ Closed

Base: refactor ← Head: fix/issue-1363


📝 Commits (1)

  • e079749 Fix memory recall provider embeddings

📊 Changes

18 files changed (+672 additions, -60 deletions)

View changed files

📝 src-tauri/src/commands/storage/chats.rs (+283 -35)
📝 src-tauri/src/commands/storage/commands/chats.rs (+4 -4)
📝 src-tauri/src/commands/storage/commands/media.rs (+5 -0)
📝 src-tauri/src/commands/storage/llm.rs (+40 -0)
📝 src-tauri/src/commands/storage/prompts.rs (+102 -2)
📝 src-tauri/src/http_dispatch.rs (+12 -6)
📝 src-tauri/src/lib.rs (+1 -0)
📝 src/engine/capabilities/llm.ts (+8 -0)
📝 src/engine/contracts/types/chat.ts (+11 -1)
📝 src/engine/generation/agent-runner.test.ts (+6 -0)
📝 src/engine/generation/main-tool-loop.test.ts (+2 -0)
📝 src/engine/generation/prompt-assembly.test.ts (+90 -0)
📝 src/engine/generation/prompt-assembly.ts (+80 -3)
📝 src/engine/generation/start-generation.ts (+3 -0)
📝 src/engine/mari/mari-history.test.ts (+1 -0)
📝 src/features/modes/shared/chat-ui/components/ChatSettingsDrawer.tsx (+13 -9)
📝 src/shared/api/llm-api.ts (+10 -0)
📝 src/shared/api/remote-runtime.ts (+1 -0)

📄 Description

Linked issue

Closes #1363

Why this change

Memory Recall regressed during the refactor: chat memory refresh/import generated local lexical vectors only, while legacy staging could use configured provider or local-sidecar embeddings. Prompt assembly also queried memory recall with lexical vectors, so provider-vectorized memories could not be compared in the right vector space.

What changed

  • Restore provider-backed Memory Recall embeddings for chat memory refresh/import when an embedding model or embedding connection is configured.
  • Keep lexical vectors as the fallback when no embedding model is configured.
  • Store memory embedding metadata (embeddingSource, model, connection, provider, updated-at) so recall knows which vector space each memory uses.
  • Add an llm_embed runtime command through the shared API, embedded Tauri command list, and remote-runtime allowlist/dispatch path.
  • Update prompt assembly to query provider embeddings through LlmGateway, compare provider memories only against matching provider query vectors, and skip mismatched/unavailable provider vectors instead of mixing lexical and provider spaces.
  • Update Memory Recall UI copy/labels so provider vectors are visible.

Refactor impact

Primary owner:

Rust storage/provider transport, engine generation/prompt assembly, shared API runtime adapter, remote runtime dispatch, and shared chat settings UI.

Impact areas reviewed:

  • Chat Memory Recall refresh/import and generation recall.
  • Active roleplay-scene recall path through shared prompt assembly.
  • Game state and game memory paths were checked for accidental ownership bleed; no game orchestration changed.
  • Remote runtime command allowlist and Rust dispatch were checked for parity with embedded Tauri command registration.

Boundary notes:

  • Engine code receives embeddings through LlmGateway; it does not import Tauri, shared API adapters, React, or feature internals.
  • Feature UI continues to use existing chat hooks/shared API paths; no new raw remote-runtime fetch was added.
  • Provider credentials stay server-side when query embeddings are requested by connection id.

Pressure points touched:

  • src-tauri/src/lib.rs command registration.
  • src-tauri/src/http_dispatch.rs remote invoke dispatch.
  • src/shared/api/remote-runtime.ts allowlist.
  • src/features/modes/shared/chat-ui/components/ChatSettingsDrawer.tsx Memory Recall labels/copy.

Validation

  • pnpm check passes locally
  • pnpm typecheck passes locally
  • pnpm build passes locally
  • pnpm check:architecture passes locally
  • pnpm check:docs passes locally
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace passes locally
  • Rust clippy/tests were run for Rust behavior changes
  • Browser or Tauri app manual verification completed
  • Playwright, screenshot, or recording evidence added for UI changes
  • Remote runtime smoke checked when relevant

Manual verification notes

Agent-run validation on the rebased branch:

  • pnpm check
  • pnpm build
  • pnpm test -- src/engine/generation/prompt-assembly.test.ts src/engine/generation/agent-runner.test.ts src/engine/generation/main-tool-loop.test.ts
  • cargo test --manifest-path src-tauri/Cargo.toml refresh_chat_memories_uses_configured_provider_embeddings
  • cargo clippy --manifest-path src-tauri/Cargo.toml --workspace --all-targets -- -D warnings

No browser/Tauri manual verification or remote-runtime live smoke was performed.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

No docs were changed. This restores existing legacy behavior rather than adding a new documented feature.

UI evidence

No screenshots added. UI change is limited to Memory Recall text/labels showing provider vs lexical vector source.


🔄 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/1405 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 5/27/2026 **Status:** ❌ Closed **Base:** `refactor` ← **Head:** `fix/issue-1363` --- ### 📝 Commits (1) - [`e079749`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e079749c9f776af86b5b4a3da86eb213aeab5569) Fix memory recall provider embeddings ### 📊 Changes **18 files changed** (+672 additions, -60 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/chats.rs` (+283 -35) 📝 `src-tauri/src/commands/storage/commands/chats.rs` (+4 -4) 📝 `src-tauri/src/commands/storage/commands/media.rs` (+5 -0) 📝 `src-tauri/src/commands/storage/llm.rs` (+40 -0) 📝 `src-tauri/src/commands/storage/prompts.rs` (+102 -2) 📝 `src-tauri/src/http_dispatch.rs` (+12 -6) 📝 `src-tauri/src/lib.rs` (+1 -0) 📝 `src/engine/capabilities/llm.ts` (+8 -0) 📝 `src/engine/contracts/types/chat.ts` (+11 -1) 📝 `src/engine/generation/agent-runner.test.ts` (+6 -0) 📝 `src/engine/generation/main-tool-loop.test.ts` (+2 -0) 📝 `src/engine/generation/prompt-assembly.test.ts` (+90 -0) 📝 `src/engine/generation/prompt-assembly.ts` (+80 -3) 📝 `src/engine/generation/start-generation.ts` (+3 -0) 📝 `src/engine/mari/mari-history.test.ts` (+1 -0) 📝 `src/features/modes/shared/chat-ui/components/ChatSettingsDrawer.tsx` (+13 -9) 📝 `src/shared/api/llm-api.ts` (+10 -0) 📝 `src/shared/api/remote-runtime.ts` (+1 -0) </details> ### 📄 Description ## Linked issue Closes #1363 ## Why this change Memory Recall regressed during the refactor: chat memory refresh/import generated local lexical vectors only, while legacy staging could use configured provider or local-sidecar embeddings. Prompt assembly also queried memory recall with lexical vectors, so provider-vectorized memories could not be compared in the right vector space. ## What changed - Restore provider-backed Memory Recall embeddings for chat memory refresh/import when an embedding model or embedding connection is configured. - Keep lexical vectors as the fallback when no embedding model is configured. - Store memory embedding metadata (`embeddingSource`, model, connection, provider, updated-at) so recall knows which vector space each memory uses. - Add an `llm_embed` runtime command through the shared API, embedded Tauri command list, and remote-runtime allowlist/dispatch path. - Update prompt assembly to query provider embeddings through `LlmGateway`, compare provider memories only against matching provider query vectors, and skip mismatched/unavailable provider vectors instead of mixing lexical and provider spaces. - Update Memory Recall UI copy/labels so provider vectors are visible. ## Refactor impact Primary owner: Rust storage/provider transport, engine generation/prompt assembly, shared API runtime adapter, remote runtime dispatch, and shared chat settings UI. Impact areas reviewed: - Chat Memory Recall refresh/import and generation recall. - Active roleplay-scene recall path through shared prompt assembly. - Game state and game memory paths were checked for accidental ownership bleed; no game orchestration changed. - Remote runtime command allowlist and Rust dispatch were checked for parity with embedded Tauri command registration. Boundary notes: - Engine code receives embeddings through `LlmGateway`; it does not import Tauri, shared API adapters, React, or feature internals. - Feature UI continues to use existing chat hooks/shared API paths; no new raw remote-runtime fetch was added. - Provider credentials stay server-side when query embeddings are requested by connection id. Pressure points touched: - `src-tauri/src/lib.rs` command registration. - `src-tauri/src/http_dispatch.rs` remote invoke dispatch. - `src/shared/api/remote-runtime.ts` allowlist. - `src/features/modes/shared/chat-ui/components/ChatSettingsDrawer.tsx` Memory Recall labels/copy. ## Validation - [ ] `pnpm check` passes locally - [ ] `pnpm typecheck` passes locally - [ ] `pnpm build` passes locally - [ ] `pnpm check:architecture` passes locally - [ ] `pnpm check:docs` passes locally - [ ] `cargo check --manifest-path src-tauri/Cargo.toml --workspace` passes locally - [ ] Rust clippy/tests were run for Rust behavior changes - [ ] Browser or Tauri app manual verification completed - [ ] Playwright, screenshot, or recording evidence added for UI changes - [ ] Remote runtime smoke checked when relevant ### Manual verification notes Agent-run validation on the rebased branch: - `pnpm check` - `pnpm build` - `pnpm test -- src/engine/generation/prompt-assembly.test.ts src/engine/generation/agent-runner.test.ts src/engine/generation/main-tool-loop.test.ts` - `cargo test --manifest-path src-tauri/Cargo.toml refresh_chat_memories_uses_configured_provider_embeddings` - `cargo clippy --manifest-path src-tauri/Cargo.toml --workspace --all-targets -- -D warnings` No browser/Tauri manual verification or remote-runtime live smoke was performed. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [ ] Confirmed this PR does not restore old staging/package-workspace/release claims No docs were changed. This restores existing legacy behavior rather than adding a new documented feature. ## UI evidence No screenshots added. UI change is limited to Memory Recall text/labels showing provider vs lexical vector source. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:12:58 +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#5072
No description provided.