mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2326] [Issue]: Knowledge-retrieval multi-chunk consolidation can silently drop earlier chunks' facts when the model under-merges #1154
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#1154
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 @Romuromylus on GitHub (Jun 5, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2326
Originally assigned to: @Romuromylus on GitHub.
Summary
Severity: Low — Data-loss (transient context). Knowledge-retrieval multi-chunk consolidation returns only the last chunk's extraction when every chunk produced text, trusting the model to have merged the prior chunks via a soft prompt instruction. If the model under-merges (common with small/instruction-weak models), all facts from earlier chunks are silently dropped from the injected knowledge context. The partial-failure branch is actually safer than the full-success branch.
Expected behavior
Consolidation should not silently lose earlier chunks' facts. When all chunks produced extractions, either verify the final pass is a superset or fall back to joining/deduping all extractions (as the partial branch already does).
Actual behavior
src/engine/agents-runtime/knowledge/knowledge-retrieval.ts:135-162:When
chunks.length > 1ANDextractions.length === chunks.length, only the last extraction is returned, discardingextractions[0..n-2]. The prior extractions are fed to the model purely as a soft instruction via_previousExtractions(line 100, rendered inagent-executor.ts:1697-1708: "Consolidate them into a single, coherent summary..."); the system prompt never reinforces consolidation. Theextractions.length < chunks.lengthbranch (136-148) safely concatenates all partials "so we don't drop earlier results" — so a partial failure is strictly safer than full success.Steps to reproduce
sourceContextBudget(default 6000 tokens) so it splits into 2+ chunks.Impact area
Environment
b0e5561dLogs, screenshots, or video
Static source audit; cited to file:line above.
Regression notes
Found via static audit of the refactor branch; not verified against main. Depends on model misbehavior (not deterministic), only triggers for chunked sources, and the lost data is transient injected context regenerated next turn (no persisted corruption), hence low.
Additional context
Suggested fix: in the
===branch, don't blindly trust the model merged — guard with a superset/length heuristic and fall back to joining all extractions, or simplest, always join+dedupe all extractions like the<branch already does.Template check
Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:
@Romuromylus commented on GitHub (Jun 6, 2026):
Fixed by #2396, merged into
refactor.