From 96a8cecd3905bfcfe3b5e2a9927e2799f64a7e58 Mon Sep 17 00:00:00 2001 From: JoaoMarcos44 Date: Sat, 26 Sep 2026 18:46:03 -0300 Subject: [PATCH] fix(agent): scope async yield guidance to delegation (cherry picked from commit 99f82de0f99b055bdf5a5ec15be5e662934f2172) --- agent/system_prompt.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/agent/system_prompt.py b/agent/system_prompt.py index 853462571c..d9a4ce8086 100644 --- a/agent/system_prompt.py +++ b/agent/system_prompt.py @@ -19,7 +19,7 @@ from typing import Any, Dict, List, Optional, Tuple from agent.delegation_context import owned_kanban_task from agent.prompt_builder import ( - DEFAULT_AGENT_IDENTITY, EXECUTION_GUIDANCE_MODELS, GOOGLE_MODEL_OPERATIONAL_GUIDANCE, + ASYNC_HANDOFF_GUIDANCE, DEFAULT_AGENT_IDENTITY, EXECUTION_GUIDANCE_MODELS, GOOGLE_MODEL_OPERATIONAL_GUIDANCE, HERMES_AGENT_HELP_GUIDANCE, HERMES_AGENT_HELP_GUIDANCE_NO_SKILLS, KANBAN_GUIDANCE, PARALLEL_TOOL_CALL_GUIDANCE, PLATFORM_HINTS, SESSION_SEARCH_GUIDANCE, SKILLS_GUIDANCE, STEER_CHANNEL_NOTE, TASK_COMPLETION_GUIDANCE, TELEGRAM_RICH_MESSAGES_HINT, @@ -575,6 +575,10 @@ def _guidance_parts(agent: Any) -> List[str]: if _model_gate(getattr(agent, "_execution_guidance", "auto"), agent.model, EXECUTION_GUIDANCE_MODELS): from agent.prompt_builder import execution_guidance_text parts.append(execution_guidance_text()) + # delegate_task background delivery is intentionally between turns. Put this after the generic persistence + # blocks so their "keep working" rule cannot turn the required yield into no-op/polling activity. + if "delegate_task" in agent.valid_tool_names: + parts.append(ASYNC_HANDOFF_GUIDANCE) return parts