mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[GH-ISSUE #1881] [Issue]: A quoted importance score drops every memory in a chat piece, and the piece still reports success #1803
Labels
No labels
agent: chess
agent: conversation-calls
agent: eightball
agent: haptic
agent: hierarchical-maps
agent: hierarchical-maps
agent: illustrator
agent: poker
agent: rock-paper-scissors
agent: tic-tac-toe
agent: uno
artifacts
bug
bugfix
build
catalog
ci
client
dependencies
docs
documentation
enhancement
feature
fixed-in-staging
in-pr
normal-scope
packages
pull-request
qol
regression
roadmap
scope-risk
server
soup
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Agents#1803
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 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1881
Originally assigned to: @Promansis on GitHub.
Summary
When the extraction model writes a memory's
salienceorconfidenceas quoted text ("0.5"instead of0.5),Long-Term Memory rejects that memory as malformed. If the model quotes it on every memory, as it tends to once it
starts, the whole piece of chat is lost. The piece still reports
succeededwith nothing kept, so the player neverlearns that part of the chat was skipped, and nothing offers a retry.
Affected package
long-term-memory(Long-Term Memory)Expected behavior
retryable "unusable output" error, instead of succeeding with nothing.
Actual behavior
ltmProviderEvidenceUnitSchema(server/src/services/long-term-memory/extraction/evidence-unit-extraction.ts:167)is built from
ltmEvidenceUnitSchema, whoseconfidenceandsaliencearez.number().finite().min(0).max(1)with no coercion(
shared/src/features/agents/long-term-memory/schema/notes.ts:193-194).normalizeEvidenceUnitResponse(:673)runs first but does not touch either score. So in
parseEvidenceUnitPayload(:1000-1080) each quoted candidatefails
safeParseand is dropped asinvalid_format.The caller (
:1587-1598) only fails a parse with zero kept memories when the answer was cut off(
incomplete && parsed.response.units.length === 0→ltm_model_output_truncated). A complete answer whosecandidates were all dropped falls through as a success.
Seen on 2026-10-29 in 1 of 124 extraction calls during a whole-chat measurement run: Sonnet wrote every unit's
salienceas a string, all 16 candidates were dropped, and the piece reportedsucceededwith 0 kept.Steps to reproduce
unit has
"salience": "0.5"(a string).evidence_unit_json_parseshowsunits: 0andparserRejectionsequal tototalCandidates, each dropped asinvalid_format.Environment
Logs, screenshots, or video
The model's response is kept privately; the cause is in the code paths above. No chat text is needed to reproduce it.
Additional context
Minimal fix (server only, no schema or settings change)
evidence-unit-extraction.ts, extendltmProviderEvidenceUnitSchema(
:167) soconfidenceandsaliencepass through az.preprocessthat turns a trimmed string which parsesas a finite number into that number, then applies the existing
ltmEvidenceUnitSchema.shape.confidence/.saliencecheck. Anything else is left as is and still fails. Don't usez.coerce.number(): it turns""and
nullinto0. The stored-unit schema innotes.tsstays strict.(
:1593), throw the existing retryable error whenparsed.totalCandidates > 0 && parsed.response.units.length === 0:new LtmServiceError("unusable_output: every extraction candidate was malformed; the source remains retryable", 400, "ltm_model_output_unusable"). It runs inside the existingtry, so the error is logged as anevidence_unit_json_parseerror event and rethrown along the same path as the current "no response object"error. An answer with no candidates (
units: []) still succeeds: that piece really had nothing to keep.packages/long-term-memory/CHANGELOG.md: one line under## Unreleased. Patch; the version is set at land.Proof
Extend
tests/long-term-memory-extraction-reliability.regression.ts:parseEvidenceUnitPayloadwith"salience": "0.5"and"confidence": " 0.8 "keeps the unit with numbers0.5and
0.8."salience": "high",""and"1.5"are still dropped asinvalid_format.ltm_model_output_unusablewithout a repair call; a complete{"summary":"…","units":[]}still succeeds; onevalid plus one malformed unit keeps the valid one and does not throw.
Run that suite,
tests/long-term-memory-extraction-graph.regression.ts,test-fast.shandnpm run check.Non-goals
notes.ts, the stored-unit schema or the JSON schema sent to the model (:479-480).Tracker: OT-26.
Template check