Repo/version: github/copilot-sdk, tag rust/v1.0.14 (e60d903); CLI runtime 1.0.84-5.
Behaviour: A parent turn's send_and_wait returns early, with the wrong result, when a spawned sub-agent fails or goes idle.
Cause: handle_notification (rust/src/session.rs:2256; the waiter arm :2282-2304) takes the send_and_wait waiter on every session.idle / session.error and records every assistant.message as the wait's last message, with no agent_id check. The CLI's subagent bridge re-emits child events on the parent stream carrying the child's agent_id (the CLI runtime re-emits sub-agent events on the parent stream tagged with the child agent_id; session.error is among the re-emitted types), so a child's model-call failure resolves the parent's wait.
Fix shape: Only events with no agent_id (or equal to the root session's) may resolve the waiter or set its last message. Child-tagged idle/error/message events are ignored by the waiter (they still reach on_event).
Regression test: parent wait in flight; inject session.error with a child agent_id → wait NOT resolved; inject root session.idle → resolved.
Downstream: a consumer of this crate carries a local patch for this and cannot drop it until it is fixed upstream.
Repo/version:
github/copilot-sdk, tagrust/v1.0.14(e60d903); CLI runtime 1.0.84-5.Behaviour: A parent turn's
send_and_waitreturns early, with the wrong result, when a spawned sub-agent fails or goes idle.Cause:
handle_notification(rust/src/session.rs:2256; the waiter arm :2282-2304) takes thesend_and_waitwaiter on everysession.idle/session.errorand records everyassistant.messageas the wait's last message, with noagent_idcheck. The CLI's subagent bridge re-emits child events on the parent stream carrying the child'sagent_id(the CLI runtime re-emits sub-agent events on the parent stream tagged with the childagent_id;session.erroris among the re-emitted types), so a child's model-call failure resolves the parent's wait.Fix shape: Only events with no
agent_id(or equal to the root session's) may resolve the waiter or set its last message. Child-tagged idle/error/message events are ignored by the waiter (they still reachon_event).Regression test: parent wait in flight; inject
session.errorwith a childagent_id→ wait NOT resolved; inject rootsession.idle→ resolved.Downstream: a consumer of this crate carries a local patch for this and cannot drop it until it is fixed upstream.