From b0dfb8395242233fb1ec252a01d5c4f4ff8b69c0 Mon Sep 17 00:00:00 2001 From: 0xRain Date: Thu, 12 Feb 2026 13:32:45 +0800 Subject: [PATCH] fix(cron): use requested agentId for isolated job auth resolution (#13983) Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com> --- src/cron/isolated-agent/run.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cron/isolated-agent/run.ts b/src/cron/isolated-agent/run.ts index 29d3e629f7c..b52e9594aa4 100644 --- a/src/cron/isolated-agent/run.ts +++ b/src/cron/isolated-agent/run.ts @@ -124,7 +124,10 @@ export async function runCronIsolatedAgentTurn(params: { ? resolveAgentConfig(params.cfg, normalizedRequested) : undefined; const { model: overrideModel, ...agentOverrideRest } = agentConfigOverride ?? {}; - const agentId = agentConfigOverride ? (normalizedRequested ?? defaultAgentId) : defaultAgentId; + // Use the requested agentId even when there is no explicit agent config entry. + // This ensures auth-profiles, workspace, and agentDir all resolve to the + // correct per-agent paths (e.g. ~/.openclaw/agents//agent/). + const agentId = normalizedRequested ?? defaultAgentId; const agentCfg: AgentDefaultsConfig = Object.assign( {}, params.cfg.agents?.defaults,