[Bug] Concurrent VLM calls during multi-session memory extraction cause 429 rate-limit errors
Bug Description
When multiple sessions commit simultaneously, OV triggers parallel memory extraction for each session. Each extraction spawns 3 concurrent VLM calls (summary + long-term + execution). With multiple sessions committing at once, this produces a burst of VLM API calls that exceeds rate limits.
The vlm.max_concurrent config only controls the semantic queue worker concurrency — it does not throttle memory extraction VLM calls.
Impact
In a multi-agent Hermes deployment with 20 profiles:
- Multiple sessions commit within seconds of each other
- Each commit triggers 3 parallel VLM calls
- VLM API (GLM-4.7) returns 429 rate-limit errors
- Failed extractions produce
.failed.jsonfiles - Memories are silently lost — the session is marked as processed but extraction failed
Reproduction
- Deploy OV with 3+ active sessions
- Trigger commits on all sessions simultaneously (e.g., after a batch of conversations)
- Observe VLM 429 errors in logs
- Check for
.failed.jsonfiles in the data directory
Workaround Applied
We patched OV source code to add a global asyncio Semaphore(1) around VLM calls in vlm/base.py and openai_vlm.py. This serializes all VLM calls system-wide, preventing rate-limit errors but significantly slowing memory extraction throughput.
The proper fix would be to:
- Apply
vlm.max_concurrentto memory extraction calls (not just semantic queue) - Add retry-with-backoff for 429 responses
- Queue extractions instead of spawning concurrent tasks per session
Environment
- OpenViking: 0.4.5+
- VLM: GLM-4.7 (via zai coding endpoint)
- Multi-agent: 20 Hermes profiles, ~10 active sessions at peak
- Observed: 6
.failed.jsonfiles in a single day before patch
Source: volcengine/OpenViking