[PR #1540] [MERGED] fix(long-term-memory): keep recovery copies of digit-led subject ids valid (#1534) #1537

Closed
opened 2026-10-22 04:03:12 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: staging ← Head: fix(long-term-memory)/recovery-subject-id-leading-digit


📝 Commits (3)

  • b71621d fix(long-term-memory): keep recovery copies of digit-led subject ids valid (#1534)
  • ce09128 Merge upstream/staging into fix(long-term-memory)/recovery-subject-id-leading-digit; release long-term-memory 1.4.73
  • cde4187 docs(long-term-memory): write the 1.4.73 release note as plain text

📊 Changes

15 files changed (+262 additions, -85 deletions)

View changed files

➕ artifacts/long-term-memory-1.4.73.zip (+0 -0)
📝 catalog/catalog.json (+6 -6)
📝 catalog/notes.json (+6 -6)
📝 catalog/v2/catalog.json (+6 -6)
📝 catalog/v2/notes.json (+6 -6)
📝 catalog/v3/catalog.json (+6 -6)
📝 catalog/v3/notes.json (+6 -6)
📝 packages/long-term-memory/CHANGELOG.md (+4 -0)
📝 packages/long-term-memory/manifest.json (+3 -3)
📝 packages/long-term-memory/server.mjs (+40 -40)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/extraction/evidence-unit-extraction.ts (+3 -2)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/extraction/evidence-unit-validation.ts (+10 -1)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/identity/subject-identity.ts (+3 -2)
📝 scripts/build-feature-packages.mjs (+1 -1)
📝 tests/long-term-memory-storage.regression.ts (+162 -0)

📄 Description

Pull request

Linked issue

Closes #1534

Why this change

  • An extraction could fail as a whole, keeping nothing from the source, when it left out a memory about a note whose id has a digit right after the prefix. That covers older notes such as rel_96dfe1cd8f75 and new characters whose name starts with a digit, such as "2B" (char_2_b). Removing the prefix left 96dfe1cd8f75 or 2_b as the memory's subject id, which fails the identifier rule, so the left-out suggestion made the draft invalid: ZodError: extractionOutcome.droppedCandidates[2].recoveryCandidate.subjectId: Identifier must be lowercase snake_case. This is a remaining cause of #1040; that fix normalizes case and punctuation, not a leading digit. It reproduced in 1 of 16 runs on a real vault.

What changed

  • long-term-memory: when extraction leaves out a memory, the copy kept for Review uses the full note id as its subject id if removing the prefix would leave one that starts with a digit. The full id names the same note. This applies at the four places a left-out memory gets that copy (validation, the roleplay-only character check, the source-event check, identity). Memories that are kept, and identity and reconciliation, are unchanged.
  • Storage regression for the drop-then-draft path (relationship and character, unstructured and structured sources), an identity drop, and the kept-unit round trip.
  • Release: long-term-memory 1.4.73 on staging bcaebd07d, with the CHANGELOG entry, version, manifest, rebuilt server.mjs, artifact and catalog entries.

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: none. Only the stored copy of a left-out memory changes, and only when its subject id would start with a digit; such copies failed validation before, so none is stored anywhere.

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

  • On staging the new storage cases fail: the left-out memory's copy has 96dfe1cd8f75, and writing the draft throws the recoveryCandidate.subjectId ZodError. With the fix each draft is written, the copy keeps rel_96dfe1cd8f75, char_2_b or char_3_c, and no recovery_subject_id_validation_failed event is logged. A kept memory still updates rel_96dfe1cd8f75.
  • With only the identity site left at the old code, the identity case fails ('3_c' !== 'char_3_c').
  • On the fix commit (base 5984f0784): typecheck, lint, the Pull Request Checks commands, the package build and every Long-Term Memory regression suite pass. On the release head: the package rebuild leaves the tree clean, the catalog, locale and release-notes checks and the typecheck pass, and the storage and extraction-graph suites pass. Hosted CI runs the full suite list on this head. After review, the release note was rewritten as plain text (no backticks; the Engine shows notes verbatim); that commit changes only the note and its three generated notes.json copies, and the quick checks, including the release-notes check, pass on it.

Documentation impact

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

UI evidence (if applicable)

  • n/a (server)

🤖 Generated with Claude Code


🔄 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/1540 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 10/21/2026 **Status:** ✅ Merged **Merged:** 10/21/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `staging` ← **Head:** `fix(long-term-memory)/recovery-subject-id-leading-digit` --- ### 📝 Commits (3) - [`b71621d`](https://github.com/Pasta-Devs/Marinara-Agents/commit/b71621d1bb9dd4dd749c2d789f1cb2ec2f6bf008) fix(long-term-memory): keep recovery copies of digit-led subject ids valid (#1534) - [`ce09128`](https://github.com/Pasta-Devs/Marinara-Agents/commit/ce091281bc27dd0a419f8629a3486d3d94ac9342) Merge upstream/staging into fix(long-term-memory)/recovery-subject-id-leading-digit; release long-term-memory 1.4.73 - [`cde4187`](https://github.com/Pasta-Devs/Marinara-Agents/commit/cde418769c2331ff2cf74be9306d6a11e5b5af50) docs(long-term-memory): write the 1.4.73 release note as plain text ### 📊 Changes **15 files changed** (+262 additions, -85 deletions) <details> <summary>View changed files</summary> ➕ `artifacts/long-term-memory-1.4.73.zip` (+0 -0) 📝 `catalog/catalog.json` (+6 -6) 📝 `catalog/notes.json` (+6 -6) 📝 `catalog/v2/catalog.json` (+6 -6) 📝 `catalog/v2/notes.json` (+6 -6) 📝 `catalog/v3/catalog.json` (+6 -6) 📝 `catalog/v3/notes.json` (+6 -6) 📝 `packages/long-term-memory/CHANGELOG.md` (+4 -0) 📝 `packages/long-term-memory/manifest.json` (+3 -3) 📝 `packages/long-term-memory/server.mjs` (+40 -40) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/extraction/evidence-unit-extraction.ts` (+3 -2) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/extraction/evidence-unit-validation.ts` (+10 -1) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/identity/subject-identity.ts` (+3 -2) 📝 `scripts/build-feature-packages.mjs` (+1 -1) 📝 `tests/long-term-memory-storage.regression.ts` (+162 -0) </details> ### 📄 Description # Pull request ## Linked issue Closes #1534 ## Why this change - An extraction could fail as a whole, keeping nothing from the source, when it left out a memory about a note whose id has a digit right after the prefix. That covers older notes such as `rel_96dfe1cd8f75` and new characters whose name starts with a digit, such as "2B" (`char_2_b`). Removing the prefix left `96dfe1cd8f75` or `2_b` as the memory's subject id, which fails the identifier rule, so the left-out suggestion made the draft invalid: `ZodError: extractionOutcome.droppedCandidates[2].recoveryCandidate.subjectId: Identifier must be lowercase snake_case`. This is a remaining cause of #1040; that fix normalizes case and punctuation, not a leading digit. It reproduced in 1 of 16 runs on a real vault. ## What changed - `long-term-memory`: when extraction leaves out a memory, the copy kept for Review uses the full note id as its subject id if removing the prefix would leave one that starts with a digit. The full id names the same note. This applies at the four places a left-out memory gets that copy (validation, the roleplay-only character check, the source-event check, identity). Memories that are kept, and identity and reconciliation, are unchanged. - Storage regression for the drop-then-draft path (relationship and character, unstructured and structured sources), an identity drop, and the kept-unit round trip. - **Release:** `long-term-memory` 1.4.73 on staging bcaebd07d, with the CHANGELOG entry, version, manifest, rebuilt `server.mjs`, artifact and catalog entries. ## 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: none. Only the stored copy of a left-out memory changes, and only when its subject id would start with a digit; such copies failed validation before, so none is stored anywhere. ## 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 - On `staging` the new storage cases fail: the left-out memory's copy has `96dfe1cd8f75`, and writing the draft throws the `recoveryCandidate.subjectId` ZodError. With the fix each draft is written, the copy keeps `rel_96dfe1cd8f75`, `char_2_b` or `char_3_c`, and no `recovery_subject_id_validation_failed` event is logged. A kept memory still updates `rel_96dfe1cd8f75`. - With only the identity site left at the old code, the identity case fails (`'3_c' !== 'char_3_c'`). - On the fix commit (base 5984f0784): typecheck, lint, the Pull Request Checks commands, the package build and every Long-Term Memory regression suite pass. On the release head: the package rebuild leaves the tree clean, the catalog, locale and release-notes checks and the typecheck pass, and the storage and extraction-graph suites pass. Hosted CI runs the full suite list on this head. After review, the release note was rewritten as plain text (no backticks; the Engine shows notes verbatim); that commit changes only the note and its three generated `notes.json` copies, and the quick checks, including the release-notes check, pass on it. ## Documentation impact - [ ] No documentation changes needed - [ ] Updated this README catalog and package guidance - [ ] Updated linked Marinara Engine documentation ## UI evidence (if applicable) - n/a (server) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:03:12 +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#1537
No description provided.