Critical Bug Fix: Worker Initialization Failure
v9.1.0 was unable to initialize its database on existing installations. This patch fixes the root cause and several related issues.
Bug Fixes
-
Fix FOREIGN KEY constraint failure during migration — The
addOnUpdateCascadeToForeignKeysmigration (schema v21) crashed when orphaned observations existed (observations whosememory_session_idhas no matching row insdk_sessions). Fixed by disabling FK checks (PRAGMA foreign_keys = OFF) during table recreation, following SQLite's recommended migration pattern. -
Remove hardcoded CHECK constraints on observation type column — Multiple locations enforced
CHECK(type IN ('decision', 'bugfix', ...))but the mode system (v8.0.0+) allows custom observation types, causing constraint violations. Removed all 5 occurrences acrossSessionStore.ts,migrations.ts, andmigrations/runner.ts. -
Fix Express middleware ordering for initialization guard — The
/api/*guard middleware that waits for DB initialization was registered AFTER routes, so Express matched routes before the guard. Moved guard middleware registration BEFORE route registrations. Added dedicated early handler for/api/context/injectto fail-open during init.
New
- Restored mem-search skill — Recreated
plugin/skills/mem-search/SKILL.mdwith the 3-layer workflow (search → timeline → batch fetch) updated for the current MCP tool set.