Skip to content

MESA v0.6.0

Choose a tag to compare

@Yasou13 Yasou13 released this 17 Jul 07:19
· 872 commits to main since this release

MESA v0.6.0: Comprehensive Audit Remediation

This release addresses 49 findings identified during the MESA architectural and security audit. It introduces critical security patches, data integrity enforcements across the storage layers, and the final deprecation of legacy interfaces.

⚠️ Breaking Changes:

  • API Authentication: Client integrations must now use the X-API-Key header standard instead of Bearer tokens.
  • Storage Layer: All legacy StorageFacade endpoints and methods have been permanently removed and unified under MemoryDAO.
  • Search Schema: SearchResultItem payloads now mandate the inclusion of content_payload.

🔴 Critical Security & Integrity Fixes

  • [R-01] IDOR Prevention: Added strict agent_id validation to soft_delete and hard_delete methods in vector_engine.py to prevent unauthorized vector manipulation.
  • [R-02] ASCII Date Comparison: Fixed SQLite DELETE queries during soft-delete purging to strictly cast and compare valid datetime objects.
  • [R-03] Dual-Write Saga Safety: Implemented _atomic_saga_commit in dao.py. SQLite commits are now strictly deferred until asynchronous Vector and Graph engine writes succeed, rolling back upon failure to prevent split-brain anomalies.
  • [R-04 & R-11] Endpoint Security: Applied Depends(get_api_key) decorators to /v3/health and /v3/demo/chat to close unauthenticated DoS and unauthorized access vectors.
  • [R-05] XSS/Data Sanitization: Enforced _sanitize_payload universally across all DAO read operations, filtering content and content_payload through sanitize_cmb_content before returning data.
  • [R-07] KùzuDB Connection Leaks: Enclosed KùzuDB execute operations within try/finally blocks, ensuring QueryResult objects are deterministically closed for read-only queries to prevent lock exhaustion.
  • [R-10] Prompt Injection Guard: Removed agent_id from MCP tool arguments. The system now strictly reads MESA_AGENT_ID from environment variables, preventing LLM impersonation attacks.

🟠 High Priority Performance & Reliability

  • [R-12] Graceful Shutdown Leaks: Added cancel_futures=True to the ThreadPoolExecutor.shutdown call in vector_engine.py to prevent thread hangs during teardown.
  • [R-13] CrossEncoder OOM Prevention: Bound the reranker.py thread pool strictly to max_workers=1, preventing Out-Of-Memory exceptions during high-concurrency retrieval spikes.
  • [R-15] N+1 Ingestion Bottleneck: Refactored REBEL triplet ingestion to utilize compute_embedding_batch prior to loops, eliminating N+1 embedding call overhead.
  • [R-17] Observability: Integrated dynamic LangFuse/LangSmith telemetry tracing via mesa_memory/observability/tracer.py attached to the FastAPI lifespan.
  • [R-18] Non-Idempotent Retry Safety: Disabled automatic retry mechanisms for non-idempotent HTTP methods (e.g., POST) in the MESA client SDK to prevent data duplication on timeout.

🟡 Medium Priority Logic & Workflow

  • [R-20] Cold-Start Hydration: Fixed ValenceMotor initialization by injecting storage=self.dao, allowing successful retrieval of pre-existing embeddings from LanceDB during startup.
  • [R-21] Utility & Novelty Filtering: Overhauled the compute_memory_valence algorithm to evaluate composite fitness (novelty + utility). Data scoring below 0.3 is now decisively discarded to prevent vector bloat.
  • [R-23] DLQ Reprocessing: Implemented a background worker for Dead Letter Queue (DLQ) records to automatically retry failed asynchronous consolidation tasks.
  • [R-25] Hybrid Search Latency: Transitioned FTS5 lexical queries to execute fully asynchronously in parallel with Vector and Graph retrieval via asyncio.gather.
  • [R-26] LLM Judge Determinism: Introduced ensemble_size=3 and majority voting to llm_judge.py to enforce self-consistency in benchmark evaluations.
  • [R-27] Legal Mode CI/CD Check: Added explicit cost/latency telemetry for legal_domain_mode and integrated legal_audit.py into the gatekeeper.py CI/CD pipeline to detect graph poisoning.

🟢 Maintenance, Deprecation & Docs

  • [R-30] Flaky Tests Removed: Stripped non-deterministic asyncio.sleep calls from tests, replacing them with proper event loop yielding (sleep(0)) or direct mock assertions.
  • [R-31] Secure Installer: Refactored install.sh to download fully to /tmp/ before execution, removing the unsafe curl | sh pattern.
  • [R-34] Deep Health Validation: Replaced the superficial readiness flag in /health/init with deep driver-level validations, including a live MATCH (n) test against the graph engine.
  • [R-33 & R-43 to R-49] Legacy Code Purge: Completely removed all residual StorageFacade logic, unused schema functions, and dead code artifacts from the codebase and test suite.
  • [R-35] Dynamic Maintenance: Transitioned VACUUM scheduling to rely on the MESA_VACUUM_HOURS environment variable for better DevOps control.