[PR #1458] [MERGED] fix(long-term-memory): clear link-target drop messages, keep relationship summaries in recall, match restored retry set (1.4.52) #1473

Closed
opened 2026-10-21 05:11:51 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Agents/pull/1458
Author: @Promansis
Created: 10/18/2026
Status: ✅ Merged
Merged: 10/18/2026
Merged by: @Promansis

Base: staging ← Head: fix(long-term-memory)/1450-drop-messages-summary-retry


📝 Commits (2)

  • 33755ef fix(long-term-memory): clear link-target drop messages, keep relationship summaries in recall, match restored retry set (#1450)
  • 69eae5d chore(long-term-memory): release 1.4.52 (#1450)

📊 Changes

20 files changed (+232 additions, -135 deletions)

View changed files

➕ artifacts/long-term-memory-1.4.52.zip (+0 -0)
📝 catalog/catalog.json (+8 -8)
📝 catalog/notes.json (+6 -6)
📝 catalog/v2/catalog.json (+8 -8)
📝 catalog/v2/notes.json (+6 -6)
📝 catalog/v3/catalog.json (+8 -8)
📝 catalog/v3/notes.json (+6 -6)
📝 packages/long-term-memory/CHANGELOG.md (+6 -0)
📝 packages/long-term-memory/client.js (+24 -24)
📝 packages/long-term-memory/manifest.json (+5 -5)
📝 packages/long-term-memory/server.mjs (+37 -37)
📝 packages/long-term-memory/src/engine/packages/client/src/features/long-term-memory/source-task.ts (+13 -0)
📝 packages/long-term-memory/src/engine/packages/client/src/features/long-term-memory/sources/SourcesWorkspace.tsx (+4 -20)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/evidence-unit-validation.ts (+17 -4)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/prompt-text.ts (+2 -1)
📝 scripts/build-feature-packages.mjs (+1 -1)
📝 tests/long-term-memory-extraction-reliability.regression.ts (+39 -0)
📝 tests/long-term-memory-feedback-clarity-ui.regression.mjs (+5 -1)
📝 tests/long-term-memory-runtime.regression.ts (+17 -0)
📝 tests/long-term-memory-source-task.regression.ts (+20 -0)

📄 Description

Linked issue

Closes #1450

Why this change

The extractions audit found three small faults. These are tracker items EX-I6, EX-I7 and EX-I8, from audit F7, F8, F9 with probe H, and CLIENT-001.

  • Misleading drop message. Extraction drops a suggestion that links to a memory it could not find. The message then said the suggestion "used the wrong memory stream". unknown_link_target mapped to unsupported_bucket and took that reason's generic text.
  • The low-overlap warning was wrong in two ways. low_lexical_evidence compared the suggestion only against the first 500 tokens of the source, because tokenize caps there. A suggestion drawn from later in a long source was flagged. The warning also went straight into the result's diagnostics, so a suggestion that was then dropped still carried it.
  • Relationship summaries were lost in recall. For a relationship memory whose text starts with Summary:, formatLtmChunkPromptText put the scores line first. normalizeBulletLines keeps a text:/summary: line only when it comes first, so the summary sentence was dropped from the chat prompt.
  • Retry differed after a reload. After a reload, the restored import result added missingSourceIds to the Retry failed set. The live result never did. Retrying a missing id asks for the same id again and gets the same "not found".

What changed

 validateLtmEvidenceUnits                              # evidence-unit-validation.ts
+  sourceTokens = sourceTokenSet(sourceText)           # once, no 500-token cap
   for each unit
-    if lexicalOverlap(sourceText, unit.text) < 0.08 → diagnostics.push(warning)
+    if lexicalOverlap(sourceTokens, unit.text) < 0.08 → unitDiagnostics.push(warning)
 userFacingDropMessageForCode
+  unknown_link_target → "Dropped a candidate that linked to a memory this
+                         extraction could not find or did not keep."

 formatLtmChunkPromptText (relationship)               # prompt-text.ts
-  `${scoresLine}\n${text}`
+  `${scoresLine}\n${text without a leading text:/summary: label}`

+retryableSourceIds(result)                            # source-task.ts
+  retryable rows of imported (live) or items (restored), plus retryable writeFailures, de-duplicated
 SourcesWorkspace                                      # live list, post-import selection, restored list
-  three inline copies (the restored one also added missingSourceIds)
+  retryableSourceIds(…)
  • Lexical warning. sourceTokenSet uses the same regex and 4-character minimum as tokenize. Building the set inside the validator leaves shared utils.ts alone. The warning now goes through unitDiagnostics, so a suggestion dropped by the first validation pass no longer carries it. A suggestion kept by the first pass and dropped later still carries it, like every other per-unit warning.
  • The drop message does not name the target. The issue asked for the message to name the link target, or to fall through to the diagnostic's own message, which does name it. Either would break #722's redaction contract, which keeps internal target and generated-note ids out of stored user-facing messages. long-term-memory-extraction-graph checks that contract for missing_memory and rel_removed_relationship. So the message has no ids, and the target stays in the diagnostic's details.linkTarget. The message also says "could not find or did not keep" rather than "does not exist". The issue's own example links to a real memory outside the retrieval window, so that memory does exist.
  • No change to normalizeBulletLines. The runtime test's legacyBullets case relies on its rule.
  • Missing sources after a reload. They are still listed in the result panel. They are no longer added to the Retry failed set.
  • Release: long-term-memory 1.4.52, with the CHANGELOG entry, version, manifest, rebuilt server.mjs and client.js, artifact and catalog entries. upstream/staging (1.4.51) was already the branch base, so reland did not merge.

Diff before the release commit: source +36/−25 lines, tests +81/−1, CHANGELOG +6.

Not included, as the issue states: resolving link targets outside the retrieval window instead of dropping the unit (audit F7 part 2, which needs a contract decision first).

Package and security impact

  • Affected package IDs: long-term-memory
  • Engine compatibility impact: none
  • New or changed permissions/entrypoints: none
  • Restart, storage, update, or uninstall impact: stored memories are unchanged. New extractions store the new drop message for link-target drops; older entries keep their text. Recall text for relationship memories that start with Summary: now includes that sentence, so those chunks use slightly more of the prompt budget.
  • Merge danger: two-way door. It changes message text, which units carry a warning, one recall formatting step and a client selection; there is no schema or stored-data change. Reverting restores the old behaviour. Blast radius: extraction drop messages and warnings, recall text for relationship memories, and the Retry failed selection after a reload.

Validation

  • node scripts/validate-catalog.mjs passes locally
  • git diff --check passes locally
  • Rebuilt every affected manifest, payload, artifact, and catalog entry
  • Installed or updated the affected package through Marinara Engine
  • Checked supported modes, restart behavior, and uninstall cleanup
  • Read and followed CONTRIBUTING.md

Manual verification notes

These checks were run by the coding agent, not by a person. Engine checkout 2039583ca, Node v24.15.0.

  • Regressions added. Each failed with the source change reverted:
    • tests/long-term-memory-extraction-reliability.regression.ts: three assertions.
      • A unit linking to an unknown target is dropped with the new message, not "wrong memory stream".
      • A unit drawn from past the 500th token of a long source gets no low_lexical_evidence warning.
      • A dropped unit carries no warning.
      • Reverting only the cap change, or only the unitDiagnostics move, fails the lexical assertion.
    • tests/long-term-memory-runtime.regression.ts: the probe-H relationship chunk renders the scores line, the summary sentence and the second sentence. legacyBullets still passes.
    • tests/long-term-memory-source-task.regression.ts: retryableSourceIds returns [] for a result that only has missingSourceIds, and the retryable ids for a mixed live or restored result.
    • tests/long-term-memory-feedback-clarity-ui.regression.mjs: the three call sites use the helper.
  • On the source commit 33755ef86, these passed:
    • test-ltm.sh extraction-reliability, runtime, source-task, feedback-clarity-ui, extraction-graph, local-characters, conversation-summary-import, review-queue-ambiguous-link, routes-imports and browser.
    • candidate-reconciliation and reconciliation-recall.
    • typecheck-packages, test-fast.sh and the four catalog gates.
  • On release HEAD 69eae5d7d, these all passed:
    • A package rebuild, which left the tree clean, so the committed outputs match the source.
    • test-fast.sh (npm run check, git diff --check) and typecheck-packages long-term-memory.
    • test-catalog-lanes, validate-package-locales, validate-catalog and catalog-release-notes.
    • test-ltm.sh extraction-reliability, extraction-graph, local-characters, runtime, source-task, feedback-clarity-ui, routes-imports and browser.
  • Not done: a live extraction and recall in Engine, test-ltm.sh all and test-ci.sh.

Documentation impact

  • No documentation changes needed
  • Updated this README catalog and package guidance
  • Updated linked Marinara Engine documentation

UI evidence (if applicable)

None. Two things change on screen:

  • Activity: a link-target drop shows the new message.
  • Retry failed, after a reload: sources that were not found are no longer selected.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved extraction checks for long sources and clarified warnings when evidence has low overlap or references missing memories.
    • Preserved relationship summary text in prompts while removing redundant labels.
    • Made retry after a reload target the same retryable sources as before, excluding sources that remain missing.
  • Documentation
    • Updated Long-Term Memory release notes and package metadata to version 1.4.52.

🔄 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-Agents/pull/1458 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 10/18/2026 **Status:** ✅ Merged **Merged:** 10/18/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `staging` ← **Head:** `fix(long-term-memory)/1450-drop-messages-summary-retry` --- ### 📝 Commits (2) - [`33755ef`](https://github.com/Pasta-Devs/Marinara-Agents/commit/33755ef86f66c78ca00325213ad49f7c6d056130) fix(long-term-memory): clear link-target drop messages, keep relationship summaries in recall, match restored retry set (#1450) - [`69eae5d`](https://github.com/Pasta-Devs/Marinara-Agents/commit/69eae5d7d86c21da598115adc7a1d8f933668119) chore(long-term-memory): release 1.4.52 (#1450) ### 📊 Changes **20 files changed** (+232 additions, -135 deletions) <details> <summary>View changed files</summary> ➕ `artifacts/long-term-memory-1.4.52.zip` (+0 -0) 📝 `catalog/catalog.json` (+8 -8) 📝 `catalog/notes.json` (+6 -6) 📝 `catalog/v2/catalog.json` (+8 -8) 📝 `catalog/v2/notes.json` (+6 -6) 📝 `catalog/v3/catalog.json` (+8 -8) 📝 `catalog/v3/notes.json` (+6 -6) 📝 `packages/long-term-memory/CHANGELOG.md` (+6 -0) 📝 `packages/long-term-memory/client.js` (+24 -24) 📝 `packages/long-term-memory/manifest.json` (+5 -5) 📝 `packages/long-term-memory/server.mjs` (+37 -37) 📝 `packages/long-term-memory/src/engine/packages/client/src/features/long-term-memory/source-task.ts` (+13 -0) 📝 `packages/long-term-memory/src/engine/packages/client/src/features/long-term-memory/sources/SourcesWorkspace.tsx` (+4 -20) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/evidence-unit-validation.ts` (+17 -4) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/prompt-text.ts` (+2 -1) 📝 `scripts/build-feature-packages.mjs` (+1 -1) 📝 `tests/long-term-memory-extraction-reliability.regression.ts` (+39 -0) 📝 `tests/long-term-memory-feedback-clarity-ui.regression.mjs` (+5 -1) 📝 `tests/long-term-memory-runtime.regression.ts` (+17 -0) 📝 `tests/long-term-memory-source-task.regression.ts` (+20 -0) </details> ### 📄 Description ## Linked issue Closes #1450 ## Why this change The extractions audit found three small faults. These are tracker items EX-I6, EX-I7 and EX-I8, from audit F7, F8, F9 with probe H, and CLIENT-001. - **Misleading drop message.** Extraction drops a suggestion that links to a memory it could not find. The message then said the suggestion "used the wrong memory stream". `unknown_link_target` mapped to `unsupported_bucket` and took that reason's generic text. - **The low-overlap warning was wrong in two ways.** `low_lexical_evidence` compared the suggestion only against the first 500 tokens of the source, because `tokenize` caps there. A suggestion drawn from later in a long source was flagged. The warning also went straight into the result's `diagnostics`, so a suggestion that was then dropped still carried it. - **Relationship summaries were lost in recall.** For a relationship memory whose text starts with `Summary:`, `formatLtmChunkPromptText` put the scores line first. `normalizeBulletLines` keeps a `text:`/`summary:` line only when it comes first, so the summary sentence was dropped from the chat prompt. - **Retry differed after a reload.** After a reload, the restored import result added `missingSourceIds` to the Retry failed set. The live result never did. Retrying a missing id asks for the same id again and gets the same "not found". ## What changed ```diff validateLtmEvidenceUnits # evidence-unit-validation.ts + sourceTokens = sourceTokenSet(sourceText) # once, no 500-token cap for each unit - if lexicalOverlap(sourceText, unit.text) < 0.08 → diagnostics.push(warning) + if lexicalOverlap(sourceTokens, unit.text) < 0.08 → unitDiagnostics.push(warning) userFacingDropMessageForCode + unknown_link_target → "Dropped a candidate that linked to a memory this + extraction could not find or did not keep." formatLtmChunkPromptText (relationship) # prompt-text.ts - `${scoresLine}\n${text}` + `${scoresLine}\n${text without a leading text:/summary: label}` +retryableSourceIds(result) # source-task.ts + retryable rows of imported (live) or items (restored), plus retryable writeFailures, de-duplicated SourcesWorkspace # live list, post-import selection, restored list - three inline copies (the restored one also added missingSourceIds) + retryableSourceIds(…) ``` - **Lexical warning.** `sourceTokenSet` uses the same regex and 4-character minimum as `tokenize`. Building the set inside the validator leaves shared `utils.ts` alone. The warning now goes through `unitDiagnostics`, so a suggestion dropped by the first validation pass no longer carries it. A suggestion kept by the first pass and dropped later still carries it, like every other per-unit warning. - **The drop message does not name the target.** The issue asked for the message to name the link target, or to fall through to the diagnostic's own message, which does name it. Either would break #722's redaction contract, which keeps internal target and generated-note ids out of stored user-facing messages. `long-term-memory-extraction-graph` checks that contract for `missing_memory` and `rel_removed_relationship`. So the message has no ids, and the target stays in the diagnostic's `details.linkTarget`. The message also says "could not find or did not keep" rather than "does not exist". The issue's own example links to a real memory outside the retrieval window, so that memory does exist. - **No change to `normalizeBulletLines`.** The runtime test's `legacyBullets` case relies on its rule. - **Missing sources after a reload.** They are still listed in the result panel. They are no longer added to the Retry failed set. - **Release:** `long-term-memory` 1.4.52, with the CHANGELOG entry, version, manifest, rebuilt `server.mjs` and `client.js`, artifact and catalog entries. `upstream/staging` (1.4.51) was already the branch base, so reland did not merge. Diff before the release commit: source +36/−25 lines, tests +81/−1, CHANGELOG +6. Not included, as the issue states: resolving link targets outside the retrieval window instead of dropping the unit (audit F7 part 2, which needs a contract decision first). ## Package and security impact - Affected package IDs: `long-term-memory` - Engine compatibility impact: none - New or changed permissions/entrypoints: none - Restart, storage, update, or uninstall impact: stored memories are unchanged. New extractions store the new drop message for link-target drops; older entries keep their text. Recall text for relationship memories that start with `Summary:` now includes that sentence, so those chunks use slightly more of the prompt budget. - **Merge danger:** two-way door. It changes message text, which units carry a warning, one recall formatting step and a client selection; there is no schema or stored-data change. Reverting restores the old behaviour. Blast radius: extraction drop messages and warnings, recall text for relationship memories, and the Retry failed selection after a reload. ## Validation - [ ] `node scripts/validate-catalog.mjs` passes locally - [ ] `git diff --check` passes locally - [ ] Rebuilt every affected manifest, payload, artifact, and catalog entry - [ ] Installed or updated the affected package through Marinara Engine - [ ] Checked supported modes, restart behavior, and uninstall cleanup - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes These checks were run by the coding agent, not by a person. Engine checkout `2039583ca`, Node `v24.15.0`. - **Regressions added.** Each failed with the source change reverted: - **`tests/long-term-memory-extraction-reliability.regression.ts`:** three assertions. - A unit linking to an unknown target is dropped with the new message, not "wrong memory stream". - A unit drawn from past the 500th token of a long source gets no `low_lexical_evidence` warning. - A dropped unit carries no warning. - Reverting only the cap change, or only the `unitDiagnostics` move, fails the lexical assertion. - **`tests/long-term-memory-runtime.regression.ts`:** the probe-H relationship chunk renders the scores line, the summary sentence and the second sentence. `legacyBullets` still passes. - **`tests/long-term-memory-source-task.regression.ts`:** `retryableSourceIds` returns `[]` for a result that only has `missingSourceIds`, and the retryable ids for a mixed live or restored result. - **`tests/long-term-memory-feedback-clarity-ui.regression.mjs`:** the three call sites use the helper. - **On the source commit `33755ef86`, these passed:** - `test-ltm.sh` `extraction-reliability`, `runtime`, `source-task`, `feedback-clarity-ui`, `extraction-graph`, `local-characters`, `conversation-summary-import`, `review-queue-ambiguous-link`, `routes-imports` and `browser`. - `candidate-reconciliation` and `reconciliation-recall`. - `typecheck-packages`, `test-fast.sh` and the four catalog gates. - **On release HEAD `69eae5d7d`, these all passed:** - A package rebuild, which left the tree clean, so the committed outputs match the source. - `test-fast.sh` (`npm run check`, `git diff --check`) and `typecheck-packages long-term-memory`. - `test-catalog-lanes`, `validate-package-locales`, `validate-catalog` and `catalog-release-notes`. - `test-ltm.sh` `extraction-reliability`, `extraction-graph`, `local-characters`, `runtime`, `source-task`, `feedback-clarity-ui`, `routes-imports` and `browser`. - Not done: a live extraction and recall in Engine, `test-ltm.sh all` and `test-ci.sh`. ## Documentation impact - [ ] No documentation changes needed - [ ] Updated this README catalog and package guidance - [ ] Updated linked Marinara Engine documentation ## UI evidence (if applicable) None. Two things change on screen: - **Activity:** a link-target drop shows the new message. - **Retry failed, after a reload:** sources that were not found are no longer selected. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved extraction checks for long sources and clarified warnings when evidence has low overlap or references missing memories. * Preserved relationship summary text in prompts while removing redundant labels. * Made retry after a reload target the same retryable sources as before, excluding sources that remain missing. * **Documentation** * Updated Long-Term Memory release notes and package metadata to version 1.4.52. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-21 05:11:51 +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-Agents#1473
No description provided.