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

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
0xRain
2026-02-12 13:32:45 +08:00
committed by GitHub
parent 7a0591ef87
commit b0dfb83952

View File

@@ -124,7 +124,10 @@ export async function runCronIsolatedAgentTurn(params: {
? resolveAgentConfig(params.cfg, normalizedRequested) ? resolveAgentConfig(params.cfg, normalizedRequested)
: undefined; : undefined;
const { model: overrideModel, ...agentOverrideRest } = agentConfigOverride ?? {}; 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( const agentCfg: AgentDefaultsConfig = Object.assign(
{}, {},
params.cfg.agents?.defaults, params.cfg.agents?.defaults,