fix: always include long-wait polling guidance in prompt

This commit is contained in:
Peter Steinberger
2026-02-16 03:51:32 +01:00
parent abd26b6e54
commit 17a148c8a8
2 changed files with 4 additions and 1 deletions

View File

@@ -120,6 +120,9 @@ describe("buildAgentSystemPrompt", () => {
workspaceDir: "/tmp/openclaw", workspaceDir: "/tmp/openclaw",
}); });
expect(prompt).toContain(
"For long waits, avoid rapid poll loops: use exec with enough yieldMs or process(action=poll, timeout=<ms>).",
);
expect(prompt).toContain("Completion is push-based: it will auto-announce when done."); expect(prompt).toContain("Completion is push-based: it will auto-announce when done.");
expect(prompt).toContain("Do not poll `subagents list` / `sessions_list` in a loop"); expect(prompt).toContain("Do not poll `subagents list` / `sessions_list` in a loop");
}); });

View File

@@ -413,7 +413,6 @@ export function buildAgentSystemPrompt(params: {
"- apply_patch: apply multi-file patches", "- apply_patch: apply multi-file patches",
`- ${execToolName}: run shell commands (supports background via yieldMs/background)`, `- ${execToolName}: run shell commands (supports background via yieldMs/background)`,
`- ${processToolName}: manage background exec sessions`, `- ${processToolName}: manage background exec sessions`,
`- For long waits, avoid rapid poll loops: use ${execToolName} with enough yieldMs or ${processToolName}(action=poll, timeout=<ms>).`,
"- browser: control OpenClaw's dedicated browser", "- browser: control OpenClaw's dedicated browser",
"- canvas: present/eval/snapshot the Canvas", "- canvas: present/eval/snapshot the Canvas",
"- nodes: list/describe/notify/camera/screen on paired nodes", "- nodes: list/describe/notify/camera/screen on paired nodes",
@@ -425,6 +424,7 @@ export function buildAgentSystemPrompt(params: {
'- session_status: show usage/time/model state and answer "what model are we using?"', '- session_status: show usage/time/model state and answer "what model are we using?"',
].join("\n"), ].join("\n"),
"TOOLS.md does not control tool availability; it is user guidance for how to use external tools.", "TOOLS.md does not control tool availability; it is user guidance for how to use external tools.",
`For long waits, avoid rapid poll loops: use ${execToolName} with enough yieldMs or ${processToolName}(action=poll, timeout=<ms>).`,
"If a task is more complex or takes longer, spawn a sub-agent. Completion is push-based: it will auto-announce when done.", "If a task is more complex or takes longer, spawn a sub-agent. Completion is push-based: it will auto-announce when done.",
"Do not poll `subagents list` / `sessions_list` in a loop; only check status on-demand (for intervention, debugging, or when explicitly asked).", "Do not poll `subagents list` / `sessions_list` in a loop; only check status on-demand (for intervention, debugging, or when explicitly asked).",
"", "",