Repository navigation
MESA v0.6.0
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.
- API Authentication: Client integrations must now use the
X-API-Keyheader standard instead ofBearertokens. - Storage Layer: All legacy
StorageFacadeendpoints and methods have been permanently removed and unified underMemoryDAO. - Search Schema:
SearchResultItempayloads now mandate the inclusion ofcontent_payload.
🔴 Critical Security & Integrity Fixes
- [R-01] IDOR Prevention: Added strict
agent_idvalidation tosoft_deleteandhard_deletemethods invector_engine.pyto prevent unauthorized vector manipulation. - [R-02] ASCII Date Comparison: Fixed SQLite
DELETEqueries during soft-delete purging to strictly cast and compare validdatetimeobjects. - [R-03] Dual-Write Saga Safety: Implemented
_atomic_saga_commitindao.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/healthand/v3/demo/chatto close unauthenticated DoS and unauthorized access vectors. - [R-05] XSS/Data Sanitization: Enforced
_sanitize_payloaduniversally across all DAO read operations, filteringcontentandcontent_payloadthroughsanitize_cmb_contentbefore returning data. - [R-07] KùzuDB Connection Leaks: Enclosed KùzuDB
executeoperations withintry/finallyblocks, ensuringQueryResultobjects are deterministically closed for read-only queries to prevent lock exhaustion. - [R-10] Prompt Injection Guard: Removed
agent_idfrom MCP tool arguments. The system now strictly readsMESA_AGENT_IDfrom environment variables, preventing LLM impersonation attacks.
🟠 High Priority Performance & Reliability
- [R-12] Graceful Shutdown Leaks: Added
cancel_futures=Trueto theThreadPoolExecutor.shutdowncall invector_engine.pyto prevent thread hangs during teardown. - [R-13] CrossEncoder OOM Prevention: Bound the
reranker.pythread pool strictly tomax_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_batchprior to loops, eliminating N+1 embedding call overhead. - [R-17] Observability: Integrated dynamic LangFuse/LangSmith telemetry tracing via
mesa_memory/observability/tracer.pyattached 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
ValenceMotorinitialization by injectingstorage=self.dao, allowing successful retrieval of pre-existing embeddings from LanceDB during startup. - [R-21] Utility & Novelty Filtering: Overhauled the
compute_memory_valencealgorithm to evaluate composite fitness (novelty + utility). Data scoring below0.3is 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=3and majority voting tollm_judge.pyto enforce self-consistency in benchmark evaluations. - [R-27] Legal Mode CI/CD Check: Added explicit cost/latency telemetry for
legal_domain_modeand integratedlegal_audit.pyinto thegatekeeper.pyCI/CD pipeline to detect graph poisoning.
🟢 Maintenance, Deprecation & Docs
- [R-30] Flaky Tests Removed: Stripped non-deterministic
asyncio.sleepcalls from tests, replacing them with proper event loop yielding (sleep(0)) or direct mock assertions. - [R-31] Secure Installer: Refactored
install.shto download fully to/tmp/before execution, removing the unsafecurl | shpattern. - [R-34] Deep Health Validation: Replaced the superficial readiness flag in
/health/initwith deep driver-level validations, including a liveMATCH (n)test against the graph engine. - [R-33 & R-43 to R-49] Legacy Code Purge: Completely removed all residual
StorageFacadelogic, 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_HOURSenvironment variable for better DevOps control.