fix(plugin): wrap auto-recall in withTimeout to prevent indefinite agent hang#688
Merged
qin-ctx merged 1 commit intovolcengine:mainfrom Mar 17, 2026
Merged
Conversation
…ent hang The before_agent_start hook calls OpenViking's search API for auto-recall before every agent run. The Promise.allSettled calls and subsequent getClient() calls had no timeout protection - if the HTTP calls hang (e.g. during initialization or after gateway restart), the entire agent pipeline blocks indefinitely with no timeout, no error, and no fallback. This wraps the auto-recall block with the existing withTimeout utility using a 5-second timeout (AUTO_RECALL_TIMEOUT_MS). On timeout, a warning is logged and the agent starts without memory context. Fixes volcengine#673 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
qin-ctx
approved these changes
Mar 17, 2026
Contributor
Author
|
Thanks for the quick review and merge, @qin-ctx. |
Jah-yee
added a commit
to Jah-yee/OpenViking
that referenced
this pull request
Mar 18, 2026
Fixes issue volcengine#748 - The auto-recall logic in examples/openclaw-plugin/index.ts was missing timeout protection, causing the agent to hang indefinitely if OpenViking HTTP calls hang during transient connection issues. This fix: - Imports withTimeout from process-manager.js - Adds AUTO_RECALL_TIMEOUT_MS constant (5000ms) - Wraps the entire auto-recall block in withTimeout - Updates catch block to mention 'timed out' for clarity This is the same fix that was applied to openclaw-memory-plugin in PR volcengine#688.
Jah-yee
pushed a commit
to Jah-yee/OpenViking
that referenced
this pull request
Mar 18, 2026
PR volcengine#688 fixed timeout issue in openclaw-memory-plugin but the plugin was later refactored to openclaw-plugin without carrying over the fix. This adds: 1. Import withTimeout from process-manager 2. Define autoRecallTimeoutMs constant (5000ms) 3. Wrap entire auto-recall logic in withTimeout to prevent indefinite blocking during transient connection issues Fixes: volcengine#748
Jah-yee
added a commit
to Jah-yee/OpenViking
that referenced
this pull request
Mar 18, 2026
Apply same fix from PR volcengine#688 to examples/openclaw-plugin/index.ts: - Add AUTO_RECALL_TIMEOUT_MS constant (5 seconds) - Wrap auto-recall block with withTimeout to prevent indefinite hangs - Update error message to mention 'timed out' for clarity This fixes issue volcengine#748 - if OpenViking HTTP calls hang during transient connection issues, the before_prompt_build hook now times out gracefully instead of blocking indefinitely. Fixes volcengine#748
qin-ctx
added a commit
that referenced
this pull request
Mar 19, 2026
PR #662 renamed the plugin directory and rewrote index.ts from a stale branch base, silently dropping two merged bug fixes: - #681: share pending clientPromise across dual-context registrations to prevent before_agent_start hook from hanging forever - #688: wrap auto-recall search in withTimeout(5s) to prevent indefinite agent hang when OpenViking search API is slow or unresponsive
19 tasks
chenjw
pushed a commit
that referenced
this pull request
Mar 19, 2026
…rge (#779) PR #662 renamed the plugin directory and rewrote index.ts from a stale branch base, silently dropping two merged bug fixes: - #681: share pending clientPromise across dual-context registrations to prevent before_agent_start hook from hanging forever - #688: wrap auto-recall search in withTimeout(5s) to prevent indefinite agent hang when OpenViking search API is slow or unresponsive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
before_agent_starthook in the memory plugin calls OpenViking's search API for auto-recall before every agent run. ThePromise.allSettledcalls and subsequentgetClient()calls had no timeout protection. If the HTTP calls hang (during initialization, after gateway restart, or due to transient network issues), the entire agent pipeline blocks indefinitely - no timeout, no error, no fallback.The file already imports
withTimeoutfromprocess-manager.tsbut never uses it in the recall path. This PR wraps the auto-recall block withwithTimeoutusing a 5-second timeout (AUTO_RECALL_TIMEOUT_MS). On timeout, a warning is logged and the agent starts without memory context instead of hanging forever.Changes
AUTO_RECALL_TIMEOUT_MS = 5_000constantPromise.allSettledthrough memory injection) inwithTimeoutFixes #673
This contribution was developed with AI assistance (Claude Code).
Test plan