Report authoritative cwd in recordContextChange E2E tests#2036
Conversation
The runtime now treats a local session's cwd as authoritative: it is changed via setWorkingDirectory, and a recordContextChange that reports a divergent cwd is ignored (the RPC still succeeds but emits no session.context_changed event). See github/copilot-agent-runtime#12896. The RPC session-state E2E tests set the working directory to a second directory and then reported a third, divergent cwd while waiting for a session.context_changed event. Under the updated contract that event is never emitted, so the C# test timed out. Report the authoritative current cwd (secondDirectory) instead so the event fires, and update the C#, Node, Python, and Go tests accordingly. The Rust test already reported the authoritative cwd and is unchanged. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d99e2065-4f40-4f33-90a6-04b2786ac87f
There was a problem hiding this comment.
Pull request overview
Updates cross-language E2E expectations to reflect the runtime’s authoritative local-session cwd behavior.
Changes:
- Reuses the current session cwd in
recordContextChange. - Updates event assertions and removes obsolete divergent-directory setup.
- Documents the runtime behavior consistently across SDKs.
Show a summary per file
| File | Description |
|---|---|
python/e2e/test_rpc_session_state_e2e.py |
Aligns Python E2E cwd reporting and assertion. |
nodejs/test/e2e/rpc_session_state.e2e.test.ts |
Aligns Node.js E2E cwd reporting and assertion. |
go/internal/e2e/rpc_session_state_e2e_test.go |
Aligns Go E2E cwd reporting and assertion. |
dotnet/test/E2E/RpcSessionStateE2ETests.cs |
Aligns .NET E2E cwd reporting and assertion. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Medium
Cross-SDK Consistency Review ✅This PR makes a consistent test fix across all applicable SDK implementations:
All implementations consistently now report the authoritative No cross-SDK consistency issues found. 🎉 Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
Summary
Fixes a stale E2E expectation exposed by github/copilot-agent-runtime#12896 (merge commit
2654f6e8b3a1b93e7d3122388fb2ab559e4345f3).The runtime now treats a local session's cwd as authoritative: it is changed via
setWorkingDirectory, and arecordContextChangethat reports a divergent cwd is intentionally ignored — the RPC still succeeds, but nosession.context_changedevent is emitted.The RPC session-state E2E tests previously:
seconddirectory viasetWorkingDirectory, thenrecordContextChangewith a third, divergentcwdand waited for asession.context_changedevent.Under the updated contract that event is never emitted, so the C# test
RpcSessionStateE2ETests.Should_Call_Metadata_Snapshot_SetWorkingDirectory_And_RecordContextChangetimes out with:This is observed on copilot-sdk
mainrun live against the runtime CLI by the runtime's non-blocking.github/workflows/copilot-sdk-dotnet-tests.yml— every sampled main run since #12896 merged fails only this test. It is not related to replay recordings (this test does not invoke the model, so it has no snapshot).Fix
Report the authoritative current cwd (
secondDirectory) inrecordContextChangeso thesession.context_changedevent fires, and assert against it. Applied consistently to the tests that had the divergent-cwd expectation:dotnet/test/E2E/RpcSessionStateE2ETests.csnodejs/test/e2e/rpc_session_state.e2e.test.tspython/e2e/test_rpc_session_state_e2e.pygo/internal/e2e/rpc_session_state_e2e_test.goThe Rust test (
rust/tests/e2e/rpc_session_state.rs) already reported the authoritative cwd (reused the samesubdirfor bothset_working_directoryandrecord_context_change), so it is unchanged.Validation
mainat98003c01580e7b4af12f7d8ec7a24a02bf1fa28d, then ran itsscript/test-copilot-sdk-dotnetagainst this PR head (1f35e33e8a3f95a573ee73ffc33380ca0fc404eb): 670 total, 668 passed, 2 skipped, 0 failed.dotnet build test/GitHub.Copilot.SDK.Test.csprojsucceeds (0 warnings, 0 errors).npm run typecheckandprettier --checkpass.ruff check/ruff format --checkpass.go vet ./internal/e2e/andgofmtclean.Related: github/copilot-agent-runtime#12896