Skip to content

Conversation

@SteveSandersonMS
Copy link
Contributor

@SteveSandersonMS SteveSandersonMS commented Jan 16, 2026

Summary

Adds a new sendAndWait() method to all SDK languages that waits for the agent turn to complete. This accompanies the CLI change which makes send() return immediately instead of blocking.

Changes

New API: sendAndWait()

All SDKs now have a method that sends a message and waits for session.idle:

Language Method Return Type Default Timeout
Node.js sendAndWait(options, timeout?) Promise<AssistantMessageEvent> 60s
.NET SendAndWaitAsync(options, timeout?, ct?) Task<AssistantMessageEvent?> 60s
Go SendAndWait(options, timeout) (*SessionEvent, error) 60s
Python send_and_wait(options, timeout?) SessionEvent 60s

All implementations:

  • Return the last assistant.message event received before session.idle
  • Handle session.error events by throwing/returning an error
  • Support configurable timeout (default 60 seconds)

Updated E2E Tests

All e2e tests updated to use sendAndWait() instead of send() + getFinalAssistantMessage().

Backward Compatibility

  • Old SDK + New CLI: Works (old send() still works, just returns faster)
  • New SDK + Old CLI: Works (old CLI blocks anyway)

Related

Copilot AI review requested due to automatic review settings January 16, 2026 00:38
@SteveSandersonMS SteveSandersonMS requested a review from a team as a code owner January 16, 2026 00:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new sendAndWait() method to all SDK languages (Node.js, Python, Go, and .NET) that sends a message and blocks until the agent turn completes. This accompanies a CLI change where send() now returns immediately instead of blocking.

Changes:

  • Implements sendAndWait() API across all four SDK languages with consistent 60-second default timeout behavior
  • Updates all e2e tests to use sendAndWait() instead of send() + helper functions
  • Adds forward compatibility for unknown event types in Python and .NET

Reviewed changes

Copilot reviewed 23 out of 25 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
nodejs/src/session.ts Implements sendAndWait() method with timeout and error handling
nodejs/src/index.ts Exports new AssistantMessageEvent type
nodejs/test/e2e/*.test.ts Updates tests to use sendAndWait() and adds new blocking behavior tests
nodejs/examples/basic-example.ts Updates example to use sendAndWait()
nodejs/README.md Documents new sendAndWait() API
python/copilot/session.py Implements send_and_wait() method
python/copilot/generated/session_events.py Adds forward compatibility for unknown event types
python/e2e/*.py Updates tests to use send_and_wait()
go/session.go Implements SendAndWait() method
go/e2e/*.go Updates tests to use SendAndWait()
dotnet/src/Session.cs Implements SendAndWaitAsync() method
dotnet/src/Generated/SessionEvents.cs Adds forward compatibility for unknown event types
dotnet/src/Client.cs Adds null check for unknown events
dotnet/test/*.cs Updates tests to use SendAndWaitAsync() and adds new blocking behavior tests
test/snapshots/session/*.yaml New test snapshots for blocking behavior tests
Comments suppressed due to low confidence (1)

nodejs/test/e2e/session.test.ts:1

  • The code accesses assistantMessages[assistantMessages.length - 1] without checking if the array is empty. If no assistant messages exist, this will throw an error. Add a check to ensure the array has at least one element before accessing it.
import { describe, expect, it, onTestFinished } from "vitest";

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@SteveSandersonMS SteveSandersonMS force-pushed the stevesa/e2e-infra-snapshots branch 3 times, most recently from d82a2c3 to 40de300 Compare January 16, 2026 00:48
@SteveSandersonMS SteveSandersonMS force-pushed the stevesa/send-nonblocking-v2 branch from f4f7d77 to 4a72d4c Compare January 16, 2026 00:48
@SteveSandersonMS SteveSandersonMS force-pushed the stevesa/e2e-infra-snapshots branch from 40de300 to f23a4ca Compare January 16, 2026 00:49
@SteveSandersonMS SteveSandersonMS force-pushed the stevesa/send-nonblocking-v2 branch 3 times, most recently from 47a77e8 to 100748b Compare January 16, 2026 00:55
@SteveSandersonMS SteveSandersonMS force-pushed the stevesa/e2e-infra-snapshots branch from 547b2ad to 2055997 Compare January 16, 2026 00:59
@SteveSandersonMS SteveSandersonMS force-pushed the stevesa/send-nonblocking-v2 branch from 100748b to 9d2188b Compare January 16, 2026 01:00
@SteveSandersonMS SteveSandersonMS force-pushed the stevesa/e2e-infra-snapshots branch 2 times, most recently from 456dc7d to 4388a4e Compare January 16, 2026 01:06
@SteveSandersonMS SteveSandersonMS force-pushed the stevesa/send-nonblocking-v2 branch from 9d2188b to caf8cf9 Compare January 16, 2026 01:07
@SteveSandersonMS SteveSandersonMS force-pushed the stevesa/e2e-infra-snapshots branch from 4388a4e to a885cdd Compare January 16, 2026 15:14
@SteveSandersonMS SteveSandersonMS changed the base branch from stevesa/e2e-infra-snapshots to main January 16, 2026 15:15
@SteveSandersonMS SteveSandersonMS force-pushed the stevesa/send-nonblocking-v2 branch 3 times, most recently from 2cf821d to c79a12c Compare January 16, 2026 15:20
@SteveSandersonMS SteveSandersonMS force-pushed the stevesa/send-nonblocking-v2 branch from c79a12c to b8b760b Compare January 16, 2026 15:23
@SteveSandersonMS SteveSandersonMS force-pushed the stevesa/send-nonblocking-v2 branch from 429a257 to d270072 Compare January 16, 2026 15:47
@SteveSandersonMS SteveSandersonMS added this pull request to the merge queue Jan 16, 2026
Merged via the queue into main with commit cd198b5 Jan 16, 2026
22 checks passed
@SteveSandersonMS SteveSandersonMS deleted the stevesa/send-nonblocking-v2 branch January 16, 2026 17:17
jmoseley pushed a commit that referenced this pull request Jan 21, 2026
* Add support release documents

* Clean up SUPPORT.md

* Update CODEOWNERS to use wildcard for ownership
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants