Skip to content

Commit 5f8ae27

Browse files
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 expected
1 parent 1ab1510 commit 5f8ae27

196 files changed

Lines changed: 4708 additions & 1836 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

scripts/codegen/java.ts

Lines changed: 236 additions & 22 deletions
Large diffs are not rendered by default.

scripts/codegen/package-lock.json

Lines changed: 28 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/codegen/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"generate:java": "tsx java.ts"
88
},
99
"dependencies": {
10-
"@github/copilot": "1.0.24",
10+
"@github/copilot": "^1.0.35",
1111
"json-schema": "^0.4.0",
1212
"tsx": "^4.20.6"
1313
}

src/generated/java/com/github/copilot/sdk/generated/AssistantMessageEvent.java

Lines changed: 1 addition & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/generated/java/com/github/copilot/sdk/generated/AssistantMessageToolRequest.java

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/generated/java/com/github/copilot/sdk/generated/AssistantMessageToolRequestType.java

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/generated/java/com/github/copilot/sdk/generated/AssistantUsageCopilotUsage.java

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/generated/java/com/github/copilot/sdk/generated/AssistantUsageCopilotUsageTokenDetail.java

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/generated/java/com/github/copilot/sdk/generated/AssistantUsageEvent.java

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

Comments
 (0)