mirror of
https://github.com/usestrix/strix.git
synced 2026-09-22 00:31:25 +00:00
Fix sub-agents killed after resume: strip SCAN RESUMED from inherited context
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 <noreply@anthropic.com>
This commit is contained in:
parent
87078de4f1
commit
8e8b86e844
1 changed files with 11 additions and 1 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue