Error Handling & Code Quality
This patch release resolves error handling anti-patterns across the entire codebase (91 files), improving resilience and correctness.
Bug Fixes
- OpenRouterAgent: Restored assistant replies to
conversationHistory— multi-turn context was lost after method extraction (#2078) - ChromaSync: Fixed cross-type dedup collision where
observation#N,session_summary#N, anduser_prompt#Ncould silently drop results - Timeline queries: Fixed logger calls wrapping Error inside an object instead of passing directly
- FTS migrations: Preserved non-Error failure details instead of silently dropping them
Error Handling Improvements
- Replaced 301 error handling anti-patterns across 91 files:
- Narrowed overly broad try-catch blocks into focused error boundaries
- Replaced unsafe
error as Errorcasts withinstanceofchecks - Added structured error logging where catches were previously empty
- Extracted large try blocks into dedicated helper methods
- Installer resilience: Moved filesystem operations (
mkdirSync) inside try/catch in Cursor, Gemini CLI, Goose MCP, and OpenClaw installers to maintain numeric return-code contracts - GeminiCliHooksInstaller: Install/uninstall paths now catch
readGeminiSettings()failures instead of throwing past the0/1return contract - OpenClawInstaller: Malformed
openclaw.jsonnow throws instead of silently returning{}and potentially wiping user config - WindsurfHooksInstaller: Added null-safe parsing of
hooks.jsonwith optional chaining - McpIntegrations: Goose YAML updater now throws when claude-mem markers exist but regex replacement fails
- EnvManager: Directory setup and existing-file reads are now wrapped in structured error logging
- WorktreeAdoption:
adoptedSqliteIdsmutation delayed until SQL update succeeds - Import script: Guard against malformed timestamps before
toISOString() - Runtime CLI: Guard
response.json()parsing with controlled error output
Documentation
- Added README for Docker claude-mem harness