[GH-ISSUE #1137] [Issue]: LTM summary normalization drops timeline units in flat summaries and duplicates structured backfill #582

Closed
opened 2026-10-20 17:28:46 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Promansis on GitHub (Sep 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1137

Originally assigned to: @Promansis on GitHub.

Summary

Long-Term Memory extraction loses valid evidence units from chat summaries and can add duplicate units, inside the summary-normalization path.

Affected package

Long-Term Memory (long-term-memory), server-side normalization and validation.

Expected behavior

  • A timeline_event produced from any summary shape is retained when it is otherwise valid.
  • Text under an unrecognized structured heading is not attributed to the previous known section.
  • Structured backfill does not add units that duplicate candidate units already produced for the same source.

Actual behavior

  • normalizeUnit forces sectionKey: "event" for timeline_event, but it only runs on the structured path (sections.length > 0). Prose or flat summaries call normalizeTargetShapeUnit, which never sets timeline_event.sectionKey, and normalizeSourceEventGraph sets claimKind but not sectionKey. evidence-unit-validation.ts:185 then drops the unit as invalid_timeline_section. Retained relationship units that linked to the dropped event also fail as relationship_state_missing_caused_by.
  • parseStructuredSections closes a section only when a heading maps to a known bucket. An unknown heading returns null, so the heading line is appended to the current section and the section stays open. Following fields are attributed to the previous bucket.
  • normalizeStructuredSummaryEvidenceUnits appends backfilled units without comparing them to the units already returned for the source. addedUnits is only a count.

Steps to reproduce

  1. Submit a chat summary without recognized section headings that contains a valid timeline_event and a relationship change linked to it.
  2. Submit a structured summary containing a heading that is not one of the recognized buckets, followed by valid fields.
  3. Submit a structured summary whose fields are also returned as candidate units, and compare candidate counts with and without the returned units.

Environment

  • Marinara Engine version: manifest range >=2.4.1 <4.0.0
  • Package version: 1.3.31
  • Install type: source regression harness
  • OS + version: not applicable to the server normalization contract
  • Browser or app shell: not applicable

Logs, screenshots, or video

Not applicable. Evidence is in the server-side normalization and validation path and should be covered with synthetic fixtures only, without private chat or vault data.

Additional context

  • Narrow implementation scope: structured-summary-normalizer.ts (normalizeUnit, normalizeTargetShapeUnit, normalizeSourceEventGraph, parseStructuredSections) and the normalizeStructuredSummaryEvidenceUnits call in source-extraction.ts.
  • normalizeSourceEventGraph early-returns when sourceNote?.provenance is absent; the sectionKey fix must also cover that case.
  • Focused proof target: tests/long-term-memory-extraction-graph.regression.ts.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Sep 29, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1137 Originally assigned to: @Promansis on GitHub. ## Summary Long-Term Memory extraction loses valid evidence units from chat summaries and can add duplicate units, inside the summary-normalization path. ## Affected package Long-Term Memory (`long-term-memory`), server-side normalization and validation. ## Expected behavior - A `timeline_event` produced from any summary shape is retained when it is otherwise valid. - Text under an unrecognized structured heading is not attributed to the previous known section. - Structured backfill does not add units that duplicate candidate units already produced for the same source. ## Actual behavior - `normalizeUnit` forces `sectionKey: "event"` for `timeline_event`, but it only runs on the structured path (`sections.length > 0`). Prose or flat summaries call `normalizeTargetShapeUnit`, which never sets `timeline_event.sectionKey`, and `normalizeSourceEventGraph` sets `claimKind` but not `sectionKey`. `evidence-unit-validation.ts:185` then drops the unit as `invalid_timeline_section`. Retained relationship units that linked to the dropped event also fail as `relationship_state_missing_caused_by`. - `parseStructuredSections` closes a section only when a heading maps to a known bucket. An unknown heading returns `null`, so the heading line is appended to the current section and the section stays open. Following fields are attributed to the previous bucket. - `normalizeStructuredSummaryEvidenceUnits` appends backfilled units without comparing them to the units already returned for the source. `addedUnits` is only a count. ## Steps to reproduce 1. Submit a chat summary without recognized section headings that contains a valid `timeline_event` and a relationship change linked to it. 2. Submit a structured summary containing a heading that is not one of the recognized buckets, followed by valid fields. 3. Submit a structured summary whose fields are also returned as candidate units, and compare candidate counts with and without the returned units. ## Environment - Marinara Engine version: manifest range `>=2.4.1 <4.0.0` - Package version: 1.3.31 - Install type: source regression harness - OS + version: not applicable to the server normalization contract - Browser or app shell: not applicable ## Logs, screenshots, or video Not applicable. Evidence is in the server-side normalization and validation path and should be covered with synthetic fixtures only, without private chat or vault data. ## Additional context - Narrow implementation scope: `structured-summary-normalizer.ts` (`normalizeUnit`, `normalizeTargetShapeUnit`, `normalizeSourceEventGraph`, `parseStructuredSections`) and the `normalizeStructuredSummaryEvidenceUnits` call in `source-extraction.ts`. - `normalizeSourceEventGraph` early-returns when `sourceNote?.provenance` is absent; the sectionKey fix must also cover that case. - Focused proof target: `tests/long-term-memory-extraction-graph.regression.ts`. ## Template check - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-20 17:28:46 +07:00
  • closed this issue
  • added the
    bug
    label
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#582
No description provided.