@@ -259,7 +259,7 @@ def cleanup_session_turn_end(cls, session_id: str) -> dict:
259259 if not session .subagents and not session .protected_agents :
260260 # 所有subagent都被清理,清除公共上下文
261261 cls .clear_shared_context (session_id )
262- logger .debug (
262+ logger .info (
263263 "[SubAgent:SharedContext] All subagents cleaned, cleared shared context"
264264 )
265265 else :
@@ -279,7 +279,6 @@ def cleanup_session_turn_end(cls, session_id: str) -> dict:
279279
280280 # 每轮结束时顺便清理全局过期会话
281281 cls .cleanup_expired_sessions ()
282-
283282 return {"status" : "cleaned" , "cleaned_agents" : cleaned }
284283
285284 @classmethod
@@ -734,27 +733,21 @@ def _build_time_prompt(cls) -> str:
734733
735734 _TASK_STATUS_PROMPT = (
736735 "# Task Status Reporting\n "
737- "At the end of your task, you MUST self-audit before reporting status.\n "
738- "\n "
739- "SUCCESS protocol — verify ALL:\n "
740- "- No tool returned an error or empty result unexpectedly\n "
741- "- The output directly answers the task prompt\n "
742- "- You are confident the result is not a guess or placeholder\n "
743- "- If files were created: they exist on disk and their content is "
744- "correct and complete enough for another agent to continue the work\n "
745- "<task_status><result>SUCCESS</result></task_status>\n "
746- "\n "
747- "FAILURE protocol — if ANY tool failed or you cannot complete:\n "
748- "<task_status><result>FAILURE</result>"
749- "<reason>specific reason</reason></task_status>\n "
750- "\n "
751- "Common mistakes to avoid:\n "
752- "- Do NOT report SUCCESS when a command returned an error\n "
753- "- Do NOT report SUCCESS when you only completed part of the task\n "
754- "- Do NOT report SUCCESS when generated files are missing or incomplete\n "
755- "- Do NOT guess status — if uncertain, use FAILURE\n "
756- "\n "
757- "Put the XML block first, then your result or error details.\n "
736+ "At the end of your task, self-audit before giving your final answer.\n "
737+ "## SUCCESS — use only when ALL of these are true:\n "
738+ "- Every tool call succeeded; no unexpected error or empty result\n "
739+ "- Your output directly answers the task you were assigned\n "
740+ "- You are confident the result is accurate, not a guess or placeholder\n "
741+ "- If you created files: ensure they exist on disk, and their content is correct and complete\n "
742+ "If all pass, put this EXACT line FIRST, then your result:\n "
743+ "[TASK RESULT: SUCCESS]\n "
744+ "## FAILURE — use if ANY tool failed, or you cannot complete the task:\n "
745+ "[TASK RESULT: FAILURE]\n "
746+ "[FAILURE REASON: <one-line explanation>]\n "
747+ "## Reporting Marker Rules\n "
748+ "- The marker MUST be exactly `[TASK RESULT: SUCCESS]` or `[TASK RESULT: FAILURE]` — do not change it\n "
749+ "- The marker MUST be on its own line, at the very top of your response\n "
750+ "- When uncertain between success and failure, choose failure\n "
758751 )
759752
760753 @classmethod
@@ -771,7 +764,10 @@ def _build_rule_prompt(cls) -> str:
771764 "- Mark all generated code/documents with your name and timestamp (if given).\n "
772765 )
773766 )
774- return base + cls ._TASK_STATUS_PROMPT
767+ if cls ._dag_enabled :
768+ return base + cls ._TASK_STATUS_PROMPT
769+ else :
770+ return base
775771
776772 @classmethod
777773 def cleanup_shared_context_by_agent (cls , session_id : str , agent_name : str ) -> None :
0 commit comments