Skip to content

Add .NET BYOK E2E coverage#2010

Merged
roji merged 11 commits into
mainfrom
roji-dotnet-byok-e2e
Jul 17, 2026
Merged

Add .NET BYOK E2E coverage#2010
roji merged 11 commits into
mainfrom
roji-dotnet-byok-e2e

Conversation

@roji

@roji roji commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

The SDK's E2E suites currently validate only the CAPI path, leaving BYOK protocol regressions undetected until later integration stages. This adds .NET coverage for Anthropic Messages, OpenAI Responses, and OpenAI Chat Completions while continuing to use the existing conceptual snapshot corpus. We do this for .NET since we run that in the runtime repo as well for early regression discovery.

  • Adds three E2E test legs to the .NET workflow; each leg takes about 4-5 minutes total and runs in parallel.
  • Clearly CAPI-specific tests have a CapiOnly trait for filtering them out. Failing tests that look like they should be passing on BYOK currently have TODO(BYOK) comments for later investigation.
  • The same snapshots used for CAPI are used for BYOK too, with the replay proxy modified to support other protocols etc.

Approach

  • Add protocol adapters that normalize BYOK requests into the existing canonical Chat Completions representation and render protocol-complete JSON/SSE responses back to the runtime.
  • Select one protocol descriptor per backend so CAPI and BYOK share endpoint routing, canonical matching, errors, response delivery, and exchange inspection.
  • Keep snapshots model-agnostic and reusable across all backends. CAPI remains the sole snapshot-capture path; BYOK replay is explicitly read-only, including compaction replay through the normal snapshot matcher.
  • Select the E2E backend centrally in the .NET fixture, preserving providers and models explicitly configured by individual tests.
  • Add three Ubuntu in-process BYOK legs alongside the existing CAPI matrix without multiplying them across transports or operating systems.
  • Classify CAPI-only and self-configured-backend tests explicitly, and add path-scoped authoring guidance so future .NET E2E tests continue to exercise every provider.

The shared replay harness remains protocol-neutral despite retaining its existing TypeScript class name for compatibility with other SDKs. The .NET wrapper is renamed to ReplayProxy.

Validation

  • Replay harness: 54 tests passed; TypeScript type-check passed.
  • Full CAPI .NET baseline after replay unification: 681 passed, 3 skipped.
  • Anthropic Messages compatible .NET E2E suite: 458 passed, 3 skipped.
  • Streaming and compaction replay scenarios passed for CAPI and all three BYOK protocols.
  • Existing CAPI baseline and all three compatible BYOK suites passed before the final harness simplification; the remaining local full Responses failures reflect current CLI tool-catalog drift against older snapshots (apply_patch/rg versus edit/grep), not response-envelope rendering.

roji added 8 commits July 14, 2026 20:18
Reuse conceptual replay snapshots across Anthropic Messages, OpenAI Responses, and OpenAI Chat Completions, and add three Ubuntu in-process CI legs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 85a40918-bd95-440b-b6e9-97c757a71f8c
Collapse runtime-specific blank-line expansion so conceptual replay snapshots match recovery turns consistently.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 85a40918-bd95-440b-b6e9-97c757a71f8c
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 85a40918-bd95-440b-b6e9-97c757a71f8c
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 85a40918-bd95-440b-b6e9-97c757a71f8c
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 85a40918-bd95-440b-b6e9-97c757a71f8c
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 85a40918-bd95-440b-b6e9-97c757a71f8c
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 85a40918-bd95-440b-b6e9-97c757a71f8c
Make non-CAPI replay explicitly read-only so provider response parsing and SSE aggregation are unnecessary. Keep protocol-complete forward rendering, clarify backend trait naming, and rename the .NET proxy wrapper to reflect its protocol-neutral role.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 85a40918-bd95-440b-b6e9-97c757a71f8c
Comment thread test/harness/replayingCapiProxy.ts Fixed
Comment thread test/harness/responsesApiAdapter.ts Fixed
roji added 2 commits July 17, 2026 00:41
Select a protocol descriptor once per backend so CAPI and BYOK share routing, canonical matching, errors, JSON/SSE responses, and exchange inspection. Replay compaction directly from canonical snapshots instead of synthesizing provider-specific responses.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 85a40918-bd95-440b-b6e9-97c757a71f8c
Preserve both protocol coalescing and stable built-in tool normalization while resolving the replay proxy conflict. Replace UnreachableException with a net472-compatible exception and remove the unused adapter import.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 85a40918-bd95-440b-b6e9-97c757a71f8c
@github-actions

This comment has been minimized.

@roji
roji marked this pull request as ready for review July 17, 2026 07:27
@roji
roji requested a review from a team as a code owner July 17, 2026 07:27
Copilot AI review requested due to automatic review settings July 17, 2026 07:27

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

Adds .NET BYOK E2E coverage by adapting Anthropic and OpenAI protocols to the canonical replay snapshot format.

Changes:

  • Adds Anthropic Messages and OpenAI Responses adapters.
  • Centralizes .NET E2E backend/provider selection.
  • Adds three Ubuntu in-process BYOK CI legs and backend traits.
Show a summary per file
File Description
test/harness/responsesApiAdapter.ts Adapts OpenAI Responses requests and responses.
test/harness/replayingCapiProxy.ts Adds protocol-aware, read-only BYOK replay.
test/harness/modelProtocolAdapterShared.ts Defines shared adapter utilities.
test/harness/modelProtocolAdapters.test.ts Tests adapters and backend replay.
test/harness/anthropicMessagesAdapter.ts Adapts Anthropic Messages requests and responses.
dotnet/test/Unit/E2ETestBackendTests.cs Tests backend configuration.
dotnet/test/Harness/ReplayProxy.cs Renames and configures the replay proxy wrapper.
dotnet/test/Harness/E2ETestContext.cs Applies selected backends to sessions.
dotnet/test/Harness/E2ETestBase.cs Routes session operations through context.
dotnet/test/Harness/E2ETestBackend.cs Defines backend configuration and traits.
dotnet/test/E2E/ToolsE2ETests.cs Uses backend-aware session creation.
dotnet/test/E2E/TelemetryExportE2ETests.cs Uses backend-aware session creation.
dotnet/test/E2E/SuspendE2ETests.cs Uses backend-aware create/resume helpers.
dotnet/test/E2E/SubagentHooksE2ETests.cs Uses backend-aware session creation.
dotnet/test/E2E/StreamingFidelityE2ETests.cs Adds backend classification and resume routing.
dotnet/test/E2E/SessionFsSqliteE2ETests.cs Routes sessions through context.
dotnet/test/E2E/SessionFsE2ETests.cs Routes create/resume operations through context.
dotnet/test/E2E/SessionE2ETests.cs Adds backend classifications and resume routing.
dotnet/test/E2E/SessionConfigE2ETests.cs Classifies provider-specific scenarios.
dotnet/test/E2E/RpcTasksAndHandlersE2ETests.cs Marks a CAPI-only scenario.
dotnet/test/E2E/RpcSessionStateExtrasE2ETests.cs Classifies model/provider tests.
dotnet/test/E2E/RpcSessionStateE2ETests.cs Uses backend-aware session creation.
dotnet/test/E2E/RpcServerE2ETests.cs Classifies and routes RPC session tests.
dotnet/test/E2E/RpcMcpAndSkillsE2ETests.cs Routes sessions through context.
dotnet/test/E2E/RpcExtensionsLoadedE2ETests.cs Routes extension sessions through context.
dotnet/test/E2E/ProviderEndpointE2ETests.cs Classifies provider endpoint tests.
dotnet/test/E2E/PerSessionAuthE2ETests.cs Marks authentication tests CAPI-only.
dotnet/test/E2E/PermissionE2ETests.cs Uses backend-aware resume handling.
dotnet/test/E2E/PendingWorkResumeE2ETests.cs Routes pending-work sessions through context.
dotnet/test/E2E/MultiProviderRegistryE2ETests.cs Marks self-configured provider coverage.
dotnet/test/E2E/MultiClientE2ETests.cs Routes multi-client sessions through context.
dotnet/test/E2E/MultiClientCommandsElicitationE2ETests.cs Routes multi-client command sessions.
dotnet/test/E2E/ModeHandlersE2ETests.cs Marks mode-handler tests CAPI-only.
dotnet/test/E2E/ModeEmptyE2ETests.cs Uses backend-aware session creation.
dotnet/test/E2E/GitHubTelemetryForwardingE2ETests.cs Marks telemetry forwarding CAPI-only.
dotnet/test/E2E/CopilotRequestWebSocketE2ETests.cs Marks self-configured WebSocket coverage.
dotnet/test/E2E/CopilotRequestSessionIdE2ETests.cs Classifies CAPI and BYOK session-ID tests.
dotnet/test/E2E/CopilotRequestCancelErrorE2ETests.cs Routes request-handler sessions through context.
dotnet/test/E2E/ClientOptionsE2ETests.cs Applies backend-aware session helpers.
dotnet/test/E2E/ClientE2ETests.cs Integrates the E2E context fixture.
dotnet/test/E2E/ByokBearerTokenProviderE2ETests.cs Marks explicit BYOK provider tests.
dotnet/test/AssemblyInfo.cs Updates replay proxy terminology.
.github/workflows/dotnet-sdk-tests.yml Adds BYOK CI matrix legs and filtering.
.github/instructions/dotnet-e2e.instructions.md Documents backend-aware E2E authoring.

Review details

  • Files reviewed: 44/44 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment thread dotnet/test/E2E/RpcSessionStateE2ETests.cs Outdated
Comment thread test/harness/responsesApiAdapter.ts
Comment thread test/harness/responsesApiAdapter.ts
Keep initial Responses events in progress and empty until their matching delta and done events, and use the isolated E2E context when injecting a BYOK provider.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 85a40918-bd95-440b-b6e9-97c757a71f8c
@github-actions

Copy link
Copy Markdown
Contributor

SDK Consistency Review

Summary: This PR adds BYOK (Anthropic Messages, OpenAI Responses, OpenAI Chat Completions) E2E test coverage to the .NET SDK harness. It does not modify any SDK public API surface.

Scope

All 44 changed files are in:

  • .github/ — CI workflow and instructions
  • dotnet/test/ — .NET test harness and E2E tests
  • test/harness/ — Shared TypeScript replay harness (new protocol adapters)

No SDK source code is modified in any language.

Cross-SDK Consistency Assessment

No API consistency issues. The public API surface across all six SDKs (Node.js, Python, Go, .NET, Java, Rust) is unchanged.

Informational: BYOK E2E Coverage Gap

The shared replay harness (test/harness/replayingCapiProxy.ts) already supported all four backends (capi, anthropic-messages, openai-responses, openai-completions) via ReplayBackend prior to this PR — the new adapter files just fill in the implementation. This PR wires up .NET to exercise those backends in CI.

The other SDKs (Node.js, Go, Python, Java, Rust) do not yet have equivalent BYOK backend E2E test matrix legs. This is not a defect introduced by this PR — those gaps existed before — but future work could extend this coverage to other SDKs using the same shared harness infrastructure.

Verdict

This PR maintains cross-SDK API consistency. The BYOK E2E infrastructure is additive and non-breaking.

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 #2010 · 75.5 AIC · ⌖ 7.6 AIC · ⊞ 5K ·

@SteveSandersonMS SteveSandersonMS 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.

Excellent - this looks extremely nice.

Very glad to see this detected divergences between the behaviors of different providers. We should look into these as follow-ups.

@roji
roji added this pull request to the merge queue Jul 17, 2026
Merged via the queue into main with commit c4dc3e9 Jul 17, 2026
52 checks passed
@roji
roji deleted the roji-dotnet-byok-e2e branch July 17, 2026 14:13
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.

4 participants