LearnNewsExamplesServices
Frontmatter
id9762
titleStabilize Sandman Inference Pipeline & Fix SQLite Race Conditions
stateClosed
labels
bugaiperformance
assigneestobiu
createdAtApr 7, 2026, 9:35 PM
updatedAtApr 7, 2026, 9:37 PM
githubUrlhttps://github.com/neomjs/neo/issues/9762
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtApr 7, 2026, 9:37 PM

Stabilize Sandman Inference Pipeline & Fix SQLite Race Conditions

Closedbugaiperformance
tobiu
tobiu commented on Apr 7, 2026, 9:35 PM

Description

The autonomous REM sleep pipeline (Sandman) stalls and occasionally crashes due to VRAM starvation and a race condition during SQLite matrix initialization.

Issues Identified

  1. Dynamic Context Scaling: Statically assigning num_ctx: 200000 causes OS VRAM starvation on smaller/medium payloads and massive context ingestion latency.
  2. Capability Gap Prompt Thinning: Passing 7500+ paths from the workspace tree into the context per node evaluation causes sequence bottlenecks.
  3. HTTP Timeouts: Using native fetch() encounters undocumented 5-minute timeout caps from undici during heavy local LLM processing.
  4. SQLite Race Condition: Concurrent async operations during local matrix initialization triggered UNIQUE constraint failed: vector_collections_meta.name.

Proposed Fixes

  • Dynamically allocate KV cache with Math.ceil(chars / 3) + 4096.
  • Implement strict semantic fuzzy matching to limit directory contexts.
  • Swap fetch() for native http/https to enforce explicit 1-hour timeouts for Ollama backend calls.
  • Implement INSERT OR IGNORE INTO in SQLiteVectorManager.mjs to handle concurrent discoveries gracefully.
tobiu added the bug label on Apr 7, 2026, 9:35 PM
tobiu added the ai label on Apr 7, 2026, 9:35 PM
tobiu added the performance label on Apr 7, 2026, 9:35 PM
tobiu referenced in commit dbfabd5 - "fix(Sandman): Stabilize REM inference pipeline and fix SQLite race conditions (#9762)" on Apr 7, 2026, 9:37 PM
tobiu assigned to @tobiu on Apr 7, 2026, 9:37 PM
tobiu
tobiu Apr 7, 2026, 9:37 PM

Deployed in #9762. The autonomous pipeline is fully stabilized and processing the backlog with extreme efficiency. Verified that Cap Gap and Tri-Vector cycles succeed and loop safely on huge 3K char payloads seamlessly.

tobiu closed this issue on Apr 7, 2026, 9:37 PM