[GH-ISSUE #1255] [Issue]: long-term-memory Debug tab shows misleading data — extract tested data helpers (D01, D03, D08, D11, D17, D28, D29) #642

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

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

Originally assigned to: @Promansis on GitHub.

Summary

The Long-Term Memory Debug tab can show data that is not true. A phase or "Errors only" filter recomputes each operation's status from a subset of its events, so a truncated extraction reads "Completed"; humanised text rewrites note ids into wrong names; only the newest 200 events load with no notice; a started-only operation reads "Running" forever; and opening the tab downloads the entire vault just to map ids to titles.

This issue tracks PR 1 of four from the Debug-tab UI audit (revision 2): extract pure, tested data helpers and switch ActivityView to them, with minimal visual change.

Affected package

long-term-memory (client only) — source root packages/long-term-memory/src/engine/packages/client/src/features/long-term-memory/ (abbreviated ltm/ below). About 5 locale keys. Changes executable client code, so it needs a rebuild plus a patch bump and CHANGELOG entry (see Additional context).

Expected behavior

  • Filtering by phase/status must not change an operation's displayed status: the operation's full event list decides status, and a filter selects whole operations ("operation contains a matching event").
  • Id→name replacement matches whole tokens only.
  • When the newest 200 events are shown, the UI says so; optional "Show up to 1,000".
  • A run with only a started event and no completion past a threshold reads "No completion recorded" instead of "Running" (no duration is fabricated, so the existing guarantee holds).
  • Titles resolve via the existing requestNotesByIds for ids actually on screen, with staleTime set and no refetch on window focus.
  • Closed event <details> do not run a JSON humaniser transform on every render.
  • A successful Refresh clears a stale action error.

Actual behavior

Baseline: staging @ f140047, package long-term-memory v1.4.6. All line refs are in ltm/.

  • D01 (P1) — Filtering rewrites status. ActivityView.tsx:297-302 queries with server-side phase/status; :121-153 derives status from only the returned events. Measured: truncated op reads "Completed with warnings — Model output limit reached" unfiltered, but "Completed — AI extraction: Ok." under Extraction; a partial import reads "Completed" under Import and "Failed" under Errors only.
  • D03 (P1) — Id→name rewrite mangles names. :326-335 alternates every note id with \b only on the UUID branch. Seen: character_mara_missing → "Mara Quill_missing"; world_lantern_guild_v2 → "Lantern Guild_v2".
  • D08 (P2) — Silent 200-event window. :297-302 uses limit=200; the response carries no total/hasMore. Measured with 281 events: 200 returned → 51 operations, no notice, and the oldest operation shows 3 of its 4 events.
  • D11 (P2) — "Running" forever. :121-153 maps started with no terminal event to "Running". Seen: a 2-day-old operation reads "Running"; no refetchInterval exists.
  • D17 (P2) — Full-vault download for titles. :312-315 with api.ts:165-175 (requestAllNotes pages of 500 full notes). Measured: ≈2.1 MB per fetch at 2,004 notes, ≈10.6 MB at 10,004, repeated on every window refocus.
  • D28 (P3) — Per-render JSON transform. :866-870 runs humanizeDebugText(JSON.stringify(metadata)) for every event with metadata inside closed <details>, on every state change. Measured: 15 / 61 / 157 ms per pass at 100 / 2,000 / 10,000 ids; a recall-panel toggle cost ≈43 → ≈53 ms.
  • D29 (P3) — Stale state and refetch. :292-306: an Export error survives a successful Refresh, and every filter change refetches (even to a previously loaded key).

Steps to reproduce

  1. Build/install long-term-memory 1.4.6 and open Long-Term Memory → Memory Settings → Debug with a log containing an operation whose extraction was truncated.
  2. Select Extraction in the filter: the operation now reads "Completed" instead of "Completed with warnings".
  3. With debug recording on, inspect a 2-day-old started-only operation: it reads "Running" indefinitely.
  4. With a large vault, open the tab and watch requests: /notes?limit=500&offset=0 pages download the whole vault; returning to the window repeats it.
  5. Fail an Export, then click Refresh: the error remains.

Environment

  • Marinara Engine version: v2.4.1 (manifest builtAgainst c0ce4d8)
  • Package version: long-term-memory 1.4.6
  • Install type: source
  • OS + version: Linux
  • Browser or app shell: Chromium 141 (audit harness)

Logs, screenshots, or video

Not included here; evidence was captured during the read-only UI audit as measured/seen probes (DOM/computed-style/request-log/perf) and a scratch Playwright harness outside the repository.

Additional context

Follow-up plan (revision 2), PR 1 of 4. In scope:

  • New pure helpers (one module): group events into operations and filter whole operations; compute status from all of an operation's events; "No completion recorded" threshold; whole-token id→name lookup; read the outcome fields used by later PRs.
  • New Node regression test for those helpers (style of scope-targets/debug-log, tests README "Focused helpers").
  • ActivityView switches to the helpers: one unfiltered window filtered client-side; titles via requestNotesByIds for on-screen ids; staleTime and no refetch on refocus; a "newest 200" note with "Show up to 1,000".
  • Browser stub: the debug-log route (tests/long-term-memory-browser.regression.ts:2485) must parse limit/phase/status/operationId and slice like readLtmDebugLog; today it returns the same events for every query, so filter/window behaviour is untested.
  • Rebuild with scripts/build-feature-packages.mjs long-term-memory, patch bump + CHANGELOG entry, and the baseline gates: npm run check, node scripts/test-catalog-lanes.mjs, node scripts/validate-package-locales.mjs, node scripts/validate-catalog.mjs, node scripts/tests/catalog-release-notes.regression.mjs, npm run typecheck:packages, plus the LTM browser and feedback-clarity tests. Explicit validation notes required (security-sensitive executable client code).

Out of scope: layout changes. The two-pane layout, breakdowns and controls/polish are PRs 2–4 of the audit; this PR keeps the current layout so they build on tested logic. Risk: moderate, since the data flow changes.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Oct 7, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1255 Originally assigned to: @Promansis on GitHub. ## Summary The Long-Term Memory **Debug** tab can show data that is not true. A phase or "Errors only" filter recomputes each operation's status from a *subset* of its events, so a truncated extraction reads "Completed"; humanised text rewrites note ids into wrong names; only the newest 200 events load with no notice; a started-only operation reads "Running" forever; and opening the tab downloads the entire vault just to map ids to titles. This issue tracks **PR 1 of four** from the Debug-tab UI audit (revision 2): extract pure, tested data helpers and switch `ActivityView` to them, with **minimal visual change**. ## Affected package `long-term-memory` (client only) — source root `packages/long-term-memory/src/engine/packages/client/src/features/long-term-memory/` (abbreviated `ltm/` below). About 5 locale keys. Changes executable client code, so it needs a rebuild plus a patch bump and CHANGELOG entry (see Additional context). ## Expected behavior - Filtering by phase/status must not change an operation's displayed status: the operation's **full** event list decides status, and a filter selects whole operations ("operation contains a matching event"). - Id→name replacement matches whole tokens only. - When the newest 200 events are shown, the UI says so; optional "Show up to 1,000". - A run with only a `started` event and no completion past a threshold reads "No completion recorded" instead of "Running" (no duration is fabricated, so the existing guarantee holds). - Titles resolve via the existing `requestNotesByIds` for ids actually on screen, with `staleTime` set and no refetch on window focus. - Closed event `<details>` do not run a JSON humaniser transform on every render. - A successful Refresh clears a stale action error. ## Actual behavior Baseline: `staging` @ `f140047`, package `long-term-memory` v1.4.6. All line refs are in `ltm/`. - **D01 (P1) — Filtering rewrites status.** `ActivityView.tsx:297-302` queries with server-side `phase`/`status`; `:121-153` derives status from only the returned events. Measured: truncated op reads "Completed with warnings — Model output limit reached" unfiltered, but "Completed — AI extraction: Ok." under *Extraction*; a partial import reads "Completed" under *Import* and "Failed" under *Errors only*. - **D03 (P1) — Id→name rewrite mangles names.** `:326-335` alternates every note id with `\b` only on the UUID branch. Seen: `character_mara_missing` → "Mara Quill_missing"; `world_lantern_guild_v2` → "Lantern Guild_v2". - **D08 (P2) — Silent 200-event window.** `:297-302` uses `limit=200`; the response carries no total/hasMore. Measured with 281 events: 200 returned → 51 operations, no notice, and the oldest operation shows 3 of its 4 events. - **D11 (P2) — "Running" forever.** `:121-153` maps `started` with no terminal event to "Running". Seen: a 2-day-old operation reads "Running"; no `refetchInterval` exists. - **D17 (P2) — Full-vault download for titles.** `:312-315` with `api.ts:165-175` (`requestAllNotes` pages of 500 full notes). Measured: ≈2.1 MB per fetch at 2,004 notes, ≈10.6 MB at 10,004, repeated on every window refocus. - **D28 (P3) — Per-render JSON transform.** `:866-870` runs `humanizeDebugText(JSON.stringify(metadata))` for every event with metadata inside *closed* `<details>`, on every state change. Measured: 15 / 61 / 157 ms per pass at 100 / 2,000 / 10,000 ids; a recall-panel toggle cost ≈43 → ≈53 ms. - **D29 (P3) — Stale state and refetch.** `:292-306`: an Export error survives a successful Refresh, and every filter change refetches (even to a previously loaded key). ## Steps to reproduce 1. Build/install `long-term-memory` 1.4.6 and open Long-Term Memory → Memory Settings → Debug with a log containing an operation whose extraction was truncated. 2. Select *Extraction* in the filter: the operation now reads "Completed" instead of "Completed with warnings". 3. With debug recording on, inspect a 2-day-old started-only operation: it reads "Running" indefinitely. 4. With a large vault, open the tab and watch requests: `/notes?limit=500&offset=0` pages download the whole vault; returning to the window repeats it. 5. Fail an Export, then click Refresh: the error remains. ## Environment - Marinara Engine version: v2.4.1 (manifest `builtAgainst` c0ce4d8) - Package version: long-term-memory 1.4.6 - Install type: source - OS + version: Linux - Browser or app shell: Chromium 141 (audit harness) ## Logs, screenshots, or video Not included here; evidence was captured during the read-only UI audit as measured/seen probes (DOM/computed-style/request-log/perf) and a scratch Playwright harness outside the repository. ## Additional context Follow-up plan (revision 2), PR 1 of 4. **In scope:** - New pure helpers (one module): group events into operations and filter whole operations; compute status from all of an operation's events; "No completion recorded" threshold; whole-token id→name lookup; read the outcome fields used by later PRs. - New Node regression test for those helpers (style of `scope-targets`/`debug-log`, tests README "Focused helpers"). - `ActivityView` switches to the helpers: one unfiltered window filtered client-side; titles via `requestNotesByIds` for on-screen ids; `staleTime` and no refetch on refocus; a "newest 200" note with "Show up to 1,000". - Browser stub: the `debug-log` route (`tests/long-term-memory-browser.regression.ts:2485`) must parse `limit/phase/status/operationId` and slice like `readLtmDebugLog`; today it returns the same events for every query, so filter/window behaviour is untested. - Rebuild with `scripts/build-feature-packages.mjs long-term-memory`, patch bump + CHANGELOG entry, and the baseline gates: `npm run check`, `node scripts/test-catalog-lanes.mjs`, `node scripts/validate-package-locales.mjs`, `node scripts/validate-catalog.mjs`, `node scripts/tests/catalog-release-notes.regression.mjs`, `npm run typecheck:packages`, plus the LTM browser and feedback-clarity tests. Explicit validation notes required (security-sensitive executable client code). **Out of scope:** layout changes. The two-pane layout, breakdowns and controls/polish are PRs 2–4 of the audit; this PR keeps the current layout so they build on tested logic. Risk: moderate, since the data flow changes. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-20 17:29:16 +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#642
No description provided.