mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 03:40:21 +00:00
fix: resolve target agent workspace for cross-agent subagent spawns (#40176)
Merged via squash.
Prepared head SHA: 2378e40383
Co-authored-by: moshehbenavraham <17122072+moshehbenavraham@users.noreply.github.com>
Co-authored-by: mcaxtr <7562095+mcaxtr@users.noreply.github.com>
Reviewed-by: @mcaxtr
This commit is contained in:
@@ -58,6 +58,7 @@ export function mapToolContextToSpawnedRunMetadata(
|
||||
|
||||
export function resolveSpawnedWorkspaceInheritance(params: {
|
||||
config: OpenClawConfig;
|
||||
targetAgentId?: string;
|
||||
requesterSessionKey?: string;
|
||||
explicitWorkspaceDir?: string | null;
|
||||
}): string | undefined {
|
||||
@@ -65,12 +66,13 @@ export function resolveSpawnedWorkspaceInheritance(params: {
|
||||
if (explicit) {
|
||||
return explicit;
|
||||
}
|
||||
const requesterAgentId = params.requesterSessionKey
|
||||
? parseAgentSessionKey(params.requesterSessionKey)?.agentId
|
||||
: undefined;
|
||||
return requesterAgentId
|
||||
? resolveAgentWorkspaceDir(params.config, normalizeAgentId(requesterAgentId))
|
||||
: undefined;
|
||||
// For cross-agent spawns, use the target agent's workspace instead of the requester's.
|
||||
const agentId =
|
||||
params.targetAgentId ??
|
||||
(params.requesterSessionKey
|
||||
? parseAgentSessionKey(params.requesterSessionKey)?.agentId
|
||||
: undefined);
|
||||
return agentId ? resolveAgentWorkspaceDir(params.config, normalizeAgentId(agentId)) : undefined;
|
||||
}
|
||||
|
||||
export function resolveIngressWorkspaceOverrideForSpawnedRun(
|
||||
|
||||
Reference in New Issue
Block a user