-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Bug Description
PR #688 fixed the auto-recall timeout issue in examples/openclaw-memory-plugin/index.ts by wrapping the recall logic with withTimeout(). However, the plugin code was later moved to examples/openclaw-plugin/index.ts, and the fix was not synchronized to the new location.
The current code in examples/openclaw-plugin/index.ts (main branch) still has the same bug:
autoRecallTimeoutMs = 5_000is defined but never usedwithTimeoutis imported but not called in the auto-recall path- If the OpenViking HTTP calls hang (e.g., during transient connection issues), the
before_prompt_buildhook blocks indefinitely, causing total agent silence
Steps to Reproduce
- Use the plugin from
examples/openclaw-plugin/directory - Configure with
autoRecall: true - Have OpenViking server in a transient state (e.g., shortly after gateway restart)
- Send a message to the agent
- Agent hangs silently at
before_prompt_buildhook
Expected Behavior
If auto-recall does not complete within autoRecallTimeoutMs (5 seconds), the hook should:
- Time out gracefully
- Log a warning
- Allow the agent to start without memory context
Actual Behavior
The hook blocks indefinitely. No response is ever sent to the user.
Root Cause
PR #688 applied the fix to examples/openclaw-memory-plugin/index.ts, but the plugin was later refactored/moved to examples/openclaw-plugin/index.ts without carrying over the timeout protection.
Proposed Fix
Apply the same fix from PR #688 to examples/openclaw-plugin/index.ts:
// Current code (line ~439):
if (cfg.autoRecall && queryText.length >= 5) {
const precheck = await quickRecallPrecheck(...);
if (!precheck.ok) {
// skip
} else {
try {
// ← No timeout protection here
const candidateLimit = ...
const [userSettled, agentSettled] = await Promise.allSettled([...]);
// ... more awaits
} catch (err) {
api.logger.warn(...);
}
}
}
// Should be:
if (cfg.autoRecall && queryText.length >= 5) {
const precheck = await quickRecallPrecheck(...);
if (!precheck.ok) {
// skip
} else {
try {
await withTimeout(
(async () => {
// ← Wrap entire recall logic in IIFE
const candidateLimit = ...
const [userSettled, agentSettled] = await Promise.allSettled([...]);
// ... more awaits
})(),
autoRecallTimeoutMs,
`openviking: auto-recall timed out after ${autoRecallTimeoutMs}ms`,
);
} catch (err) {
api.logger.warn(`openviking: auto-recall failed or timed out: ${String(err)}`);
}
}
}Additional Context
- This is the same bug as [Bug]: memory-openviking plugin before_agent_start auto-recall hangs indefinitely, causing total silent agent failure #673, but affecting the refactored plugin directory
- Impact: Critical — any transient connection issue causes complete, permanent agent silence
- Workaround: Set
autoRecall: falsein plugin config
Metadata
Metadata
Assignees
Labels
Type
Projects
Status