mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-16 11:41:08 +00:00
fix(agents): prefer cron for deferred follow-ups (#60811)
* fix(agents): prefer cron for deferred follow-ups * fix(agents): gate cron scheduling guidance * fix(changelog): add scheduling guidance note * fix(agents): restore exec approval agent hint
This commit is contained in:
@@ -1115,9 +1115,17 @@ function deriveExecShortName(fullPath: string): string {
|
||||
return base.replace(/\.exe$/i, "") || base;
|
||||
}
|
||||
|
||||
function buildExecToolDescription(agentId?: string): string {
|
||||
const base =
|
||||
"Execute shell commands with background continuation. Use yieldMs/background to continue later via process tool. Use pty=true for TTY-required commands (terminal UIs, coding agents).";
|
||||
export function describeExecTool(params?: { agentId?: string; hasCronTool?: boolean }): string {
|
||||
const base = [
|
||||
"Execute shell commands with background continuation for work that starts now.",
|
||||
"Use yieldMs/background to continue later via process tool.",
|
||||
params?.hasCronTool
|
||||
? "Do not use exec sleep or delay loops for reminders or deferred follow-ups; use cron instead."
|
||||
: undefined,
|
||||
"Use pty=true for TTY-required commands (terminal UIs, coding agents).",
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" ");
|
||||
if (process.platform !== "win32") {
|
||||
return base;
|
||||
}
|
||||
@@ -1127,7 +1135,10 @@ function buildExecToolDescription(agentId?: string): string {
|
||||
);
|
||||
try {
|
||||
const approvalsFile = loadExecApprovals();
|
||||
const approvals = resolveExecApprovalsFromFile({ file: approvalsFile, agentId });
|
||||
const approvals = resolveExecApprovalsFromFile({
|
||||
file: approvalsFile,
|
||||
agentId: params?.agentId,
|
||||
});
|
||||
const allowlist = approvals.allowlist.filter((entry) => {
|
||||
const pattern = entry.pattern?.trim() ?? "";
|
||||
return (
|
||||
@@ -1208,7 +1219,7 @@ export function createExecTool(
|
||||
name: "exec",
|
||||
label: "exec",
|
||||
get description() {
|
||||
return buildExecToolDescription(agentId);
|
||||
return describeExecTool({ agentId, hasCronTool: defaults?.hasCronTool === true });
|
||||
},
|
||||
parameters: execSchema,
|
||||
execute: async (_toolCallId, args, signal, onUpdate) => {
|
||||
|
||||
Reference in New Issue
Block a user