Skip to content

Commit 743525c

Browse files
committed
fix: fallback to config.llm.model when resolveAgentPrimaryModelRef returns undefined
Root cause: When generateReflectionText() is triggered via plugin hooks (dc-channel--...), the plugin-scoped config lacks an 'agents' section. resolveAgentPrimaryModelRef() returns undefined, causing runEmbeddedPiAgent to receive provider=undefined, model=undefined. This falls back to openai/gpt-5.4 (default), which has no API key, resulting in a 56-second timeout before minimal fallback activation. Fix: When resolveAgentPrimaryModelRef returns undefined, fall back to config.llm.model (the MiniMax M2.1 configured in plugin's openclaw.json). This ensures correct model is used for both agent:main (which gets full config and resolveAgentPrimaryModelRef works) and dc-channel--... sessions (which get plugin-scoped config). Fixes the 56-second delay on /reset for dc-channel Discord sessions.
1 parent e3470dc commit 743525c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,8 +1154,9 @@ async function generateReflectionText(params: {
11541154
onLog: onRetryLog,
11551155
execute: async () => {
11561156
const runEmbeddedPiAgent = await loadEmbeddedPiRunner();
1157-
const modelRef = resolveAgentPrimaryModelRef(params.cfg, params.agentId);
1158-
const { provider, model } = modelRef ? splitProviderModel(modelRef) : {};
1157+
const modelRef = resolveAgentPrimaryModelRef(params.cfg, params.agentId)
1158+
?? (((params.cfg as Record<string, unknown>)?.llm as Record<string, unknown>)?.model as string | undefined);
1159+
const { provider, model } = modelRef ? splitProviderModel(modelRef) : { provider: void 0, model: void 0 };
11591160
const embeddedTimeoutMs = Math.max(params.timeoutMs + 5000, 15000);
11601161

11611162
return await withTimeout(

0 commit comments

Comments
 (0)