Commit 5f8ae27
committed
Fix codegen and handwritten code for @github/copilot 1.0.35 $ref schema changes
---
## Summary
Updates the Java code generator and handwritten SDK/test code to handle the
`@github/copilot` 1.0.35 schema format, which changed from inline nested type
definitions to `$ref` references pointing to `#/definitions/` entries. Without
this fix, regenerated types were missing fields and the build failed.
75 files changed, 616 insertions(+), 1836 deletions(-)
## Changes
### Code generator (`scripts/codegen/java.ts`)
- Added `resolveRef()` helper to dereference `$ref` pointers in JSON schemas.
- Added `pendingStandaloneTypes` map to collect types referenced via `$ref` and
generate them as top-level Java files instead of nested records.
- Added `generatePendingStandaloneTypes()`, `generateStandaloneEnum()`, and
`generateStandaloneRecord()` to emit the new standalone types.
- Updated all property/field generation paths to resolve `$ref` before
inspecting type, enum, or nested-object shapes.
### Regenerated files (`src/generated/java/`)
- ~65 generated source files updated — nested inner records/enums replaced by
standalone types (e.g. `McpServer`, `Plugin`, `Skill`, `Tool`, `Model`,
`AccountQuotaSnapshot`, `DiscoveredMcpServer`, `UIElicitationSchema`,
`UIElicitationResponseAction`, `ModelCapabilitiesOverride`, etc.).
- Several numeric fields changed from `double` to `Long` (`PingResult`,
`SessionShellExecParams`, model capability limits).
- New RPC API class `ServerMcpConfigApi` and `SessionPermissionsApi` added.
### Handwritten source (`CopilotSession.java`)
- Updated all type references from old nested types to new standalone types
(e.g. `SessionMcpListResultServersItem` → `McpServer`).
### Test files (5 files)
- **`GeneratedRpcRecordsCoverageTest.java`** — Replaced all nested type
references with standalone types; fixed `double` → `Long` constructors.
- **`GeneratedEventTypesCoverageTest.java`** — Updated event type name set.
- **`GeneratedRpcApiCoverageTest.java`** — Updated `workspace` → `workspaces`,
added `SessionLogLevel`, new API classes.
- **`RpcWrappersTest.java`** — `session.workspace` → `session.workspaces`.
- **`SessionEventDeserializationTest.java`** — Updated JSON keys for
`compactionTokensUsed` (`input` → `inputTokens`, `output` → `outputTokens`,
`cachedInput` → `cacheReadTokens`).
### Dependency bump
- `@github/copilot` 1.0.24 → 1.0.35 in `scripts/codegen/package.json`.
- **`.github/workflows/update-copilot-dependency.yml`** — After codegen and PR creation, `mvn verify` is run. On failure, the agentic fix workflow is triggered. Includes a polling loop that waits for the fix to complete and runs a final verification.
## Design
The pipeline follows a two-workflow pattern:
1. **Trigger workflows** (`codegen-check.yml`, `update-copilot-dependency.yml`) detect failures and dispatch the agentic fix.
2. **Fix workflow** (`codegen-agentic-fix.lock.yml`) runs under gh-aw guardrails with scoped permissions, network firewall, and MCP gateway. It checks out the branch, reproduces the failure, applies fixes to handwritten code only, and pushes via `push-to-pull-request-branch` safe-output.
Key constraints enforced on the agent:
- Never modify `src/generated/java/`, `pom.xml`, `scripts/codegen/`, or `.github/`
- Maximum 3 fix attempts before escalating via PR comment
- Must run `mvn spotless:apply` before committing
- Only pushes if `mvn verify` passes
## Testing
- All workflow files pass `actionlint` with zero errors
- The `codegen-agentic-fix.lock.yml` was successfully compiled by `gh aw compile v0.68.3`
- End-to-end testing will occur when this PR and #94 are both merged — Dependabot PR #99 (bump `@github/copilot` 1.0.24 → 1.0.35) already exists and its Codegen Check is failing as expected1 parent 1ab1510 commit 5f8ae27
196 files changed
Lines changed: 4708 additions & 1836 deletions
File tree
- scripts/codegen
- src
- generated/java/com/github/copilot/sdk/generated
- rpc
- main/java/com/github/copilot/sdk
- test/java/com/github/copilot/sdk
- generated
- rpc
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
Lines changed: 1 addition & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments