mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2642] [Issue]: PDF extraction-failure sentinel is cached permanently, poisoning the knowledge source for the process lifetime #1302
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#1302
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 19, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2642
Originally assigned to: @Romuromylus on GitHub.
Summary
Severity: Low — correctness (regression).
extractFileTextcaches its result keyed on(size, uploadedAt)unconditionally, including the failure sentinel string"[PDF text extraction failed]"written in the PDF catch block. A transient pdf-parse failure is therefore cached for the rest of the process lifetime and injected as knowledge material on every subsequent turn, with no retry short of delete-and-reupload.Expected behavior
A transient PDF extraction failure (worker spawn failure under memory pressure, a momentary file lock, an OOM in
pdf-parseduring a busy turn) should be retried on the next turn — only successful extractions should be cached.Actual behavior
packages/server/src/routes/knowledge-sources.routes.ts:159–187:The
setCachedTextcall runs unconditionally, so the failure sentinel is cached. The cache invalidates only on delete (line 255) or re-upload (which mints a new nanoid).generate.routes.ts:4412callsextractFileTextevery knowledge-retrieval turn, and the only downstream gate istext.trim()(4413) — the non-empty sentinel passes — so## File: <name>\n[PDF text extraction failed]is injected as knowledge material on every later turn until the process restarts or the file is re-uploaded.Steps to reproduce
pdf-parsefailure on the first turn that reads it (e.g. resource pressure / momentary lock).[PDF text extraction failed]is cached and re-injected on every subsequent turn, even after the transient condition clears.Environment
staging @ 3dc062e2Logs, screenshots, or video
Static source audit, cited to file:line above.
Additional context
Fix sketch: do not cache the failure sentinel — skip
setCachedTextwhen PDF extraction throws (cache only on success), or store a short-lived negative entry so the next turn re-attempts the parse.Regression notes: Regression vs
main— worked on the release build, broken/missing onstaging. Onmain,extractFileText(filePath)has no cache and re-parses every call (packages/server/src/routes/knowledge-sources.routes.ts:78–106), so a transient failure self-heals on the next turn. The cache was added onstaging(the per-turn re-parse fix for #2617) and introduced this poisoning. Last-known-good:mainknowledge-sources.routes.ts:78–106.Template check