Skip to content

fix(memory): spreading activation BFS fails — ESCAPE clause has 2 chars instead of 1 #2393

@bug-ops

Description

@bug-ops

Summary

Spreading activation fails on every agent turn when graph memory has entities.

Reproduction

Start agent with [memory.graph] enabled = true and any non-empty conversation.
Observed in CI-271 (2026-03-29, v0.18.0):

WARN spreading activation recall failed: database error: error returned from database: (code: 1) ESCAPE expression must be a single character

Root Cause

File: crates/zeph-memory/src/graph/store/mod.rs:1081

Introduced in PR #2371 (Phase 1 DB abstraction). The LIKE ESCAPE clause was changed from:

WHERE a.alias_name LIKE ?2 ESCAPE '\\' COLLATE NOCASE   -- old (sqlx named params)

to:

WHERE a.alias_name LIKE ? ESCAPE '\\\\' {}            -- new — BUG: 4 backslashes in Rust = 2 in SQL

SQLite requires ESCAPE clause to be exactly 1 character. Other ESCAPE clauses in the same file were correctly migrated (ESCAPE '\\' → 1 char in SQL), but this one was doubled.

Fix: Change line 1081 from ESCAPE '\\\\' to ESCAPE '\\'.

Impact

  • Spreading activation fails silently on every agent turn
  • Graph-based memory recall is degraded (BFS aliases query fails)
  • Agent continues working via fallback (no crash), but graph memory is non-functional

Priority

P1 — regression in v0.18.0, affects all users with graph memory enabled.

Metadata

Metadata

Assignees

Labels

P1High ROI, low complexity — do next sprintbugSomething isn't workingmemoryzeph-memory crate (SQLite)

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions