mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #7429] [Issue]: Capability embeddings host drops the query/document input type #4139
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#4139
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Promansis on GitHub (Oct 11, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7429
Originally assigned to: @SpicyMarinara on GitHub.
Summary
The configured capability embeddings host calls
source.embed(texts, signal)without an input type. As a result, every text a package embeds is formatted as a document, including search queries. Long-Term Memory's recall queries never get the query prefix that E5, nomic-embed-text and Snowflake Arctic Embed v2 models expect. Chat memory recall inside the Engine already passes the input type; only the package path loses it.Expected behavior
A package can say whether the texts are search queries or documents. The host passes that on to
resolveMemoryRecallEmbeddingSource(...).embed(texts, signal, inputType), soformatMemoryRecallEmbeddingTextsapplies the right prefix.Actual behavior
CapabilityEmbeddingHost.embed(texts, signal?)has no input-type parameter (capability-runtime.ts L368).The configured host calls
source.embed(texts, signal)(capability-embedding.service.ts L36-L40),`` so the source'sinputTypefalls back to"document".resolveMemoryRecallEmbeddingInputProfile```` then gives package queries the document prefix:query:passage:search_query:search_document:query:Models on the plain profile have empty prefixes for both, so they are not affected. That includes the built-in MiniLM, bge-m3, OpenAI and Gemini embedding models.
The effect is weaker semantic recall for packages that use these models, in any language. Nothing crashes and nothing is logged.
Steps to reproduce
intfloat/multilingual-e5-large, ornomic-embed-texton Ollama. LTM uses the default connection, or the one set with Connections → apply to all agents.passage:(search_document:for nomic).Environment
stagingatecd62a2e4678d82fae753dd19f0f15cfbe48bba0)Logs, screenshots, or video
No logs, because the wrong prefix fails silently. Code path:
CapabilityEmbeddingHost.embed→createConfiguredCapabilityEmbeddingHost→source.embed(texts, signal)→formatMemoryRecallEmbeddingTexts(texts, model, "document").Additional context
Minimal fix
Add an optional third positional parameter and forward it. Nothing else changes.
AbortSignal.any([signal, timeoutSignal])(base-provider.ts L741). A package passing{ signal, inputType }would throw there. Older Engines ignore an extra positional argument, so packages can pass it without a version gate.spaceIdchange and no reindex. Stored vectors were embedded as documents, and documents stay documents.docs/development/optional-agent-packages.mdtoembed(texts, signal?, inputType?), where"query"is for search text and the default is"document". Whether this gets its own capability API minor is the maintainers' call; packages don't need to declare it."query"should producequery:and the default should producepassage:.Related
"query"for recall.snowflake-arctic-embed2, and it treatsmultilingual-e5-large-instructas plain e5. That model wantsInstruct: …\nQuery:on queries and no document prefix. Fixing either changesspaceIdfor every Engine memory feature, and lorebooks then need a manual re-vectorize, so it should be handled separately from this fix.Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:
@SpicyMarinara commented on GitHub (Oct 11, 2026):
Working on this in branch fix/capability-embed-input-type (Claude Code agent for @SpicyMarinara).
@SpicyMarinara commented on GitHub (Oct 11, 2026):
Fixed on staging by #7432. The capability embeddings host now forwards an optional third argument,
embed(texts, signal?, inputType?)(capability API 1.68), so package queries get the query prefix that e5, nomic-embed-text and Snowflake Arctic Embed v2 expect. The package side is Pasta-Devs/Marinara-Agents#1302. Thanks for the precise report, @Promansis!