Skip to content

Report authoritative cwd in recordContextChange E2E tests#2036

Merged
ellismg merged 1 commit into
mainfrom
ellismg-fix-context-change-e2e
Jul 21, 2026
Merged

Report authoritative cwd in recordContextChange E2E tests#2036
ellismg merged 1 commit into
mainfrom
ellismg-fix-context-change-e2e

Conversation

@ellismg

@ellismg ellismg commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

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 a recordContextChange that reports a divergent cwd is intentionally ignored — the RPC still succeeds, but no session.context_changed event is emitted.

The RPC session-state E2E tests previously:

  1. Set the working directory to a second directory via setWorkingDirectory, then
  2. Called recordContextChange with a third, divergent cwd and waited for a session.context_changed event.

Under the updated contract that event is never emitted, so the C# test RpcSessionStateE2ETests.Should_Call_Metadata_Snapshot_SetWorkingDirectory_And_RecordContextChange times out with:

Timeout waiting for session.context_changed event after metadata.recordContextChange

This is observed on copilot-sdk main run 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) in recordContextChange so the session.context_changed event fires, and assert against it. Applied consistently to the tests that had the divergent-cwd expectation:

  • dotnet/test/E2E/RpcSessionStateE2ETests.cs
  • nodejs/test/e2e/rpc_session_state.e2e.test.ts
  • python/e2e/test_rpc_session_state_e2e.py
  • go/internal/e2e/rpc_session_state_e2e_test.go

The Rust test (rust/tests/e2e/rpc_session_state.rs) already reported the authoritative cwd (reused the same subdir for both set_working_directory and record_context_change), so it is unchanged.

Validation

  • Definitive cross-repo compatibility: built github/copilot-agent-runtime main at 98003c01580e7b4af12f7d8ec7a24a02bf1fa28d, then ran its script/test-copilot-sdk-dotnet against this PR head (1f35e33e8a3f95a573ee73ffc33380ca0fc404eb): 670 total, 668 passed, 2 skipped, 0 failed.
  • C#: dotnet build test/GitHub.Copilot.SDK.Test.csproj succeeds (0 warnings, 0 errors).
  • Node: npm run typecheck and prettier --check pass.
  • Python: ruff check / ruff format --check pass.
  • Go: go vet ./internal/e2e/ and gofmt clean.

Related: github/copilot-agent-runtime#12896

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
Copilot AI review requested due to automatic review settings July 20, 2026 23:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@github-actions

Copy link
Copy Markdown
Contributor

Cross-SDK Consistency Review ✅

This PR makes a consistent test fix across all applicable SDK implementations:

  • .NET (C#): Updated RpcSessionStateE2ETests.cs
  • Node.js: Updated rpc_session_state.e2e.test.ts
  • Python: Updated test_rpc_session_state_e2e.py
  • Go: Updated rpc_session_state_e2e_test.go
  • Rust: Already correct — no changes needed (noted in commit message)
  • Java: No E2E test for this scenario — not a consistency gap introduced by this PR

All implementations consistently now report the authoritative cwd (secondDirectory) when calling recordContextChange, rather than a divergent third directory, aligning with the updated runtime contract.

No cross-SDK consistency issues found. 🎉

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

Generated by SDK Consistency Review Agent for #2036 · 13.8 AIC · ⌖ 7.55 AIC · ⊞ 5K ·

@ellismg
ellismg marked this pull request as ready for review July 21, 2026 00:27
@ellismg
ellismg requested a review from a team as a code owner July 21, 2026 00:27
@ellismg
ellismg enabled auto-merge July 21, 2026 00:35
@ellismg
ellismg added this pull request to the merge queue Jul 21, 2026
Merged via the queue into main with commit 1f5516e Jul 21, 2026
84 of 85 checks passed
@ellismg
ellismg deleted the ellismg-fix-context-change-e2e branch July 21, 2026 00:53
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.

3 participants