Skip to content

Fix codegen schema resolution for new @github/copilot package layout#1738

Merged
stephentoub merged 2 commits into
mainfrom
stephentoub-fix-runtime-pull-action
Jun 20, 2026
Merged

Fix codegen schema resolution for new @github/copilot package layout#1738
stephentoub merged 2 commits into
mainfrom
stephentoub-fix-runtime-pull-action

Conversation

@stephentoub

Copy link
Copy Markdown
Collaborator

Why

The "Update @github/copilot Dependency" workflow started failing at the codegen step when bumping to 1.0.64-1:

ENOENT: ... nodejs/node_modules/@github/copilot/schemas/session-events.schema.json

In 1.0.64-1 the @github/copilot CLI package was restructured: the umbrella package became a thin loader (npm-loader.js), and its bundled assets, including api.schema.json and session-events.schema.json, moved into the platform-specific optional-dependency packages (@github/copilot-linux-x64, @github/copilot-win32-x64, etc.). Our codegen scripts hardcoded the old @github/copilot/schemas/... path, which no longer exists.

Approach

Both schema resolvers now check the umbrella package first (older versions), then fall back to scanning the @github scope for any installed @github/copilot-* platform package and reading schemas/<file> from it. This is host-agnostic, so it works on Linux CI and on Windows.

  • scripts/codegen/utils.ts - resolver for the TS/C#/Python/Go/Rust generators
  • java/scripts/codegen/java.ts - resolver for the Java generator (preserves its existing two-location search order)

The Java codegen would have hit the same failure at its later (skipped) step, so it gets the same fix.

Notes

  • The umbrella path is always tried first, so older single-package layouts keep working unchanged.
  • Matching is safe: the exact name @github/copilot does not match the copilot- prefix, and any non-platform match simply fails the fs.access check and falls through. Since all platform packages of a given version ship identical schemas, readdir ordering does not affect correctness.

Validation

Reproduced the real 1.0.64-1 install layout locally and ran both generators end to end. The previously-failing tsx typescript.ts step and the Java generator both resolved schemas from the platform package and succeeded.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

The @github/copilot CLI package became a thin loader in 1.0.64-1 and moved
its bundled JSON schemas into platform-specific packages (e.g.
@github/copilot-win32-x64). The codegen scripts hardcoded the umbrella
package's schemas/ path, which no longer exists, breaking the Update
@github/copilot Dependency workflow.

Resolve schemas by checking the umbrella package first (older versions),
then falling back to whichever @github/copilot-* platform package is
installed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 20, 2026 02:16
@stephentoub stephentoub requested a review from a team as a code owner June 20, 2026 02:16
@stephentoub stephentoub enabled auto-merge June 20, 2026 02:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the schema path resolution logic used by the repo’s code generation scripts to support the new @github/copilot npm package layout introduced in 1.0.64-1, where JSON schemas moved from the umbrella package into platform-specific @github/copilot-* optional dependency packages.

Changes:

  • Add a shared resolver in scripts/codegen/utils.ts that first tries the legacy umbrella path and then scans node_modules/@github for copilot-* platform packages containing the schema.
  • Apply the same fallback strategy to the Java codegen resolver in java/scripts/codegen/java.ts while preserving its existing preference order between scripts/codegen/node_modules and nodejs/node_modules.
Show a summary per file
File Description
scripts/codegen/utils.ts Introduces a host-agnostic schema resolver that falls back to platform-specific @github/copilot-* packages.
java/scripts/codegen/java.ts Updates Java’s schema path resolution to support the new @github/copilot platform-package schema location across both node_modules locations it checks.

Copilot's findings

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

Comment thread scripts/codegen/utils.ts Outdated
Comment thread java/scripts/codegen/java.ts Outdated
Comment thread java/scripts/codegen/java.ts Outdated
@github-actions

This comment has been minimized.

@stephentoub stephentoub disabled auto-merge June 20, 2026 02:22
…gen resolvers

Only swallow ENOENT/ENOTDIR when probing the @github scope directory so
permission/I/O failures are no longer misreported as 'schema not found'.
Also correct the java codegen not-found message to name both install
locations the resolver searches.

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

Copy link
Copy Markdown
Contributor

Cross-SDK Consistency Review ✅

This PR modifies two codegen infrastructure scripts, not SDK client code:

  • scripts/codegen/utils.ts — shared schema resolver used by the TypeScript, C#, Python, Go, and Rust generators
  • java/scripts/codegen/java.ts — Java-specific generator

Both scripts receive an equivalent fix (umbrella-package-first lookup, then platform-specific package fallback), covering all six SDK language generators in a single PR. No public SDK APIs are added, removed, or changed.

No cross-SDK consistency issues found. All language generators are updated uniformly.

Generated by SDK Consistency Review Agent for issue #1738 · sonnet46 565.3K ·

@stephentoub stephentoub merged commit 4685618 into main Jun 20, 2026
19 checks passed
@stephentoub stephentoub deleted the stephentoub-fix-runtime-pull-action branch June 20, 2026 02:35
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