Auto-consolidation runs up to 32 concurrent recalls in the API process and ignores enable_auto_consolidation when re-queuing
Summary
Auto-consolidation runs up to consolidation_llm_batch_size × consolidation_llm_parallelism (8 × 4 = 32) recall_async calls concurrently inside the API process, each holding up to recall_connection_budget (4) DB connections. On a deployment with a modest pool this starves user recalls (Failed to search memories (TimeoutError) after the 30 s acquire timeout) and the consolidation batches themselves. In addition, a round that hits consolidation_max_memories_per_round re-submits itself immediately with no pacing, and enable_auto_consolidation=false does not stop an in-flight chain.
Version
hindsight-api-slim 1.0.0; bank with ~450k facts, >200k unconsolidated.
Where
hindsight_api/engine/consolidation/consolidator.py~L2371-2385: per-batchasyncio.gatherofrecall_asyncfor every fact; ~L2018-2036 group parallelism; no dedicated bound (engine_search_semaphoreis 32).- ~L2051-2078: on round limit →
submit_async_consolidationimmediately; no check ofenable_auto_consolidation.memory_engine.pytask handler (~L4280-4330) does not check it either. Onlyenable_observations=falsebreaks the chain. - ~L1396
_COUNT_LIMIT = 100_000makes progresstotala hard cap, soprocessed: 100 / total: 100000is shown forever. - Stats:
observations_mergedis unreachable (dedup folds are counted ascreated, ~L2719-2727 / 2759-2768).
Observed
281 consolidation operations/day (one every ~5 min, 100 memories each), 39 failed with Failed to search memories (TimeoutError), user recall latency 4–14 s, with HINDSIGHT_API_DB_POOL_MAX_SIZE=5.
Expected
A dedicated, configurable concurrency bound for consolidation recalls; honor enable_auto_consolidation when re-queuing; optional requeue delay.
Reference fix
https://github.com/choi138/hindsight/tree/fix/consolidation-recall-concurrency (commit 17624f46b): adds HINDSIGHT_API_CONSOLIDATION_RECALL_MAX_CONCURRENT (default 4) and HINDSIGHT_API_CONSOLIDATION_REQUEUE_DELAY_SECONDS (default 0), gates automatic requeue/handler on enable_auto_consolidation while letting explicit /consolidate runs drain fully, and fixes the merged accounting. 8 new tests; existing consolidation suites pass (158).