Conversation
… reference implementation Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
…ries Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
…tionDirectories Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
…om.xml CLI version, and update scripts/codegen @github/copilot version Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Auto-committed by codegen-check workflow.
|
@copilot Fix the 3 remaining test compilation errors. Do NOT edit any file under The errors (from the Codegen Check run):
After fixing, run |
Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Fixed all 3 compilation errors in
|
There was a problem hiding this comment.
Pull request overview
Ports several configuration and protocol features from the upstream reference implementation into the Java SDK, improving CLI process configuration, TCP security, and session instruction discovery while aligning tests/docs with updated schemas.
Changes:
- Add
copilotHome(setsCOPILOT_HOME) andtcpConnectionToken(supports authenticated TCP viaconnect, with legacypingfallback). - Add
instructionDirectoriessupport to both session create and resume requests. - Update docs/tests and regenerated schema types to match the newer reference implementation version.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/com/github/copilot/sdk/CopilotClient.java | Adds TCP connection token validation, auto-token generation for SDK-spawned TCP, and connect-based protocol handshake with fallback to ping. |
| src/main/java/com/github/copilot/sdk/CliServerManager.java | Passes COPILOT_HOME and COPILOT_CONNECTION_TOKEN environment variables to spawned CLI process. |
| src/main/java/com/github/copilot/sdk/SessionRequestBuilder.java | Wires instructionDirectories into session.create and session.resume request payloads. |
| src/main/java/com/github/copilot/sdk/json/CopilotClientOptions.java | Adds copilotHome and tcpConnectionToken options and cloning support. |
| src/main/java/com/github/copilot/sdk/json/SessionConfig.java | Adds instructionDirectories field, accessors, and cloning support. |
| src/main/java/com/github/copilot/sdk/json/ResumeSessionConfig.java | Adds instructionDirectories field, accessors, and cloning support. |
| src/main/java/com/github/copilot/sdk/json/CreateSessionRequest.java | Adds instructionDirectories JSON property to create-session wire request. |
| src/main/java/com/github/copilot/sdk/json/ResumeSessionRequest.java | Adds instructionDirectories JSON property to resume-session wire request. |
| src/test/java/com/github/copilot/sdk/CopilotClientTest.java | Adds tests for tcpConnectionToken validation and copilotHome option persistence. |
| src/test/java/com/github/copilot/sdk/ConfigCloneTest.java | Ensures new options/config fields clone correctly and list independence is preserved. |
| src/test/java/com/github/copilot/sdk/SessionEventHandlingTest.java | Updates event construction to match new generated AssistantMessageEventData signature. |
| src/test/java/com/github/copilot/sdk/SessionEventDeserializationTest.java | Adjusts permission-completed assertions after schema changed result to Object. |
| src/test/java/com/github/copilot/sdk/generated/rpc/GeneratedRpcRecordsCoverageTest.java | Updates generated RPC record coverage test for new SessionUsageGetMetricsResult fields/order. |
| src/test/java/com/github/copilot/sdk/SessionConfigE2ETest.java | Adds (currently disabled) E2E tests intended to validate instructionDirectories behavior. |
| src/site/markdown/setup.md | Documents TCP connection token usage and adds copilotHome/tcpConnectionToken to the options table. |
| src/site/markdown/advanced.md | Documents instructionDirectories usage for create/resume. |
| scripts/codegen/package.json | Bumps @github/copilot used for code generation inputs. |
| scripts/codegen/package-lock.json | Locks updated @github/copilot dependency graph. |
| pom.xml | Updates the tracked reference-implementation CLI version property. |
| .lastmerge | Updates the recorded reference-implementation commit hash. |
| src/generated/java/com/github/copilot/sdk/generated/UserMessageEvent.java | Regenerated: adds parentAgentTaskId. |
| src/generated/java/com/github/copilot/sdk/generated/ToolExecutionStartEvent.java | Regenerated: adds turnId. |
| src/generated/java/com/github/copilot/sdk/generated/ToolExecutionCompleteEvent.java | Regenerated: adds turnId. |
| src/generated/java/com/github/copilot/sdk/generated/ShutdownTokenDetail.java | Regenerated: new type for shutdown token details. |
| src/generated/java/com/github/copilot/sdk/generated/ShutdownModelMetricTokenDetail.java | Regenerated: new type for shutdown model token details. |
| src/generated/java/com/github/copilot/sdk/generated/ShutdownModelMetric.java | Regenerated: adds nano-AI units + token detail map. |
| src/generated/java/com/github/copilot/sdk/generated/SessionShutdownEvent.java | Regenerated: adds nano-AI units + token details. |
| src/generated/java/com/github/copilot/sdk/generated/SessionResumeEvent.java | Regenerated: adds sessionWasActive and continuePendingWork. |
| src/generated/java/com/github/copilot/sdk/generated/SessionEvent.java | Regenerated: registers new assistant.message_start subtype. |
| src/generated/java/com/github/copilot/sdk/generated/rpc/UsageMetricsTokenDetail.java | Regenerated: new type for token details. |
| src/generated/java/com/github/copilot/sdk/generated/rpc/UsageMetricsModelMetricTokenDetail.java | Regenerated: new type for per-model token details. |
| src/generated/java/com/github/copilot/sdk/generated/rpc/UsageMetricsModelMetric.java | Regenerated: adds nano-AI units + token detail map. |
| src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUsageGetMetricsResult.java | Regenerated: adds nano-AI units + token details at session scope. |
| src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSuspendParams.java | Regenerated: new params record for session.suspend. |
| src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRpc.java | Regenerated: adds session.suspend() helper. |
| src/generated/java/com/github/copilot/sdk/generated/rpc/ServerRpc.java | Regenerated: adds connect() helper. |
| src/generated/java/com/github/copilot/sdk/generated/rpc/ConnectResult.java | Regenerated: new connect result schema. |
| src/generated/java/com/github/copilot/sdk/generated/rpc/ConnectParams.java | Regenerated: new connect params schema. |
| src/generated/java/com/github/copilot/sdk/generated/PermissionCompletedEvent.java | Regenerated: changes result type to Object. |
| src/generated/java/com/github/copilot/sdk/generated/McpOauthRequiredStaticClientConfig.java | Regenerated: adds optional grantType. |
| src/generated/java/com/github/copilot/sdk/generated/CompactionCompleteCompactionTokensUsedCopilotUsage.java | Regenerated: doc wording update for nano-AI units. |
| src/generated/java/com/github/copilot/sdk/generated/AssistantUsageCopilotUsage.java | Regenerated: doc wording update for nano-AI units. |
| src/generated/java/com/github/copilot/sdk/generated/AssistantMessageStartEvent.java | Regenerated: new assistant.message_start event type. |
| src/generated/java/com/github/copilot/sdk/generated/AssistantMessageEvent.java | Regenerated: adds turnId. |
Copilot's findings
Files not reviewed (1)
- scripts/codegen/package-lock.json: Language not supported
- Files reviewed: 18/44 changed files
- Comments generated: 6
edburns
left a comment
There was a problem hiding this comment.
@copilot The instructionDirectories test snapshots from github/copilot-sdk PR #1190 have been merged. Remove the @disabled annotations from both tests in SessionConfigE2ETest.java and run mvn verify to confirm they pass. The test harness in target/copilot-sdk/ may need to be refreshed first — run mvn generate-test-resources to re-clone it with the latest snapshots.
|
@copilot The |
…ange parsing Agent-Logs-Url: https://github.com/github/copilot-sdk-java/sessions/cad2855d-0ec3-43e1-acef-49e96848b902 Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Done in
Done in |
…llow null copilotHome, strengthen permission test assertion, add instructionDirectories unit tests Agent-Logs-Url: https://github.com/github/copilot-sdk-java/sessions/bf21fd78-4e30-40e7-8e6b-536294818f16 Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Before the change?
CopilotClient.verifyProtocolVersionused a hand-rolledConnectResultrecord and an untypedHashMapto call theconnectRPC, risking drift with the schema and sendingtoken: nullwhen no token applies.CopilotClientOptions.setCopilotHomerejectednullwithObjects.requireNonNull, inconsistent with the .NET and Node.js reference implementations which allow null to mean "use CLI default".testParsePermissionCompletedEventonly assertedresultwas non-null after the field changed toObject, providing weak coverage.instructionDirectorieswiring inSessionRequestBuilderhad no active unit test coverage (E2E tests were the only coverage).After the change?
ConnectResultrecord and untypedMapwith the generatedConnectParamsandgenerated.rpc.ConnectResulttypes. SinceConnectParamsuses@JsonInclude(NON_NULL), a null token is simply omitted from the wire payload.setCopilotHomenow acceptsnull(matching .NET/Node.js behavior). Javadoc documents thatnullmeans "don't setCOPILOT_HOMEon the spawned process, letting the CLI use its default (~/.copilot)".testParsePermissionCompletedEventnow castsresulttoMap<String, Object>and assertskindequals"approved", matching the pattern used intestParsePermissionRequestedEvent.testBuildCreateRequestPropagatesInstructionDirectoriesandtestBuildResumeRequestPropagatesInstructionDirectoriesinSessionRequestBuilderTestto verify propagation into wire requests.Pull request checklist
mvn spotless:applyhas been run to format the codemvn clean verifypasses locallyDoes this introduce a breaking change?