Skip to content

Codegen Check workflow doesn't detect SDK protocol version drift #1165

@tclem

Description

@tclem

The Codegen Check workflow (.github/workflows/codegen-check.yml) regenerates schema-driven types via cd scripts/codegen && npm run generate and fails if the working tree is dirty. It does not run cd nodejs && npm run update:protocol-version, which is the script that regenerates the per-language SDK protocol version constants:

  • nodejs/src/sdkProtocolVersion.ts
  • dotnet/src/SdkProtocolVersion.cs
  • python/copilot/_sdk_protocol_version.py
  • go/sdk_protocol_version.go
  • rust/src/sdk_protocol_version.rs

Source of truth: sdk-protocol-version.json. If someone edits sdk-protocol-version.json (or hand-edits one of the generated files) without running the script, CI won't catch it. Each SDK can drift independently.

Proposal

Extend codegen-check.yml:

  1. Add an npm run update:protocol-version step after npm run generate.
  2. Extend the paths: trigger to include all the generated outputs and the script itself, so the workflow runs on PRs that touch any of them:
    - 'sdk-protocol-version.json'
    - 'nodejs/scripts/update-protocol-version.ts'
    - 'nodejs/src/sdkProtocolVersion.ts'
    - 'dotnet/src/SdkProtocolVersion.cs'
    - 'python/copilot/_sdk_protocol_version.py'
    - 'go/sdk_protocol_version.go'
    - 'rust/src/sdk_protocol_version.rs'
  3. Update the failure message to mention both regen commands.

Context

I noticed this while working on #1164 (Rust SDK technical preview). I'd originally bundled this fix into that PR but reverted it to keep the Rust port surgical. Tracking it here as a follow-up.

  Generated via Copilot (Claude Opus 4.7) on behalf of @tclem

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions