fix(agent): scope async yield guidance to delegation

(cherry picked from commit 99f82de0f99b055bdf5a5ec15be5e662934f2172)
This commit is contained in:
JoaoMarcos44
2026-09-26 18:46:03 -03:00
committed by kshitij
parent d9ef15dd3c
commit 96a8cecd39

View File

@@ -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