-
Notifications
You must be signed in to change notification settings - Fork 61
fix(openclaw): handle object format for agents.defaults.model #176
Copy link
Copy link
Open
Description
Summary
resolveOpenClawGatewayProvider() fails when OpenClaw uses the current config schema where agents.defaults.model is an object with {primary, fallbacks} instead of a plain string.
Environment
- ClawVault: v3.3.0
- OpenClaw: 2026.3.x (current)
- Node: v22.x
Steps to Reproduce
- Configure OpenClaw with the current schema:
{
"agents": {
"defaults": {
"model": {
"primary": "anthropic/claude-opus-4-5-20251101",
"fallbacks": []
}
}
},
"gateway": {
"port": 18789,
"auth": { "token": "..." },
"http": {
"endpoints": {
"chatCompletions": { "enabled": true }
}
}
}
}- Set ClawVault to use
provider: openclawin.clawvault.json:
{
"observe": {
"provider": "openclaw"
}
}- Run any command that uses LLM (e.g.,
clawvault maintain)
Expected Behavior
ClawVault detects the OpenClaw gateway provider and uses it for LLM completions.
Actual Behavior
resolveOpenClawGatewayProvider() throws an exception and returns null, causing workers to fall back to heuristic mode.
Error: raw.agents?.defaults?.model?.trim is not a function
Root Cause
In src/lib/llm-provider.ts, line ~31:
const defaultModel = raw.agents?.defaults?.model?.trim() || DEFAULT_MODELS.openclaw;This assumes agents.defaults.model is a string, but OpenClaw's current schema uses:
{
primary: "anthropic/claude-opus-4-5-20251101",
fallbacks: []
}Calling .trim() on an object throws.
Suggested Fix
const modelValue = raw.agents?.defaults?.model;
const defaultModel = (typeof modelValue === 'string'
? modelValue.trim()
: modelValue?.primary?.trim())
|| DEFAULT_MODELS.openclaw;This handles both the legacy string format and the current object format.
Workaround
Manually patch dist/chunk-DVOUSOR3.js line 31 with the fix above.
Related
- PR fix(openclaw): resolve provider from gateway chat endpoint #139 introduced the gateway provider resolution but assumed string format
- OpenClaw schema docs show
agents.defaults.model.primaryas the correct path
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels