Skip to content

Fix C# canvas action RPC compatibility#1436

Open
stephentoub wants to merge 2 commits into
mainfrom
stephentoub/fix-csharp-sdk-ci-tests
Open

Fix C# canvas action RPC compatibility#1436
stephentoub wants to merge 2 commits into
mainfrom
stephentoub/fix-csharp-sdk-ci-tests

Conversation

@stephentoub
Copy link
Copy Markdown
Collaborator

The copilot-agent-runtime CI leg runs the latest C# SDK tests against the live runtime, and the canvas action test was failing because that runtime still dispatches the legacy canvas.action.invoke client-session method.

This keeps the canonical canvas.invokeAction registration and also registers canvas.action.invoke to the same C# canvas handler path. The C# code generator now emits that compatibility alias so regenerated RPC sources preserve the fix.

Tests:

  • dotnet build dotnet\src\GitHub.Copilot.SDK.csproj --no-restore
  • dotnet test dotnet\test\GitHub.Copilot.SDK.Test.csproj --filter "FullyQualifiedName~GitHub.Copilot.Test.Unit.CanvasTests" --no-restore

Register the legacy canvas.action.invoke client-session method alongside canvas.invokeAction so runtimes that still dispatch the older method can reach the C# canvas handler.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 26, 2026 19:50
@stephentoub stephentoub requested a review from a team as a code owner May 26, 2026 19:50
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 restores compatibility between the .NET/C# SDK and older runtimes that still dispatch canvas action callbacks using the legacy client-session JSON-RPC method name canvas.action.invoke, by registering it as an alias of the canonical canvas.invokeAction handler path (and baking that into the C# code generator so regeneration preserves it).

Changes:

  • Update the C# code generator to emit a compatibility alias registration for canvas.invokeActioncanvas.action.invoke.
  • Regenerate the .NET RPC registration code to register both method names to the same canvas handler.
  • Update .NET XML docs to mention the legacy method name.
Show a summary per file
File Description
scripts/codegen/csharp.ts Adds a helper to emit additional client-session RPC registrations for specific methods (canvas invokeAction legacy alias).
dotnet/src/Types.cs Updates CanvasHandler XML docs to mention legacy canvas.action.invoke.
dotnet/src/Generated/Rpc.cs Registers canvas.action.invoke to the same handler as canvas.invokeAction.
dotnet/src/Canvas.cs Updates ICanvasHandler XML docs to mention legacy canvas.action.invoke (needs a small grammar fix).

Copilot's findings

  • Files reviewed: 3/4 changed files
  • Comments generated: 2

Comment thread dotnet/src/Canvas.cs Outdated
Comment thread dotnet/src/Generated/Rpc.cs
@github-actions

This comment has been minimized.

Fix the canvas handler XML doc grammar and add JSON-RPC coverage that verifies the legacy canvas.action.invoke alias reaches the same generated client-session handler as canvas.invokeAction.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

Cross-SDK Consistency Review

This PR fixes a C# compatibility issue where older runtimes dispatch canvas actions via the legacy canvas.action.invoke method name instead of the canonical canvas.invokeAction. The fix registers both method names to the same handler.

Potential consistency gap: The other SDK implementations (Node.js, Python, Go, Java) only register canvas.invokeAction and do not have the equivalent canvas.action.invoke legacy alias:

  • Node.js (nodejs/src/generated/rpc.ts line ~11458): connection.onRequest("canvas.invokeAction", ...) — no legacy alias
  • Python (python/copilot/generated/rpc.py line ~18183): client.set_request_handler("canvas.invokeAction", ...) — no legacy alias
  • Go (go/rpc/zrpc.go line ~12114): client.SetRequestHandler("canvas.invokeAction", ...) — no legacy alias
  • Java: Similar pattern, no legacy alias

If the older runtime affecting C# CI is also used in CI legs for the other languages, those SDKs may have the same latent bug. It's worth checking whether the other language CI legs run against the same runtime version, and if so, applying the same compatibility alias to their codegens (scripts/codegen/typescript.ts, scripts/codegen/python.ts, scripts/codegen/go.ts, and the Java codegen).

That said, if only the C# CI leg uses the older runtime, this PR is appropriately scoped and the other SDKs are fine as-is.

Generated by SDK Consistency Review Agent for issue #1436 · ● 3.5M ·

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.

2 participants