Skip to content

fix: add withTimeout protection to auto-recall in openclaw-plugin#752

Open
Jah-yee wants to merge 1 commit intovolcengine:mainfrom
Jah-yee:fix/openclaw-plugin-timeout-protection
Open

fix: add withTimeout protection to auto-recall in openclaw-plugin#752
Jah-yee wants to merge 1 commit intovolcengine:mainfrom
Jah-yee:fix/openclaw-plugin-timeout-protection

Conversation

@Jah-yee
Copy link

@Jah-yee Jah-yee commented Mar 18, 2026

Summary

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 refactored to examples/openclaw-plugin/index.ts, and the fix was not synchronized to the new location.

Changes

  1. Import withTimeout from process-manager.ts
  2. Define autoRecallTimeoutMs constant (5000ms)
  3. Wrap entire auto-recall logic in withTimeout to prevent indefinite blocking during transient connection issues

Impact

  • Critical: Any transient connection issue causes complete, permanent agent silence without this fix
  • With timeout protection, the hook will timeout gracefully after 5 seconds and allow the agent to start without memory context

Testing

  • Build: npm run build in examples/openclaw-plugin/
  • Manual test: Configure with autoRecall: true, have OpenViking server in transient state, send message to agent

Fixes: #748

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
@qin-ctx
Copy link
Collaborator

qin-ctx commented Mar 19, 2026

cc @Mijamind719

Copy link
Contributor

@qin-ptr qin-ptr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a high-quality bugfix that addresses a critical regression issue.

Summary

PR #688 previously added timeout protection to auto-recall in openclaw-memory-plugin, but the fix was not synchronized when the plugin was refactored to openclaw-plugin. This PR applies the same timeout protection using the validated withTimeout() pattern.

Analysis

Design Validation:

  • ✅ Problem is real: withTimeout imported but not used in auto-recall path
  • ✅ Root cause correctly identified: missing timeout wrapper causes indefinite blocking
  • ✅ Solution at correct layer: timeout protection in hook allows graceful degradation
  • ✅ Reuses existing mechanism: withTimeout from process-manager.ts (verified in PR #688)
  • ✅ Complete lifecycle: timeout throws error → caught → logged → agent continues

Code Correctness:

  • ✅ IIFE properly wraps entire auto-recall logic
  • ✅ 5-second timeout value validated in PR #688
  • ✅ Error message updated to mention "timed out"
  • ✅ No breaking changes, fully backward compatible

Testing:

  • Manual test plan provided in PR description
  • Same fix pattern used successfully in openclaw-memory-plugin

No issues found. Excellent work maintaining consistency with the previous fix!

🤖 I am a bot owned by @qin-ctx.

@wlff123
Copy link
Contributor

wlff123 commented Mar 19, 2026

A timeout mechanism is implemented in requests; please reuse this logic?
examples/openclaw-plugin/client.ts:
private async request(path: string, init: RequestInit = {}): Promise {
const controller = new AbortController();
const timer = setTimeout(() => controller.abort(), this.timeoutMs);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

[Bug]: examples/openclaw-plugin/index.ts missing withTimeout protection (same as #673)

4 participants