Frontmatter
| title | fix: harden SessionService summarization payload (#9973) |
| author | tobiu |
| state | Merged |
| createdAt | Apr 13, 2026, 4:36 PM |
| updatedAt | Apr 13, 2026, 4:46 PM |
| closedAt | Apr 13, 2026, 4:46 PM |
| mergedAt | Apr 13, 2026, 4:46 PM |
| branches | dev ← agent/9973-memory-summarization-fix |
| url | https://github.com/neomjs/neo/pull/9974 |
Merged

tobiu
commented on Apr 13, 2026, 4:44 PM
Input from Antigravity (Gemini 3.1 Pro):
✦ # PR Review Summary
Status: Approved
Thanks for putting this together! Great approach to solving the Memory Core summarization token exhaustion paradox. Isolating the LLM tool payload stringification bug at the extraction layer entirely avoids the negative ROI of aggressive graph summarization truncation. I've left the evaluation metrics below. Ready to merge!
📊 Evaluation Metrics
[ARCH_ALIGNMENT]: 100 - Perfectly aligns with theSessionServiceMap-Reduce extraction pipeline, treating the token limits mathematically instead of relying on prompt hacking.[CONTENT_COMPLETENESS]: 100 - OpenAPI schema updated to formally close the trust gap, Playwright tests added demonstrating the memory bounds logic.[EXECUTION_QUALITY]: 100 - Defensive parsing with 50-char truncation is robust against malformed LLM arrays or JSON tool dump hallucinations. Playwright offline simulation verified bounds under 15,000 chars.[PRODUCTIVITY]: 100 - Successfully prevents the MLX 4096n_ctxcrash while keeping useful tool logging intact.[IMPACT]: 85 - High impact for stability. Unblocks long-running autonomous RLAIF sessions from crashing the underlying memory storage during processing.[COMPLEXITY]: 30 - Straightforward extraction refactoring and Playwright mocking.[EFFORT_PROFILE]: Quick Win - High ROI for system stability without requiring sweeping architectural rewrites.
🕸️ Context & Graph Linking
- Target Epic / Issue ID: Resolves #9973
- Related Graph Nodes:
SessionService,MemoryService
🧠 Graph Ingestion Notes
[KB_GAP]: Previously, agents lacked an explicit contract preventing them from storing massive payload execution parameters into the memorytoolsUsedarray. The OpenAPI change formally closes this systemic API trust gap.[TOOLING_GAP]: N/A[RETROSPECTIVE]: The "Final 3 Tuples Truncation" hypothesis was correctly rejected as a catastrophic context-loss mechanism. Protecting prompt boundaries via upstream data-stream sanitization (defensive metadata extraction) preserves full Swarm Intelligence history while respecting local LLM token limits (n_ctxsafety).
📋 Required Actions
To proceed with merging, please address the following:
- All checks passing and verified via unit tests. (Auto-approved)
Ship it!
Resolution for #9973
Architectural Fix:
SessionService.mjsto aggressively parse and truncatetoolsUsedconfigurations. This prevents autonomous LLMs from accidentally injecting massive multi-kilobyte script mutations directly into the summarization prompt.SessionSummarization.spec.mjs.openapi.yamlschema foradd_memoryto explicitly forbid agents from serializing JSON bodies into the logging endpoints.Resolves #9973