Skip to content

Fix .NET E2E auth setup#1334

Merged
stephentoub merged 1 commit into
mainfrom
stephentoub/investigate-auth-e2e
May 19, 2026
Merged

Fix .NET E2E auth setup#1334
stephentoub merged 1 commit into
mainfrom
stephentoub/investigate-auth-e2e

Conversation

@stephentoub
Copy link
Copy Markdown
Collaborator

The live runtime can resolve process-level auth differently from the replayed SDK test harness, which caused .NET E2E tests to fail when no per-session token or authenticated resume context was explicitly configured.

Summary

  • Run the per-session no-token auth case with a dedicated no-auth client that clears ambient auth token variables and disables logged-in-user fallback.
  • Run the resume-without-permission-handler test through the E2E context so the TCP server and resume client share the expected test auth/proxy setup while still exercising a missing permission handler.

Validation

  • dotnet test dotnet\test\GitHub.Copilot.SDK.Test.csproj --filter "FullyQualifiedName~PerSessionAuthE2ETests" --no-restore --logger "console;verbosity=minimal"
  • dotnet test dotnet\test\GitHub.Copilot.SDK.Test.csproj --filter "FullyQualifiedName~ClientE2ETests.Should_Allow_ResumeSession_Called_Without_PermissionHandler" --no-restore --logger "console;verbosity=minimal"

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@stephentoub stephentoub requested a review from a team as a code owner May 19, 2026 14:04
Copilot AI review requested due to automatic review settings May 19, 2026 14:04
@github-actions
Copy link
Copy Markdown
Contributor

Cross-SDK Consistency Review ✅

This PR only modifies .NET E2E test infrastructure files — no SDK public API surface is added or changed in any language.

Changes reviewed:

  • ClientE2ETests.cs: Routes the resume-without-permission-handler test through E2ETestContext for consistent auth/proxy setup.
  • PerSessionAuthE2ETests.cs: Adds a CreateNoAuthTestClient() helper that clears ambient auth env vars (COPILOT_SDK_AUTH_TOKEN, GH_TOKEN, GITHUB_TOKEN) and sets UseLoggedInUser = false to guarantee a clean no-auth baseline.

Since these are test harness fixes specific to the .NET project and introduce no new public API methods, parameters, or behavioral changes visible to SDK consumers, no cross-language updates are needed. The changes maintain cross-SDK consistency.

Generated by SDK Consistency Review Agent for issue #1334 · ● 100.2K ·

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

This PR adjusts the .NET E2E test harness usage to make authentication behavior consistent between the live runtime and the replay-backed test environment, preventing failures caused by ambient/process-level auth resolution.

Changes:

  • Added a dedicated “no-auth” E2E client path for the per-session “no token” scenario that clears common ambient token environment variables and disables logged-in-user fallback.
  • Updated the “resume without permission handler” E2E test to run under E2ETestContext so both the TCP server and resume client share the expected harness proxy/auth setup.
Show a summary per file
File Description
dotnet/test/E2E/PerSessionAuthE2ETests.cs Introduces a no-auth client configuration and uses it for the no-token per-session auth test to avoid ambient auth affecting results.
dotnet/test/E2E/ClientE2ETests.cs Switches the resume-without-permission-handler test to use E2ETestContext-created clients for consistent proxy/auth environment.

Copilot's findings

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

@stephentoub stephentoub merged commit 310cc6c into main May 19, 2026
23 checks passed
@stephentoub stephentoub deleted the stephentoub/investigate-auth-e2e branch May 19, 2026 14:21
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