-
Notifications
You must be signed in to change notification settings - Fork 35
React to send becoming nonblocking #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
e6ebae2 to
bfbc4bd
Compare
|
E2E tests will fail until the CLI is updated to a build that supports this |
There was a problem hiding this 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 across all SDK languages (Node.js, Python, Go, .NET) that sends a message and blocks until the agent turn completes. This accompanies a CLI change that makes send() non-blocking. The PR also adds snapshot test infrastructure protection to prevent snapshot corruption on test failures.
Changes:
- Implements
sendAndWait()method in all four SDK languages with consistent behavior (60s default timeout, returns final assistant message) - Updates all E2E tests to use
sendAndWait()instead ofsend()+ helper methods - Adds snapshot corruption protection by skipping snapshot writes when tests fail
Reviewed changes
Copilot reviewed 48 out of 51 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| python/copilot/session.py | Adds send_and_wait() method that waits for session.idle |
| nodejs/src/session.ts | Adds sendAndWait() method with AssistantMessageEvent return type |
| go/session.go | Adds SendAndWait() method with timeout parameter |
| dotnet/src/Session.cs | Adds SendAndWaitAsync() with TimeSpan timeout |
| python/e2e/conftest.py | Adds test failure tracking to avoid corrupting snapshots |
| nodejs/test/e2e/harness/sdkTestContext.ts | Tracks test failures to skip snapshot writes |
| go/e2e/testharness/context.go | Passes test failure status to proxy stop |
| dotnet/test/Harness/E2ETestContext.cs | Uses CI environment variable to skip snapshot writes |
| test/harness/replayingCapiProxy.ts | Supports skipWritingCache query parameter |
| python/e2e/testharness/proxy.py | Adds skip_writing_cache parameter to stop method |
| go/e2e/testharness/proxy.go | Adds StopWithOptions method for conditional snapshot writes |
| dotnet/test/Harness/CapiProxy.cs | Adds skipWritingCache parameter to StopAsync |
| python/e2e/test_session.py | Updates tests to use send_and_wait |
| nodejs/test/e2e/session.test.ts | Updates tests to use sendAndWait, adds new blocking behavior tests |
| go/e2e/session_test.go | Updates tests to use SendAndWait |
| dotnet/test/SessionTests.cs | Updates tests to use SendAndWaitAsync, adds blocking behavior tests |
| nodejs/examples/basic-example.ts | Updates example to use sendAndWait |
| nodejs/README.md | Documents new sendAndWait method |
| test/snapshots/* | Updated snapshots reflecting minor model output variations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Adds a new
sendAndWait()method to all SDK languages that waits for the agent turn to complete. This accompaniesthe CLI change in https://github.com/github/copilot-agent-runtime/pull/1539 which makes
send()return immediatelyinstead of blocking.
Changes
New API:
sendAndWait()All SDKs now have a method that sends a message and waits for
session.idle:sendAndWait(options, timeout?)Promise<AssistantMessageEvent>SendAndWaitAsync(options, timeout?, ct?)Task<AssistantMessageEvent?>SendAndWait(options, timeout)(*SessionEvent, error)send_and_wait(options, timeout?)SessionEventAll implementations:
assistant.messageevent received beforesession.idlesession.errorevents by throwing/returning an errorSnapshot Test Infrastructure
Added protection against snapshot corruption on test failures.
Updated E2E Tests
All e2e tests updated to use
sendAndWait()instead ofsend()+getFinalAssistantMessage().Backward Compatibility
send()still works, just returns faster)Related