- [x] Add AST-aware code chunking for Go, Python, and TypeScript using tree-sitter
- [x] Implement LEANN-inspired hybrid vector storage with hub detection and selective embedding storage (60-80% savings)
- [x] Add observation relationship graph with CSR format and edge detection (file overlap, semantic similarity, temporal, concept)
- [x] Implement graph-aware search with two-level traversal and relationship-based ranking
- [x] Add auto-tuning system for dynamic hub threshold adjustment based on query performance
- [x] Add comprehensive metrics tracking for vector storage, queries, latency, and graph traversals
- [x] Update configuration system with graph and hybrid storage settings
- [x] Add graph stats and vector metrics endpoints to worker service
- [x] Enhance UI sidebar with advanced metrics display and graph visualization
- [x] Optimize struct field alignment throughout codebase for memory efficiency
- [x] Update documentation with LEANN Phase 2 features and performance benefits
- [x] Add tree-sitter dependency for AST parsing
Fix 1: HTTP Server timeouts (service.go)
- Added IdleTimeout: 120s - closes idle keep-alive connections
- Added ReadTimeout: 30s - prevents hung connections waiting for request data
Fix 2: SSE dead client cleanup (broadcaster.go) - This was the real leak
- Bug: When Write() failed on a disconnected client, it just logged and continued - the dead client stayed in the clients map forever
- Effect: Dead clients accumulated and every Broadcast() call would try (and fail) to write to them
- Fix: Now tracks failed writes and removes dead clients from the map
The SSE bug was likely the main cause. Every time a browser tab closed or connection dropped, the client stayed registered. On each broadcast (processing status updates happen frequently), it would try to write to dead connections, fail, but never clean up.