mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 09:37:41 +00:00
fix: cron sessions inherit allowAgents from parent agent config (#1771)
When a cron job runs in isolated mode, the sessions_spawn tool now correctly inherits the allowAgents permissions from the parent agent's config. The fix adds a requesterAgentIdOverride parameter that flows through the tool creation chain: - resolveEffectiveToolPolicy() extracts the correct agentId from the session key - This agentId is passed to sessions_spawn and agents_list tools - The tools use this override instead of re-parsing the session key This fixes #1767
This commit is contained in:
@@ -54,6 +54,8 @@ export function createClawdbotTools(options?: {
|
||||
hasRepliedRef?: { value: boolean };
|
||||
/** If true, the model has native vision capability */
|
||||
modelHasVision?: boolean;
|
||||
/** Explicit agent ID override for cron/hook sessions. */
|
||||
requesterAgentIdOverride?: string;
|
||||
}): AnyAgentTool[] {
|
||||
const imageTool = options?.agentDir?.trim()
|
||||
? createImageTool({
|
||||
@@ -105,7 +107,10 @@ export function createClawdbotTools(options?: {
|
||||
agentSessionKey: options?.agentSessionKey,
|
||||
config: options?.config,
|
||||
}),
|
||||
createAgentsListTool({ agentSessionKey: options?.agentSessionKey }),
|
||||
createAgentsListTool({
|
||||
agentSessionKey: options?.agentSessionKey,
|
||||
requesterAgentIdOverride: options?.requesterAgentIdOverride,
|
||||
}),
|
||||
createSessionsListTool({
|
||||
agentSessionKey: options?.agentSessionKey,
|
||||
sandboxed: options?.sandboxed,
|
||||
@@ -129,6 +134,7 @@ export function createClawdbotTools(options?: {
|
||||
agentGroupChannel: options?.agentGroupChannel,
|
||||
agentGroupSpace: options?.agentGroupSpace,
|
||||
sandboxed: options?.sandboxed,
|
||||
requesterAgentIdOverride: options?.requesterAgentIdOverride,
|
||||
}),
|
||||
createSessionStatusTool({
|
||||
agentSessionKey: options?.agentSessionKey,
|
||||
|
||||
Reference in New Issue
Block a user