Skip to content

[BUG] Parent agent cannot receive subagent completion reports from agent_finish #271

@3e-root

Description

@3e-root

Bug Description

When a sub-agent calls agent_finish to complete its task and report results, the parent agent does not receive or process the completion report. The sub-agent's report is added to _agent_messages[parent_id] queue, but the parent agent never acknowledges or processes it.

Expected Behavior

When a sub-agent calls agent_finish with report_to_parent=True, the parent agent should:

  1. Receive the completion report
  2. Acknowledge the sub-agent's completion
  3. Process the findings and recommendations from the report

Actual Behavior

The sub-agent's completion report is added to the message queue (_agent_messages[parent_id]), but:

  • The parent agent never receives the report
  • The report remains "unread" in the queue
  • The parent agent continues its execution without acknowledging sub-agent completion
  • Sub-agents may repeatedly send messages thinking they weren't delivered

Root Cause Analysis

Code Location: strix/tools/agents_graph/agents_graph_actions.py

The agent_finish function (lines 424-443) only adds messages to _agent_messages[parent_id]:

if parent_id not in _agent_messages:
    _agent_messages[parent_id] = []

_agent_messages[parent_id].append({
    "id": f"report_{uuid4().hex[:8]}",
    "from": agent_id,
    "to": parent_id,
    "content": report_message,
    "message_type": "information",
    "priority": "high",
    "timestamp": datetime.now(UTC).isoformat(),
    "delivered": True,
    "read": False,
})

Code Location: strix/agents/base_agent.py

The _check_agent_messages function (lines 427-510) only processes messages when the parent agent is in a waiting state:

if state.is_waiting_for_input():
    state.resume_from_waiting()
    has_new_messages = True

The Problem

  1. Parent agents create sub-agents and continue executing (they don't automatically enter waiting state)
  2. Sub-agents finish and call agent_finish
  3. Messages are added to _agent_messages[parent_id] queue
  4. Parent agent's _check_agent_messages is called every loop iteration
  5. Messages are added to state.messages and marked as read
  6. But parent agent is NOT in waiting state, so it doesn't specially process these completion reports
  7. Parent agent continues execution without acknowledging sub-agent completion

Proposed Fix

Modify agent_finish to directly add the completion report to the parent agent's state.messages:

# After adding to _agent_messages, also add directly to parent's state
if parent_id in _agent_states:
    parent_state = _agent_states[parent_id]
    parent_state.add_message("user", report_message)

This ensures the parent agent will see the completion report in its next LLM iteration, regardless of its waiting state.

Impact

  • High: Sub-agent reports are critical for multi-agent workflows
  • Affects all users relying on sub-agent delegation
  • Sub-agents may appear "stuck" as they wait for acknowledgment

Environment

  • Strix version: 0.6.2
  • Python version: 3.13
  • OS: Kali Linux

Additional Context

This issue was discovered during penetration testing where sub-agents completed deep fuzzing and TLS analysis tasks, but their reports were never received by the parent agent, requiring manual intervention to merge the reports.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions