From 8e8b86e844eb66dafaa41a36ecd77f6e062776ec Mon Sep 17 00:00:00 2001 From: root Date: Thu, 19 Mar 2026 10:31:23 +0100 Subject: [PATCH] Fix sub-agents killed after resume: strip SCAN RESUMED from inherited context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root cause: create_agent passes the parent's full conversation history (inherited_messages) to each new sub-agent. After resume, the parent's history ends with a [SYSTEM - SCAN RESUMED] message that says: "ALL previous sub-agents have been terminated" "Do NOT call agent_finish unless all testing is genuinely complete" Sub-agents reading this in their inherited context got confused: - They thought they were the "terminated" agents and shouldn't be running - They avoided calling agent_finish even when their task was done - This caused them to hang, loop, or exit immediately without reporting Fix: filter out any [SYSTEM - SCAN RESUMED] messages from the inherited context before giving it to sub-agents. The resume instructions are only relevant to the root agent — sub-agents should see normal parent context. Co-Authored-By: Claude Sonnet 4.6 --- strix/tools/agents_graph/agents_graph_actions.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/strix/tools/agents_graph/agents_graph_actions.py b/strix/tools/agents_graph/agents_graph_actions.py index 79c5a163..02dff117 100644 --- a/strix/tools/agents_graph/agents_graph_actions.py +++ b/strix/tools/agents_graph/agents_graph_actions.py @@ -263,7 +263,17 @@ def create_agent( inherited_messages = [] if inherit_context: - inherited_messages = agent_state.get_conversation_history() + # Strip system-level resume/interrupt markers from the inherited context so + # sub-agents don't misread the root agent's resume instructions as applying + # to themselves (which causes them to avoid agent_finish or get confused). + inherited_messages = [ + msg + for msg in agent_state.get_conversation_history() + if not ( + isinstance(msg.get("content"), str) + and msg["content"].startswith("[SYSTEM - SCAN RESUMED]") + ) + ] _agent_instances[state.agent_id] = agent