Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion examples/openclaw-plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
IS_WIN,
waitForHealth,
quickRecallPrecheck,
withTimeout,
resolvePythonCommand,
prepareLocalPort,
} from "./process-manager.js";
Expand Down Expand Up @@ -414,7 +415,17 @@ const contextEnginePlugin = {

const hookSessionId = ctx?.sessionId ?? ctx?.sessionKey ?? "";
const resolvedAgentId = resolveAgentId(hookSessionId);
const client = await getClient();
let client: OpenVikingClient;
try {
client = await withTimeout(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Suggestion] (non-blocking)

The 5-second timeout is hardcoded. While this is reasonable for most environments, consider making it configurable (e.g., add a clientInitTimeoutMs config option with a default of 5000ms).

This would help users with slower environments (low-performance machines, large model loading) where service startup may take longer.

That said, the current behavior is acceptable: if timeout occurs, only the first auto-recall is skipped; subsequent messages work fine once the service is ready. Not a blocking issue.

getClient(),
5000,
"openviking: client initialization timeout (OpenViking service not ready yet)"
);
} catch (err) {
api.logger.warn?.(`openviking: failed to get client: ${String(err)}`);
return;
}
if (resolvedAgentId && client.getAgentId() !== resolvedAgentId) {
client.setAgentId(resolvedAgentId);
api.logger.info(`openviking: switched to agentId=${resolvedAgentId} for before_prompt_build`);
Expand Down