fix(memory): circuit breaker for Upstash Vector search failures#478
fix(memory): circuit breaker for Upstash Vector search failures#478xlabtg merged 4 commits intoxlabtg:mainfrom
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: xlabtg#477
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: xlabtg#477
|
🤖 AI Work Session Started Starting automated work session at 2026-05-05T17:07:44.531Z The PR has been converted to draft mode while work is in progress. This comment marks the beginning of an AI work session. Please wait for the session to finish, and provide your feedback. |
…press log spam on repeated failures When Upstash Vector is temporarily unavailable, each semantic search attempt would throw and be caught by HybridSearch, logging a WARN on every request. This adds a 60-second circuit breaker: after the first failure, subsequent searchKnowledge calls return [] silently without hitting the network or flooding logs. The circuit resets automatically after the cooldown and on reconfigure(). Fixes xlabtg#477
Working session summaryDone. Here's a summary of what was done: Root cause: When Upstash Vector backend is unavailable, Fix: Added a 60-second circuit breaker to
Two new tests verify the circuit opens on failure and resets after the cooldown. All 360 memory-module tests pass. PR: #478 This summary was automatically extracted from the AI working session output. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost: $1.125849📊 Context and tokens usage:
Total: (44 new + 75.3K cache writes + 2.2M cache reads) input tokens, 12.0K output tokens, $1.125849 cost 🤖 Models used:
📎 Log file uploaded as Gist (1341KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
This reverts commit 8f964e9.
Summary
Fixes #477
When Upstash Vector backend is temporarily unavailable, the agent was logging a
WARNon every semantic search attempt (which runs on every incoming message), flooding the logs with:Root Cause
HybridSearch.semanticVectorSearchKnowledge()catches every error fromUpstashSemanticVectorStore.searchKnowledge()and logs a WARN. Without any cooldown, this fires on every message when Upstash is down.Fix
Added a 60-second circuit breaker to
UpstashSemanticVectorStore.searchKnowledge():HybridSearchlogs the warning once and falls back to local keyword search).[]immediately — no network call, no repeated log entry.configure()also resets the circuit breaker so reconfiguring the store starts fresh.How to Reproduce / Verify
UPSTASH_VECTOR_REST_URLandUPSTASH_VECTOR_REST_TOKENwith valid credentials.Tests
Added two new test cases to
src/memory/__tests__/vector-store-timeout.test.ts:circuit breaker skips Upstash calls after a failure without re-throwing— verifies the second call within the cooldown returns[]silently without contacting Upstash.circuit breaker resets after the cooldown period— verifies that after 60 seconds the circuit closes and Upstash is contacted again.All 360 memory-module tests pass.