Skip to content

agent_send reply mishandles parallel and chain background lanes #183

Closed

Description

@quifox

What happened?

agent_send replies do not behave correctly for multi-task background lanes.

For a completed parallel or chain lane, reply restarts the lane with the original tasks/chain still present, so the new reply prompt is ignored by mode selection and the original work runs again. For a running parallel lane, reply only targets the base sessionId, so sibling child sessions such as sessionId-1 do not receive it.

This conflicts with the documented agent_send behavior that replies continue the lane's existing transcript. I reproduced both cases on clean main @ adcf37b in core subagent tests, without external extensions. I have a local fix and regression tests ready and would like to submit a PR.

Steps to reproduce

  1. Start a background parallel lane:
    {
      "tasks": [
        { "agent": "general", "task": "A" },
        { "agent": "general", "task": "B" }
      ],
      "run_in_background": true,
      "alias": "lane"
    }
  2. Wait for it to complete.
  3. Send agent_send with action: "reply" and prompt C.
  4. The original A/B tasks run again; C is not delivered as the new turn.
  5. The same completed-lane behavior reproduces with chain.
  6. While a parallel lane is still running, a reply reaches the base child but not sibling sessionId-N children.

Expected behavior

A reply should continue the existing lane transcript with the new prompt, preserve the lane topology, and not silently rerun the original prompt. Running parallel replies should not be delivered to only part of the lane.

Version

main @ adcf37b / @step-harness/coding-agent 0.84.4

Activity

  1. xuxujo97-coder commented on Sep 28, 2026

    @xuxujo97-coder
    Collaborator

    This comment was generated by AI during triage.

    Verification (against current main)

    • The reply verb lives in packages/coding-agent/src/features/subagent/lane-lifecycle.ts:289-290 (replyToLane), with live lanes keyed in the same registry — both symptoms (completed parallel/chain lanes restarting with the original tasks/chain so the reply prompt is ignored; running-lane replies hitting only the base sessionId instead of sibling sessionId-1) sit exactly in that routing.

    Please open the PR with the regression tests — this is a correctness fix for documented behavior.

  2. quifox commented on Sep 28, 2026

    @quifox
    Author

    @IRemover I have the fix and regression tests ready, but PR creation is currently restricted. Could you add me to the external contributor whitelist when it opens? I can submit it once access is available.

  3. liuedcson commented on Oct 23, 2026

    @liuedcson
    Collaborator

    This comment was generated by AI during triage.

    Thanks for the precise report — both symptoms (completed lanes rerunning the original batch, and running parallel replies reaching only the base sessionId) were easy to confirm once pointed at the reply routing, and the repro steps were helpful.

    This has been fixed in #282 (118348c0). agent_send reply now applies only to single-agent lanes:

    • a parallel or chain lane returns an explicit error instead of restarting with the original tasks/chain, so the new prompt is never silently dropped and the batch is never rerun;
    • a single-agent lane's reply resumes that child session's transcript with the new prompt, so delivery is no longer split across sessionId / sessionId-N.

    Coverage in packages/coding-agent/test/step-subagent-events.test.ts:

    • reply is refused for parallel and chain lanes without rerunning the batch
    • a single-lane reply runs only the follow-up task for the lane's agent

    34 tests pass on current main (a749d471).

    One thing to flag so expectations are clear: follow-up prompts to parallel/chain lanes remain unsupported by design — the recommended path is a new subagent call with the follow-up task. If topology-preserving multi-agent follow-ups turn out to matter to real workflows, please open a focused feature request and we will evaluate it properly.

    Closing as fixed — thanks again for the clear write-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/agentsrc/agentbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions