-
-
Notifications
You must be signed in to change notification settings - Fork 39.6k
Description
Describe the bug
Isolated cron jobs with agentId: "oc-claude" are incorrectly attempting to read API keys from the main agent's auth-profiles.json instead of the specified agent's auth store.
Expected behavior
When a cron job specifies agentId: "oc-claude", it should read authentication from:
~/.openclaw/agents/oc-claude/agent/auth-profiles.json
According to the multi-agent documentation:
Auth is per-agent: each agent reads from its own
agentDirauth store at:~/.openclaw/agents/<agentId>/agent/auth-profiles.json
Actual behavior
The isolated session fails with:
FailoverError: No API key found for provider "anthropic".
Auth store: /home/aiadmin/.openclaw/agents/main/agent/auth-profiles.json
(agentDir: /home/aiadmin/.openclaw/agents/main/agent)
Key observation: The error message explicitly references the main agent's path, even though the job's agentId is set to "oc-claude".
Steps to reproduce
- Create a multi-agent setup with two agents:
{ "agents": { "list": [ { "id": "main", "default": true }, { "id": "oc-claude" } ] } }
Configure API keys differently for each agent:
oc-claude has: anthropic:default + kimi-coding:default
main has: only kimi-coding:default (no anthropic key)
Create an isolated cron job for oc-claude:
openclaw cron add \
--name "Email Summary 10:00" \
--cron "0 10 * * *" \
--tz "Asia/Shanghai" \
--session isolated \
--agent oc-claude \
--message "Run email summary script"
Wait for the job to run (or trigger manually with openclaw cron run )
Check the error:
openclaw cron runs --id
Observed error
{
"lastError": "FailoverError: No API key found for provider "anthropic". Auth store: /home/aiadmin/.openclaw/agents/main/agent/auth-profiles.json (agentDir: /home/aiadmin/.openclaw/agents/main/agent). Configure auth for this agent (openclaw agents add ) or copy auth-profiles.json from the main agentDir.",
"lastStatus": "error",
"lastRunAtMs": 1770775200006
}
Environment
OpenClaw version: 2026.2.3-1 (or similar recent version)
OS: Linux 6.17.0-12-generic (x64)
Node.js: v24.11.1
Multi-agent setup: Yes (main + oc-claude agents)
Session type: isolated cron job
Temporary workaround
Adding the Anthropic API key to the main agent's auth-profiles.json resolves the error:
openclaw agents add main
Then add the anthropic API key
This confirms that isolated cron jobs are indeed reading from the main agent's auth store, regardless of the agentId specified in the job configuration.
Additional context
This behavior appears to contradict the documented per-agent auth isolation. Isolated cron jobs should respect the agentId field when loading authentication credentials, but they currently seem to fall back to the default/main agent's auth store.
This makes it difficult to run isolated jobs with agent-specific credentials in multi-agent setups, as all agents would need to share the same API keys.
I am not sure whether this is a bug, or if there is something I missed in the configuration, please kindly advise.