Fix C# canvas action RPC compatibility#1436
Conversation
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>
There was a problem hiding this comment.
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.invokeAction→canvas.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
This comment has been minimized.
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>
Cross-SDK Consistency ReviewThis PR fixes a C# compatibility issue where older runtimes dispatch canvas actions via the legacy Potential consistency gap: The other SDK implementations (Node.js, Python, Go, Java) only register
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 ( 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.
|
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.invokeclient-session method.This keeps the canonical
canvas.invokeActionregistration and also registerscanvas.action.invoketo 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-restoredotnet test dotnet\test\GitHub.Copilot.SDK.Test.csproj --filter "FullyQualifiedName~GitHub.Copilot.Test.Unit.CanvasTests" --no-restore