Skip to content

Handle empty session fork behavior in E2E tests#1247

Merged
stephentoub merged 1 commit intomainfrom
stephentoub/fix-fork-test
May 10, 2026
Merged

Handle empty session fork behavior in E2E tests#1247
stephentoub merged 1 commit intomainfrom
stephentoub/fix-fork-test

Conversation

@stephentoub
Copy link
Copy Markdown
Collaborator

Runtime behavior changed so forking a newly-created session with no persisted conversation can either fail with the older "no persisted events" error or return a successful empty fork. The SDK E2E tests should accept both behaviors while still confirming that sessions.fork is implemented and produces a sensible fork when it succeeds.

Changes

  • Updates the empty-session fork E2E test in C#, Node, Python, and Go to accept either the old error or a successful empty fork.
  • Verifies successful empty forks have a non-empty, distinct session ID and no conversation messages.
  • Marks the C# test project explicitly with IsTestProject=true so dotnet test discovers and runs the xUnit tests with the installed SDK.

Validation

  • Normal SDK CLI resolution: targeted C#, Node, Python, and Go empty-session fork tests passed.
  • COPILOT_CLI_PATH=D:\repos\copilot-agent-runtime\dist-cli\index.js: targeted C#, Node, Python, and Go empty-session fork tests passed.

Allow the empty-session fork tests to accept either the older runtime error or a successful empty fork, and apply the expectation across C#, Node, Python, and Go.

Also mark the C# test project explicitly as a test project so dotnet test discovers the xUnit tests with newer SDKs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 10, 2026 03:25
@stephentoub stephentoub requested a review from a team as a code owner May 10, 2026 03:25
Copy link
Copy Markdown
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

Updates multi-language E2E coverage to tolerate the runtime’s new “empty session fork” behavior (either the historical error or a successful empty fork), while still validating that sessions.fork is implemented and produces a sensible result when it succeeds.

Changes:

  • Adjusts empty-session fork E2E tests (Python/Node/Go/.NET) to accept either an expected “no persisted events” failure or a successful empty fork.
  • Adds assertions for the success case: fork session ID is non-empty/distinct, and the forked session has no conversation messages.
  • Marks the .NET test project as a test project (IsTestProject=true) to improve dotnet test discovery.
Show a summary per file
File Description
python/e2e/test_rpc_session_state_e2e.py Accepts either error or successful empty fork; validates empty conversation on success.
nodejs/test/e2e/rpc_session_state.e2e.test.ts Accepts either error or successful empty fork; resumes fork to validate empty conversation on success.
go/internal/e2e/rpc_session_state_e2e_test.go Accepts either error or successful empty fork; validates non-empty new session ID and empty conversation on success.
dotnet/test/GitHub.Copilot.SDK.Test.csproj Sets IsTestProject=true for improved xUnit discovery via dotnet test.
dotnet/test/E2E/RpcSessionStateE2ETests.cs Accepts either error or successful empty fork; validates new session ID and empty conversation on success.

Copilot's findings

  • Files reviewed: 5/5 changed files
  • Comments generated: 0

@github-actions
Copy link
Copy Markdown
Contributor

Cross-SDK Consistency Review ✅

This PR updates the empty-session fork E2E test across all four SDK implementations (Node.js, Python, Go, .NET) with consistent behavior.

All four SDKs equivalently:

  • Rename the test to reflect the dual-outcome expectation
  • Accept both the legacy error response and a successful empty fork
  • On error: assert the message contains "not found or has no persisted events" and does not contain "unhandled method sessions.fork"
  • On success: assert the fork has a non-empty, distinct session ID and zero conversation messages
  • Properly disconnect sessions on all code paths (including the Go test, which now correctly adds defer session.Disconnect())

No cross-language inconsistencies were found. Language-idiomatic differences (Go's defer, .NET's Record.ExceptionAsync, Python's try/except) are appropriate and don't affect the semantic behavior being tested.

Generated by SDK Consistency Review Agent for issue #1247 · ● 153.5K ·

@stephentoub stephentoub merged commit f625779 into main May 10, 2026
41 checks passed
@stephentoub stephentoub deleted the stephentoub/fix-fork-test branch May 10, 2026 03:37
Copy link
Copy Markdown

@stomde stomde left a comment

Choose a reason for hiding this comment

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

Gees

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