You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Achieve 100% test parity between the InProcess (FFI) transport and the existing out-of-process (stdio/TCP) transport. Every Surefire unit test and Failsafe integration test that runs under the default transport must also run under the InProcess transport, or be explicitly annotated with @SkipInProcess with a documented reason.
Branch:edburns/1917-java-embed-rust-cli-runtime-post-agentic-01-test-parity on upstream
Plan and supporting resources
On the edburns/1917-java-embed-rust-cli-runtime-post-agentic-01-test-parity branch, the directory 1917-java-embed-rust-cli-runtime-remove-before-merge contains the plan (1917-embed-cli-runtime-ignorance-reduction-plan.md) and supporting resources (spikes, prototypes, diagrams).
Read the entire plan before working.
Relevant plan sections to carefully re-read
Section 3.11 — E2E testing with InProcess transport — Resolution: Read the full evidence in 1917-java-embed-rust-cli-runtime-remove-before-merge/spike-3-11-replay-proxy-and-in-process/. Key answers:
Replay proxy works with InProcess — the replay proxy intercepts HTTP calls to COPILOT_API_URL. The runtime reads COPILOT_API_URL from the native process environment block.
Use real runtime.node binary — from the copilot-native module.
No mock native library for E2E — only unit tests use mocks.
Reuse existing YAML snapshots — HTTP traffic is identical regardless of transport.
Run full E2E suite under both transports — subprocess (existing job A) and InProcess (new job B with -Pinprocess Maven profile).
InProcessEnvGuard requirement — calls SetEnvironmentVariableW (Windows) or setenv() (Linux/macOS) via JNA to mutate process environment before host_start. Restores on close(). Already implemented in com.github.copilot.ffi.InProcessEnvGuard.
Concurrency must be 1 — InProcessEnvGuard mutates process-global state. Use surefire.forkCount=1 or JUnit 5 @ResourceLock.
@SkipInProcess annotation — Already implemented in com.github.copilot.e2e.SkipInProcess. JUnit 5 condition annotation for tests incompatible with InProcess transport (e.g., per-client environment variables — see issue [Tracking] In-process (FFI) items to be cleaned up #1934).
Hard scope invariant: Linux-x64 only. No other platform E2E tests in this phase.
Current state
The following infrastructure already exists on the branch:
InProcessEnvGuard in com.github.copilot.ffi — sets/restores native env vars via JNA.
@SkipInProcess annotation in com.github.copilot.e2e — JUnit 5 condition for skipping incompatible tests.
@RequireInProcess annotation in com.github.copilot.e2e — JUnit 5 condition for InProcess-only tests.
InProcessTransportIT — single Failsafe smoke test that passes under -Pinprocess.
-Pinprocess Maven profile — activates InProcess transport for Failsafe.
java-sdk-inprocess CI job — runs mvn clean verify -Pinprocess.
Identified gaps
Gap 1: Failsafe IT parity
The -Pinprocess profile failsafe configuration only includes **/InProcessTransportIT.java. The other 6 ITs are excluded:
ErgonomicToolDefinitionIT
GitHubTelemetryForwardingIT
InternalExecutorProviderIT
LowLevelToolDefinitionIT
SlashCommandsIT
SystemMessageSectionsIT
Fix: Remove the <includes> restriction from the inprocess profile failsafe config so all ITs run. Annotate any IT that is inherently incompatible with @SkipInProcess (with reason).
Gap 2: Surefire E2E test parity
Many surefire tests use E2ETestContext and exercise real CLI interactions. These never run under InProcess because:
The CI step no longer sets COPILOT_SDK_DEFAULT_CONNECTION=inprocess (we removed it to fix 195 surefire failures caused by env var leaking into tests that set cliPath/environment/cwd).
E2ETestContext.createClient() unconditionally sets cliPath, environment, and cwd on CopilotClientOptions — all three are rejected by CopilotClient.validateEnvironmentOptions() for InProcess connections.
Fix: Update E2ETestContext.createClient() to detect InProcess mode and:
Skip setting cliPath, environment, and cwd on options.
Instead, use InProcessEnvGuard to set the required env vars in the native process environment.
Re-add COPILOT_SDK_DEFAULT_CONNECTION=inprocess to surefire <environmentVariables> in the inprocess profile (not the CI step env).
Gap 3: Tests with direct client creation
Some tests create CopilotClient directly (not via E2ETestContext) with stdio-specific options (cliPath, cliArgs, cwd). These are inherently incompatible with InProcess transport.
Fix: Annotate each with @SkipInProcess and a reason. Examples:
Various test classes — Add @SkipInProcess("reason") to tests that are inherently incompatible with InProcess transport.
No files to create
All required infrastructure (InProcessEnvGuard, @SkipInProcess, @RequireInProcess) already exists.
Gating tests and criteria
Full parity verified:mvn clean verify -Pinprocess from java/ runs all surefire and failsafe tests under InProcess transport (except those annotated @SkipInProcess).
Same test count: The number of tests run + skipped under -Pinprocess equals the number run + skipped under the default profile.
Standard tests unaffected:mvn clean verify (without -Pinprocess) passes with no regressions.
CI passes: Both java-sdk and java-sdk-inprocess CI jobs pass.
Spotless compliance:mvn spotless:check passes.
Every @SkipInProcess has a reason documenting why the test is incompatible.
Out of scope
Testing on any platform other than linux-x64.
Adding new test scenarios — this task is about running existing tests under both transports.
Changes to production code in src/main/java (except if CopilotClient.validateEnvironmentOptions needs adjustment).
Overview
Achieve 100% test parity between the InProcess (FFI) transport and the existing out-of-process (stdio/TCP) transport. Every Surefire unit test and Failsafe integration test that runs under the default transport must also run under the InProcess transport, or be explicitly annotated with
@SkipInProcesswith a documented reason.Branch:
edburns/1917-java-embed-rust-cli-runtime-post-agentic-01-test-parityonupstreamPlan and supporting resources
On the
edburns/1917-java-embed-rust-cli-runtime-post-agentic-01-test-paritybranch, the directory1917-java-embed-rust-cli-runtime-remove-before-mergecontains the plan (1917-embed-cli-runtime-ignorance-reduction-plan.md) and supporting resources (spikes, prototypes, diagrams).Read the entire plan before working.
Relevant plan sections to carefully re-read
1917-java-embed-rust-cli-runtime-remove-before-merge/spike-3-11-replay-proxy-and-in-process/. Key answers:COPILOT_API_URL. The runtime readsCOPILOT_API_URLfrom the native process environment block.runtime.nodebinary — from thecopilot-nativemodule.-PinprocessMaven profile).InProcessEnvGuardrequirement — callsSetEnvironmentVariableW(Windows) orsetenv()(Linux/macOS) via JNA to mutate process environment beforehost_start. Restores onclose(). Already implemented incom.github.copilot.ffi.InProcessEnvGuard.InProcessEnvGuardmutates process-global state. Usesurefire.forkCount=1or JUnit 5@ResourceLock.@SkipInProcessannotation — Already implemented incom.github.copilot.e2e.SkipInProcess. JUnit 5 condition annotation for tests incompatible with InProcess transport (e.g., per-client environment variables — see issue [Tracking] In-process (FFI) items to be cleaned up #1934).java-sdk-inprocessjob injava-sdk-tests.ymlalready exists.Current state
The following infrastructure already exists on the branch:
InProcessEnvGuardincom.github.copilot.ffi— sets/restores native env vars via JNA.@SkipInProcessannotation incom.github.copilot.e2e— JUnit 5 condition for skipping incompatible tests.@RequireInProcessannotation incom.github.copilot.e2e— JUnit 5 condition for InProcess-only tests.InProcessTransportIT— single Failsafe smoke test that passes under-Pinprocess.-PinprocessMaven profile — activates InProcess transport for Failsafe.java-sdk-inprocessCI job — runsmvn clean verify -Pinprocess.Identified gaps
Gap 1: Failsafe IT parity
The
-Pinprocessprofile failsafe configuration only includes**/InProcessTransportIT.java. The other 6 ITs are excluded:ErgonomicToolDefinitionITGitHubTelemetryForwardingITInternalExecutorProviderITLowLevelToolDefinitionITSlashCommandsITSystemMessageSectionsITFix: Remove the
<includes>restriction from the inprocess profile failsafe config so all ITs run. Annotate any IT that is inherently incompatible with@SkipInProcess(with reason).Gap 2: Surefire E2E test parity
Many surefire tests use
E2ETestContextand exercise real CLI interactions. These never run under InProcess because:COPILOT_SDK_DEFAULT_CONNECTION=inprocess(we removed it to fix 195 surefire failures caused by env var leaking into tests that setcliPath/environment/cwd).E2ETestContext.createClient()unconditionally setscliPath,environment, andcwdonCopilotClientOptions— all three are rejected byCopilotClient.validateEnvironmentOptions()for InProcess connections.Fix: Update
E2ETestContext.createClient()to detect InProcess mode and:cliPath,environment, andcwdon options.InProcessEnvGuardto set the required env vars in the native process environment.COPILOT_SDK_DEFAULT_CONNECTION=inprocessto surefire<environmentVariables>in the inprocess profile (not the CI step env).Gap 3: Tests with direct client creation
Some tests create
CopilotClientdirectly (not viaE2ETestContext) with stdio-specific options (cliPath,cliArgs,cwd). These are inherently incompatible with InProcess transport.Fix: Annotate each with
@SkipInProcessand a reason. Examples:ClientOptionsE2ETest— tests CLI argument forwarding.CopilotClientTestthat setcliArgsor test CLI startup behavior.Deliverables
Files to modify
java/sdk/pom.xml— Update the-Pinprocessprofile:<includes>restriction from failsafe so all ITs run.COPILOT_SDK_DEFAULT_CONNECTION=inprocessto surefire<environmentVariables>.forkCount=1andparallel=nonefor both surefire and failsafe.java/sdk/src/test/java/com/github/copilot/E2ETestContext.java— UpdatecreateClient()methods to:COPILOT_SDK_DEFAULT_CONNECTIONenv var).cliPath,environment,cwd).InProcessEnvGuardfor native env setup.Various test classes — Add
@SkipInProcess("reason")to tests that are inherently incompatible with InProcess transport.No files to create
All required infrastructure (
InProcessEnvGuard,@SkipInProcess,@RequireInProcess) already exists.Gating tests and criteria
mvn clean verify -Pinprocessfromjava/runs all surefire and failsafe tests under InProcess transport (except those annotated@SkipInProcess).-Pinprocessequals the number run + skipped under the default profile.mvn clean verify(without-Pinprocess) passes with no regressions.java-sdkandjava-sdk-inprocessCI jobs pass.mvn spotless:checkpasses.@SkipInProcesshas a reason documenting why the test is incompatible.Out of scope
linux-x64.src/main/java(except ifCopilotClient.validateEnvironmentOptionsneeds adjustment).Parent issue: #2268