[PR #1557] [MERGED] fix(long-term-memory): trim a full debug log to 1.5 MB so later lines append (1.4.82) #1561

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

📋 Pull Request Information

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

Base: staging ← Head: fix(long-term-memory)/debug-log-trim


📝 Commits (3)

  • f241f97 fix(long-term-memory): trim a full debug log to 1.5 MB so later lines append (#1556)
  • ecc3271 chore(long-term-memory): release 1.4.81 (#1556)
  • 9e16d64 Merge upstream/staging into fix(long-term-memory)/debug-log-trim; release long-term-memory 1.4.82

📊 Changes

13 files changed (+108 additions, -65 deletions)

View changed files

➕ artifacts/long-term-memory-1.4.82.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 (+23 -23)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/maintenance/debug-log.ts (+3 -1)
📝 scripts/build-feature-packages.mjs (+1 -1)
📝 tests/long-term-memory-debug-log.regression.ts (+38 -1)

📄 Description

Pull request

Linked issue

Closes #1556

Why this change

  • Long-Term Memory keeps its debug log at most 2 MB. Once the log was full, it was trimmed only to just under 2 MB, so the next line overflowed again. From then on every debug line read the whole file, trimmed it and wrote it back through a temporary file.
  • Every recall, extraction and draft apply writes debug lines, and the debug setting in Memory Settings does not gate them. The append runs under the vault lock, so on a long-running install saves and recalls waited for a 2 MB rewrite each time a line was written.

What changed

  • long-term-memory: a full debug log now keeps its newest complete lines within 1.5 MB, three quarters of the cap, before the new line is added. The lines after that are plain appends until the log reaches 2 MB again.
 appendBounded(path, line)
   if size + line <= 2 MB
     append line
     return
-  keep newest lines within (2 MB - line), then add line     # the next line overflows again
+  keep newest lines within (1.5 MB - line), then add line   # about 0.5 MB of plain appends follow
  • The log still never passes 2 MB, every line stays complete JSON and the newest lines are kept. It still runs under the vault lock and the per-file write queue, and Clear log is unchanged. The cost is that the log holds 1.5 to 2 MB of history instead of always about 2 MB.
  • Regression extended in tests/long-term-memory-debug-log.regression.ts. CHANGELOG entry; rebuilt packages/long-term-memory server bundle, manifest, artifact and catalog entries as 1.4.82, after merging staging with 1.4.81 (#1558).

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: the debug log in the vault folder keeps less history after its first trim. No stored memory, setting or index changes. Rolling back to 1.4.81 is safe: it reads the same file and trims it as before.

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

  • The new check fills the debug log with large events until it trims, then records one more large event.
after the trim:  size <= 1.5 MB
next event:      the file before it is a prefix of the file after it (appended, not rewritten)
  • On staging 2a473d3eb, with the 1.5 MB target supplied by the test, the check fails at "a trimmed log must end at or below the trim target": the log ends within one line of 2 MB. With the fix it passes.
  • The debug-log, runtime, routes, storage, rebuild-job, reconciliation-recall, extraction-reliability and installation suites passed on the first release commit, as did the package typecheck, format and lint, and the catalog, locale and release-notes checks.
  • After merging staging at e8425d544 and releasing as 1.4.82, the rebuild is clean, and format and lint, the package typecheck, the catalog, locale and release-notes checks and the debug-log suite pass. Hosted CI runs the full regression set on the merge.
  • Not installed through a running Engine; the installation suite installs the rebuilt archive.

Documentation impact

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

UI evidence (if applicable)

No UI change.

🤖 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/1557 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `staging` ← **Head:** `fix(long-term-memory)/debug-log-trim` --- ### 📝 Commits (3) - [`f241f97`](https://github.com/Pasta-Devs/Marinara-Agents/commit/f241f97b3066aa56cd2536708125c4323d776b1d) fix(long-term-memory): trim a full debug log to 1.5 MB so later lines append (#1556) - [`ecc3271`](https://github.com/Pasta-Devs/Marinara-Agents/commit/ecc32710cef30a1b046afca96d1ab18e6526024a) chore(long-term-memory): release 1.4.81 (#1556) - [`9e16d64`](https://github.com/Pasta-Devs/Marinara-Agents/commit/9e16d64d26189603134138a13c1f463334466182) Merge upstream/staging into fix(long-term-memory)/debug-log-trim; release long-term-memory 1.4.82 ### 📊 Changes **13 files changed** (+108 additions, -65 deletions) <details> <summary>View changed files</summary> ➕ `artifacts/long-term-memory-1.4.82.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` (+23 -23) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/maintenance/debug-log.ts` (+3 -1) 📝 `scripts/build-feature-packages.mjs` (+1 -1) 📝 `tests/long-term-memory-debug-log.regression.ts` (+38 -1) </details> ### 📄 Description # Pull request ## Linked issue Closes #1556 ## Why this change - Long-Term Memory keeps its debug log at most 2 MB. Once the log was full, it was trimmed only to just under 2 MB, so the next line overflowed again. From then on every debug line read the whole file, trimmed it and wrote it back through a temporary file. - Every recall, extraction and draft apply writes debug lines, and the debug setting in Memory Settings does not gate them. The append runs under the vault lock, so on a long-running install saves and recalls waited for a 2 MB rewrite each time a line was written. ## What changed - `long-term-memory`: a full debug log now keeps its newest complete lines within 1.5 MB, three quarters of the cap, before the new line is added. The lines after that are plain appends until the log reaches 2 MB again. ```diff appendBounded(path, line) if size + line <= 2 MB append line return - keep newest lines within (2 MB - line), then add line # the next line overflows again + keep newest lines within (1.5 MB - line), then add line # about 0.5 MB of plain appends follow ``` - The log still never passes 2 MB, every line stays complete JSON and the newest lines are kept. It still runs under the vault lock and the per-file write queue, and Clear log is unchanged. The cost is that the log holds 1.5 to 2 MB of history instead of always about 2 MB. - Regression extended in `tests/long-term-memory-debug-log.regression.ts`. CHANGELOG entry; rebuilt `packages/long-term-memory` server bundle, manifest, artifact and catalog entries as 1.4.82, after merging `staging` with 1.4.81 (#1558). ## 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: the debug log in the vault folder keeps less history after its first trim. No stored memory, setting or index changes. Rolling back to 1.4.81 is safe: it reads the same file and trims it as before. ## 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 - The new check fills the debug log with large events until it trims, then records one more large event. ```text after the trim: size <= 1.5 MB next event: the file before it is a prefix of the file after it (appended, not rewritten) ``` - On `staging` 2a473d3eb, with the 1.5 MB target supplied by the test, the check fails at "a trimmed log must end at or below the trim target": the log ends within one line of 2 MB. With the fix it passes. - The debug-log, runtime, routes, storage, rebuild-job, reconciliation-recall, extraction-reliability and installation suites passed on the first release commit, as did the package typecheck, format and lint, and the catalog, locale and release-notes checks. - After merging `staging` at e8425d544 and releasing as 1.4.82, the rebuild is clean, and format and lint, the package typecheck, the catalog, locale and release-notes checks and the debug-log suite pass. Hosted CI runs the full regression set on the merge. - Not installed through a running Engine; the installation suite installs the rebuilt archive. ## Documentation impact - [ ] No documentation changes needed - [ ] Updated this README catalog and package guidance - [ ] Updated linked Marinara Engine documentation ## UI evidence (if applicable) No UI change. 🤖 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-23 04:03:09 +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#1561
No description provided.