LearnNewsExamplesServices
Frontmatter
id9942
titlebug(ai): Resolve local inference 4096 n_ctx Exhaustion During Session Summarization
stateClosed
labels
bugaicore
assigneestobiu
createdAtApr 12, 2026, 9:31 PM
updatedAtApr 12, 2026, 11:39 PM
githubUrlhttps://github.com/neomjs/neo/issues/9942
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtApr 12, 2026, 10:36 PM

bug(ai): Resolve local inference 4096 n_ctx Exhaustion During Session Summarization

tobiu
tobiu commented on Apr 12, 2026, 9:31 PM

Context

When the Memory service attempts to summarize a massive session (e.g., ones with over 50-100 interactions), it joins all memory documents into a single aggregatedContent payload. For Local LLMs running with a default n_ctx limit of 4096, this payload throws an Out-Of-Memory / context length exceeded error. Because the loop executing the batch in SessionService.summarizeSessions() lacks granular try/catch protection for individual session iterations, a single context length violation permanently halts the entire digestion daemon. This is why the session collection currently has 0 records after the vector DB engine swap.

Objectives

  1. Implement a safe truncation envelope (MAX_PAYLOAD_LENGTH) inside SessionService.summarizeSession(), slicing the middle out of oversized sessions to preserve original prompt context and final outcomes.
  2. Wrap the LLM generateContent block inside an internal try/catch within the batch iterator, ensuring that if a session summary fails, it isolates the failure and allows processUndigestedSessions to continue processing the remaining batches.
tobiu cross-referenced by PR #9943 on Apr 12, 2026, 10:14 PM
tobiu cross-referenced by PR #9944 on Apr 12, 2026, 10:36 PM