Skip to content

Commit a124096

Browse files
MackinnonBuckgithub-actions[bot]CopilotSteveSandersonMS
authored
fix: Go codegen enum prefixes and type name reconciliation (#883)
* Update @github/copilot to 1.0.10-0 - Updated nodejs and test harness dependencies - Re-ran code generators - Formatted generated code * refactor(go): update handwritten files to use prefixed enum constant names Rename all references to copilot session event type and rpc constants to use the new prefixed naming convention matching the generated code: - copilot.SessionCompactionStart -> copilot.SessionEventTypeSessionCompactionStart - copilot.ExternalToolRequested -> copilot.SessionEventTypeExternalToolRequested - copilot.PermissionRequested -> copilot.SessionEventTypePermissionRequested - copilot.ToolExecutionStart -> copilot.SessionEventTypeToolExecutionStart - copilot.AssistantReasoning -> copilot.SessionEventTypeAssistantReasoning - copilot.Abort -> copilot.SessionEventTypeAbort - rpc.Interactive -> rpc.ModeInteractive - rpc.Plan -> rpc.ModePlan - rpc.Warning -> rpc.LevelWarning - rpc.Error -> rpc.LevelError - rpc.Info -> rpc.LevelInfo (and all other constants listed in the rename) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: Go codegen enum prefixes and type name reconciliation - Add 'mcp' to goInitialisms so toPascalCase produces SessionMCP* matching quicktype - Post-process enum constants to use canonical Go TypeNameValue convention (replaces quicktype's Purple/Fluffy/Tentacled prefixes and unprefixed constants) - Reconcile type names: extract actual quicktype-generated struct names and use them in RPC wrapper code instead of recomputing via toPascalCase - Extract field name mappings from quicktype output to handle keyword-avoidance renames - Update all handwritten Go references to use new prefixed constant names Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs: update Go image-input examples to use copilot.AttachmentTypeFile The generated enum constant was renamed from copilot.File to copilot.AttachmentTypeFile to follow Go's TypeNameValue convention. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(codegen): resolve Python type names from quicktype output for acronyms The Python codegen used toPascalCase() to compute type names like SessionMcpListResult, but quicktype generates SessionMCPListResult (uppercase MCP). This caused runtime NameError in Python scenarios. Apply the same approach as go.ts: after quicktype runs, parse the generated output to extract actual class names and build a case-insensitive lookup map. Use resolveType() in emitMethod() and emitRpcWrapper() instead of recomputing names via toPascalCase(). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: update Go E2E tests for agent list and multi-client timeout - TestAgentSelectionRpc: CLI now returns built-in agents, so instead of asserting zero agents, verify no custom agents appear when none configured - TestMultiClient: increase broadcast event timeout from 10s to 30s Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix LogAsync compilation error by adding missing url parameter The generated Rpc.LogAsync method added a 'url' parameter between 'ephemeral' and 'cancellationToken', causing a type mismatch when Session.LogAsync passed cancellationToken as the 4th positional arg. Added the 'url' parameter to Session.LogAsync to match the generated Rpc method signature and pass it through correctly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: address review comments - valuePascal initialisms, Phase 2 regex, add pr/ado - valuePascal now uses goInitialisms so 'url' -> 'URL', 'mcp' -> 'MCP', etc. - Phase 2 regex uses [\s\S]*? to match multi-line func bodies - Added 'pr' and 'ado' to goInitialisms Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Python E2E agent list test for built-in agents The CLI now returns built-in/default agents even when no custom agents are configured. Update the assertion to verify no custom test agent names appear in the list, rather than asserting the list is empty. Matches the pattern used in the Go E2E test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Skip multi-client broadcast test across Go, Python, and C# CLI 1.0.7 no longer delivers broadcast external_tool events to secondary clients. Skip the 'both clients see tool request and completion events' test in all three languages with a clear note. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Revert multi-client broadcast test skips for CLI 1.0.7 Remove the t.Skip/pytest.skip/Fact(Skip=...) additions that were disabling the multi-client broadcast tests across Go, Python, and C#. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: remove mcp/pr/ado from goInitialisms to avoid SessionRpc.MCP rename resolveType() already handles type name reconciliation from quicktype output, so these initialisms aren't needed and would cause an unnecessary breaking change to the SessionRpc.Mcp field name. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Another Go codegen fix after rebase * Regenerate code * Python formatting Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com> * Type name update Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Python codegen Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com> * fix: update copilot.Blob to copilot.AttachmentTypeBlob and fix Python Optional codegen - Update Go E2E test, README, and docs to use prefixed enum constant - Fix Python codegen modernizePython to handle deeply nested Optional types - Fix ruff formatting in e2e/test_multi_client.py Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Steve Sanderson <SteveSandersonMS@users.noreply.github.com>
1 parent d82fd62 commit a124096

File tree

29 files changed

+5053
-659
lines changed

29 files changed

+5053
-659
lines changed

docs/features/image-input.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func main() {
121121
Prompt: "Describe what you see in this image",
122122
Attachments: []copilot.Attachment{
123123
{
124-
Type: copilot.File,
124+
Type: copilot.AttachmentTypeFile,
125125
Path: &path,
126126
},
127127
},
@@ -147,7 +147,7 @@ session.Send(ctx, copilot.MessageOptions{
147147
Prompt: "Describe what you see in this image",
148148
Attachments: []copilot.Attachment{
149149
{
150-
Type: copilot.File,
150+
Type: copilot.AttachmentTypeFile,
151151
Path: &path,
152152
},
153153
},
@@ -315,7 +315,7 @@ func main() {
315315
Prompt: "Describe what you see in this image",
316316
Attachments: []copilot.Attachment{
317317
{
318-
Type: copilot.Blob,
318+
Type: copilot.AttachmentTypeBlob,
319319
Data: &base64ImageData,
320320
MIMEType: &mimeType,
321321
DisplayName: &displayName,
@@ -333,7 +333,7 @@ session.Send(ctx, copilot.MessageOptions{
333333
Prompt: "Describe what you see in this image",
334334
Attachments: []copilot.Attachment{
335335
{
336-
Type: copilot.Blob,
336+
Type: copilot.AttachmentTypeBlob,
337337
Data: &base64ImageData, // base64-encoded string
338338
MIMEType: &mimeType,
339339
DisplayName: &displayName,

0 commit comments

Comments
 (0)