-
-
Notifications
You must be signed in to change notification settings - Fork 1
Bug: _store_problem_to_chromadb uses threading with async collection — coroutine never awaited #2017
Description
Problem
`autobot-backend/api/codebase_analytics/scanner.py:695` — `_store_problem_to_chromadb()` wraps an async collection method in a thread executor:
```python
await _run_in_indexing_thread(
lambda: collection.add(
ids=[...],
documents=[...],
metadatas=[...],
)
)
```
If `collection` is an async ChromaDB collection (from `get_or_create_collection` on an async client), then `collection.add()` returns a coroutine, not the actual result. The lambda executes in a thread pool via `run_in_executor`, which calls the lambda and gets back the coroutine object — but never `await`s it. The data is silently never stored.
Discovered During
Working on #1712 (analytics empty sections investigation).
Current Impact
Low — This function appears to be unused in current code paths. The batch version `_store_problems_batch_to_chromadb()` (line 775) correctly uses `await collection.upsert()` and is what the scan pipeline actually calls. However, the individual function remains as dead/broken code that could cause silent data loss if called.
Fix
Either:
- Remove the function if truly unused
- Fix to use `await collection.add()` directly instead of threading