Bug Description
When /reset or /new is triggered via a Discord channel (e.g., dc-channel--1476858065914695741), the command:reset hook in memory-lancedb-pro calls generateReflectionText(), which internally calls resolveAgentPrimaryModelRef(params.cfg, params.agentId).
For plugin-triggered hooks, OpenClaw core passes a plugin-scoped config to the hook context. This config lacks an agents section (it only contains plugins.entries.memory-lancedb-pro.config.*). When resolveAgentPrimaryModelRef() is called with this config for a dc-channel--... agent ID, it returns undefined because cfg.agents is undefined.
This causes runEmbeddedPiAgent to receive provider=undefined, model=undefined. The Pi runner then falls back to the hard-coded default openai/gpt-5.4, which has no API key configured, resulting in a 56-second timeout before minimal fallback activates.
Steps to Reproduce
- Have a non-agent:main agent configured (e.g., dc-channel--...)
- Trigger
/reset on a Discord channel that uses this agent
- Observe: ~56-second delay before command completes
- Check reflection file — it contains:
(fallback) Reflection generation failed; storing minimal pointer only.
Expected Behavior
/reset completes in normal time (~5-10 seconds) with full reflection content.
Actual Behavior
/reset takes ~56 seconds for non-agent:main agents
- Reflection degrades to minimal pointer (no actual memory content stored)
- Auto-recall also appears slow (cascading effect from the reflection bottleneck)
Root Cause
index.ts line 1157-1158:
const modelRef = resolveAgentPrimaryModelRef(params.cfg, params.agentId);
const { provider, model } = modelRef ? splitProviderModel(modelRef) : {};
When params.cfg is plugin-scoped, resolveAgentPrimaryModelRef returns undefined, causing the cascade to the 56-second timeout.
Impact
- All non-agent:main agents affected (dc-channel--..., codex, review-claw, etc.)
- Memory reflections are degraded to minimal pointers for affected agents
- Auto-recall performance degrades due to reflection bottleneck
Environment
- Plugin: memory-lancedb-pro
- OpenClaw: latest
- Trigger:
command:reset or command:new via Discord channel hook
- Affected agents: all non-agent:main agents
Fix
PR #618 — add fallback to config.llm.model when resolveAgentPrimaryModelRef returns undefined.
Test Results (2026-04-14)
| Scenario |
Before Fix |
After Fix |
| dc-channel /reset time |
~56 seconds |
~5-10 seconds |
| Reflection content |
(fallback) minimal pointer |
Full content |
| Auto-recall |
Slow/timeout |
Normal |
Bug Description
When
/resetor/newis triggered via a Discord channel (e.g.,dc-channel--1476858065914695741), thecommand:resethook inmemory-lancedb-procallsgenerateReflectionText(), which internally callsresolveAgentPrimaryModelRef(params.cfg, params.agentId).For plugin-triggered hooks, OpenClaw core passes a plugin-scoped config to the hook context. This config lacks an
agentssection (it only containsplugins.entries.memory-lancedb-pro.config.*). WhenresolveAgentPrimaryModelRef()is called with this config for adc-channel--...agent ID, it returnsundefinedbecausecfg.agentsisundefined.This causes
runEmbeddedPiAgentto receiveprovider=undefined, model=undefined. The Pi runner then falls back to the hard-coded defaultopenai/gpt-5.4, which has no API key configured, resulting in a 56-second timeout before minimal fallback activates.Steps to Reproduce
/reseton a Discord channel that uses this agent(fallback) Reflection generation failed; storing minimal pointer only.Expected Behavior
/resetcompletes in normal time (~5-10 seconds) with full reflection content.Actual Behavior
/resettakes ~56 seconds for non-agent:main agentsRoot Cause
index.tsline 1157-1158:When
params.cfgis plugin-scoped,resolveAgentPrimaryModelRefreturnsundefined, causing the cascade to the 56-second timeout.Impact
Environment
command:resetorcommand:newvia Discord channel hookFix
PR #618 — add fallback to
config.llm.modelwhenresolveAgentPrimaryModelRefreturns undefined.Test Results (2026-04-14)