Skip to content

InputMessageNode HITL state not propagated to calling agent in multi-agent orchestration #145

Description

@groganz

Summary

When a WayFlow flow containing an InputMessageNode is called as a child agent by an orchestrator via the A2A protocol, the input-required state produced by the InputMessageNode is never surfaced to the calling orchestrator. The orchestrator's send_message always returns completed (or failed), bypassing the HITL gate entirely.

Expected behaviour (per A2A spec)

The A2A specification defines input-required as a first-class task state. An orchestrator calling a child agent via send_message should receive input-required when the child hits an InputMessageNode, allowing the orchestrator to surface the HITL to the end user before resuming the child with the collected input.

Actual behaviour

In wayflowcore/agentserver/a2a/_worker.py, when a task starts (needs_new_conv = True) and the flow contains an InputMessageStep, the worker:

  1. Pre-executes the conversation to reach the InputMessageStep (flow pauses internally)
  2. Immediately appends the caller's incoming message to the conversation
  3. Executes again — the InputMessageStep consumes the caller's message as its input
  4. The flow continues past the gate and eventually returns completed

The input-required state exists only transiently in memory between steps 1 and 2. It is never persisted or returned to the calling agent; the HTTP response only arrives after full execution.

Minimal reproduction

Orchestrator (WayFlow flow with AgentNode)
  └─▶ Child Agent (WayFlow flow: StartNode → OutputMessageNode → InputMessageNode → ApiNode → EndNode)
  1. Orchestrator calls child via AgentNode / A2A send_message
  2. Child flow pre-executes to InputMessageNode → internally input-required
  3. Caller's resume message (e.g. "Approved") is appended and immediately consumed by the InputMessageNode
  4. ApiNode executes with "Approved" as the collected input — not the actual user response
  5. Child returns completed; orchestrator never sees input-required

Impact

Multi-agent workflows that rely on InputMessageNode for scoped human-in-the-loop data collection (e.g. asking the user to confirm a parameter before a long-running step) cannot function when the flow is invoked as a child agent. The gate is silently bypassed, and the caller's generic resume acknowledgment is used as the HITL input.

Suggested fix

When needs_new_conv = True and the flow contains an InputMessageStep, _worker.py should:

  • Pre-execute to the InputMessageStep
  • Persist the input-required state
  • Return the input-required response to the caller without processing the incoming message
  • Only on the next send_message call (when needs_new_conv = False and the conversation is in UserMessageRequestStatus) should the incoming message be forwarded to the InputMessageStep

This aligns with the prioritize_task / needs_new_conv = False path that already handles subsequent messages correctly.

Environment

  • wayflowcore 26.1.x
  • A2A blocking mode
  • Multi-agent orchestration (parent Flow with AgentNode calling a child Flow containing InputMessageNode)

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