Skip to content

Fix Go session event attachment aliases#1515

Open
dmytrostruk wants to merge 1 commit into
mainfrom
fix-go-codegen-shared-schema-collisions
Open

Fix Go session event attachment aliases#1515
dmytrostruk wants to merge 1 commit into
mainfrom
fix-go-codegen-shared-schema-collisions

Conversation

@dmytrostruk
Copy link
Copy Markdown
Contributor

@dmytrostruk dmytrostruk commented May 30, 2026

Summary

  • Make Go session-event compatibility aliases conditional so stale aliases are not emitted when the runtime schema promotes a name into shared generated RPC types.
  • Keep this PR scoped to the Attachment / AttachmentType failure from the runtime bump workflow.

Root Cause

Runtime 1.0.57-2 promotes Attachment and related attachment definitions into shared API/session-event schema definitions. Go session-event codegen still always emitted legacy compatibility aliases like Attachment = UserMessageAttachment, but those old UserMessageAttachment* generated names no longer exist once the shared rpc.Attachment* definitions are generated.

That made the runtime bump workflow fail during Go generation with duplicate/stale Attachment and AttachmentType declarations.

Fix

The session-event generator now validates compatibility aliases before emitting them:

  • the target generated name must exist
  • the alias name must not already be generated

With the new runtime schema, Attachment is emitted through the normal shared alias path as Attachment = rpc.Attachment, and the stale UserMessageAttachment* aliases are skipped.

Out of Scope

This PR intentionally does not change ContextTier. If the runtime bump exposes a separate ContextTier duplicate after the Attachment issue is fixed, that should be handled separately from this narrow generator fix.

Validation

  • npm run generate:go
  • npx tsx go.ts <@github/copilot@1.0.57-2 session-events.schema.json> <@github/copilot@1.0.57-2 api.schema.json>
  • git diff --check

@dmytrostruk dmytrostruk requested a review from a team as a code owner May 30, 2026 05:55
Copilot AI review requested due to automatic review settings May 30, 2026 05:55
@github-actions
Copy link
Copy Markdown
Contributor

Cross-SDK Consistency Review ✅

This PR makes targeted changes to Go-specific codegen infrastructure (scripts/codegen/go.ts) and the generated output files (go/types.go, go/zsession_events.go).

No cross-SDK consistency issues found. Here's why:

  • The ContextTier type originates from the shared schema (session-events.schema.json / api.schema.json) and is available to all SDK implementations via their respective code generation pipelines. Moving Go's ContextTier from a manual definition to a generated alias simply aligns Go with how other SDKs already get this type — from the schema.
  • The fix to make compatibility aliases conditional (Attachment, ContextTier) is internal Go codegen logic with no bearing on Python, Node.js, or .NET — those SDKs have separate codegen pipelines.
  • No new public API surface is introduced; the change is source-compatible for existing Go consumers.

This is a housekeeping fix for Go's generated code to stay in sync with the evolving runtime schema, and it does not create any API parity gaps with other language SDKs.

Generated by SDK Consistency Review Agent for issue #1515 · ● 956.9K ·

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 fixes Go code generation so public aliases remain stable when runtime schemas promote formerly event-specific definitions into shared API/session-event definitions.

Changes:

  • Filters legacy Go session-event compatibility aliases so stale or conflicting aliases are skipped.
  • Moves public ContextTier ownership from manual Go code to generated aliases.
  • Regenerates Go public session-event aliases to preserve current-schema compatibility.
Show a summary per file
File Description
scripts/codegen/go.ts Adds alias filtering and legacy ContextTier bridge generation.
go/zsession_events.go Re-exports ContextTier and constants through generated aliases.
go/types.go Removes the manual ContextTier type and constants.

Copilot's findings

Files not reviewed (1)
  • go/zsession_events.go: Language not supported
  • Files reviewed: 2/3 changed files
  • Comments generated: 0

@dmytrostruk dmytrostruk force-pushed the fix-go-codegen-shared-schema-collisions branch from 4201799 to c9e3f88 Compare May 30, 2026 06:04
@dmytrostruk dmytrostruk changed the title Fix Go codegen shared schema alias collisions Fix Go session event attachment aliases May 30, 2026
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