Skip to content

Java SDK: sync reference implementation to ^1.0.52-1, add preMcpToolCall hook, fix PingResponse timestamp type#1388

Closed
edburns wants to merge 4 commits into
github:mainfrom
edburns:edburns/java-copilot-cli-upgrade-49-52
Closed

Java SDK: sync reference implementation to ^1.0.52-1, add preMcpToolCall hook, fix PingResponse timestamp type#1388
edburns wants to merge 4 commits into
github:mainfrom
edburns:edburns/java-copilot-cli-upgrade-49-52

Conversation

@edburns
Copy link
Copy Markdown
Collaborator

@edburns edburns commented May 22, 2026

XL — Regenerated RPC types from @github/copilot schema update (288 files)

Upgrading the reference implementation version from ^1.0.49-1 to ^1.0.52-1
required updating the @github/copilot npm package in scripts/codegen/, which
brought in schema changes. The Java code generator (java.ts) was updated to
handle these schema changes, and all generated types were regenerated.

  • 222 new generated RPC types under src/generated/java/ (new API surfaces:
    SessionEventLogApi, SessionMetadataApi, SessionQueueApi, SessionTasksApi,
    SessionUiApi, SessionOptionsApi, SessionLspApi, SessionMcpApi,
    SessionScheduleApi, permission location/path/URL config types, and more)
  • 66 modified generated files (field type changes, new fields, new enum values)
  • Updated scripts/codegen/java.ts to handle new schema patterns
  • Updated scripts/codegen/package.json and package-lock.json

These are all machine-generated. Human review should focus on the java.ts
codegen script changes; the generated output can be spot-checked.

M — Port preMcpToolCall hook (6 files)

New hook that fires before an MCP tool call is dispatched to an MCP server,
giving SDK consumers the ability to inspect or modify the call.

  • New: PreMcpToolCallHandler.java (functional interface)
  • New: PreMcpToolCallHookInput.java (input DTO with server name, tool name, arguments)
  • New: PreMcpToolCallHookOutput.java (output DTO with allow/deny/modify)
  • Modified: SessionHooks.java (added onPreMcpToolCall field, getter, setter, hasHooks check)
  • Modified: CopilotSession.java (dispatch "preMcpToolCall" hook name to handler)
  • New test: PreMcpToolCallHookTest.java (unit tests for the new hook)

S — Fix PingResponse timestamp type (2 files)

The CLI server changed the ping response timestamp from a numeric epoch
(long) to an ISO 8601 string. Updated PingResponse record field from
long timestamp to String timestamp, and updated CopilotClientTest
accordingly.

S — SessionLogParams constructor change (1 file)

SessionLogParams gained new nullable fields in the schema. Updated the
call site in CopilotSession.log() to pass the additional null parameters.

S — Test maintenance (4 files)

  • McpAndAgentsTest: new E2E test for MCP and agents scenario
  • PermissionsTest: minor test adjustment
  • SessionEventDeserializationTest: updated assertions to match new generated types
  • GeneratedRpcRecordsCoverageTest: updated coverage list for new generated types

S — Infra / metadata (3 files)

  • .lastmerge: updated to f4d22d70016c377881d86e4c77f8a3f93746ffae
  • pom.xml: ref-impl version property updated to ^1.0.52-1
  • .github/workflows/copilot-setup-steps.yml: bump gh-aw setup-cli to v0.74.8

edburns added 4 commits May 21, 2026 17:58
Implement Phase 03 of the Java-to-monorepo migration plan, adapting
the Java SDK's publishing and testing automation for the monorepo
structure.

Changes:
- java-publish-maven.yml: add working-directory, use java/v tag prefix,
  scope secrets to Java
- java-publish-snapshot.yml: add working-directory for monorepo
- java-smoke-test.yml: new workflow running smoke tests on JDK 17 and
  JDK 25 with globally installed Copilot CLI (version pinned from
  pom.xml)
- java.notes.template: release notes template for GitHub Releases
- update-changelog.sh: script to update CHANGELOG.md during release,
  generating compare links with java/v tag prefix
- test-update-changelog.sh: tests for the changelog update script
- TestUtil.java: align findCliPath() Javadoc with actual resolution
  order (COPILOT_CLI_PATH first, then PATH search)
- pom.xml: update copilot-sdk-ref-impl version property
…t for java/v* and rust/v* scoped tags.

Address [comments](github#1369 (comment)) from @stephentoub .

.github/scripts/release/update-changelog.sh (deleted): Custom awk-based script that maintained java/CHANGELOG.md is no longer needed.
.github/scripts/release/test-update-changelog.sh (deleted): Tests for the above script.
.github/workflows/java-publish-maven.yml: Remove update-changelog.sh call and CHANGELOG.md from git-add; add "Trigger changelog generation" step that invokes release-changelog.lock.yml with the java/v* tag.
.github/workflows/release-changelog.md: Surgical additions to handle language-prefixed tags (java/v*, rust/v*) — scoped previous-tag lookup, scoped file filtering, scoped code snippets, and scoped heading format in CHANGELOG.md.
.github/workflows/release-changelog.lock.yml: Recompiled from release-changelog.md via `gh aw compile`.
java/CHANGELOG.md (deleted): No longer maintaining a Java-specific changelog; releases flow through the root CHANGELOG.md via the release-changelog agent.
@edburns edburns requested a review from a team as a code owner May 22, 2026 21:53
Copilot AI review requested due to automatic review settings May 22, 2026 21:53
@edburns edburns marked this pull request as draft May 22, 2026 21:56
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 updates the Java SDK to match a newer reference implementation/schema, adds a new preMcpToolCall hook, and adjusts Java release/test automation to support scoped Java tags and changelog generation.

Changes:

  • Update Java test utilities to prefer COPILOT_CLI_PATH over PATH lookup for locating the Copilot CLI.
  • Refine release-changelog workflow guidance to support language-scoped tags (e.g., java/v*) and scoped release note generation.
  • Update Java release workflows to use java/v* tag naming and introduce a Java smoke-test workflow plus a Java-specific release notes template.
Show a summary per file
File Description
java/src/test/java/com/github/copilot/sdk/TestUtil.java Changes CLI path resolution order to prefer COPILOT_CLI_PATH.
java/CHANGELOG.md Removes the Java-specific changelog file (workflow/docs appear to move toward centralized/scoped changelog automation).
.github/workflows/release-changelog.md Updates changelog generator instructions for scoped tags and scoped-language snippets.
.github/workflows/release-changelog.lock.yml Regenerates the locked workflow to reflect the updated prompt/config.
.github/workflows/java.notes.template Adds a Java-specific GitHub Release notes template for Maven publishing.
.github/workflows/java-smoke-test.yml Adds a Java smoke test workflow for JDK 17 and JDK 25 using the Copilot CLI.
.github/workflows/java-publish-snapshot.yml Sets default working directory to ./java and updates naming.
.github/workflows/java-publish-maven.yml Switches Java release tags to java/v*, uses Java notes template, and triggers changelog generation workflow.

Copilot's findings

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

Comment on lines +230 to 233
- name: Trigger changelog generation
run: gh workflow run release-changelog.lock.yml -f tag="java/v${{ needs.publish-maven.outputs.version }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Comment on lines +40 to +46
VERSION=$(sed -n "s|.*<${PROP}>\(.*\)</${PROP}>.*|\1|p" pom.xml | head -n 1 | tr -d '[:space:]')
if [[ -z "$VERSION" || "$VERSION" == "PRIMER_TO_REPLACE" ]]; then
echo "::error::Could not read pinned @github/copilot version from pom.xml property <${PROP}>" >&2
exit 1
fi
echo "Pinned @github/copilot version: $VERSION"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
@edburns edburns closed this May 22, 2026
@edburns edburns deleted the edburns/java-copilot-cli-upgrade-49-52 branch May 22, 2026 22:01
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