fix(cron): use requested agentId for isolated job auth resolution (#13983)

Co-authored-by: Tak Hoffman <[email protected]>
This commit is contained in:
0xRain
2026-02-11 23:32:45 -06:00
committed by GitHub
co-authored by Tak Hoffman
parent 7a0591ef87
commit b0dfb83952
+4 -1
View File
@@ -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/<agentId>/agent/).
const agentId = normalizedRequested ?? defaultAgentId;
const agentCfg: AgentDefaultsConfig = Object.assign(
{},
params.cfg.agents?.defaults,