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
Create a Failsafe integration test that exercises the InProcess FFI transport end-to-end with a real runtime.node binary: client connects, creates a session, sends a message, and receives a response — all via the InProcess transport through FfiRuntimeHost.
This is task 4.8 of 9 in the implementation plan. Tasks are assigned, completed, and merged serially in this listed order. Tasks 4.1–4.7 are complete on the base branch before this task begins.
Branch:edburns/1917-java-embed-rust-cli-runtime-dd-3039924-agentic-run-02 on upstream
Plan and supporting resources
On the edburns/1917-java-embed-rust-cli-runtime-dd-3039924-agentic-run-02 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 (task 4.7).
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(). See spike-3-11/java-inprocess-e2e-win32-x64/ for proven implementation.
Concurrency must be 1 — InProcessEnvGuard mutates process-global state. Use surefire.forkCount=1 or JUnit 5 @ResourceLock.
Section 4.8 — E2E integration test (the primary task description).
Hard scope invariant: Linux-x64 only. No other platform E2E tests in this phase.
Resolved decisions that constrain this task
Maven profile for InProcess:-Pinprocess profile with properties:
COPILOT_SDK_DEFAULT_CONNECTION=inprocess
forkCount=1, parallel=none in maven-failsafe-plugin
InProcessEnvGuard — Must be created in com.github.copilot.ffi (or test harness package). Calls native env-setting functions via JNA. Implements AutoCloseable.
E2ETestContext.createClient() dispatch — When COPILOT_SDK_DEFAULT_CONNECTION=inprocess, apply InProcessEnvGuard before starting client. Close in @AfterEach / try-with-resources.
Test reuse — Existing YAML snapshots work. The spike confirmed a successful ping-pong round trip via InProcess transport in 1.1s.
ABI version sensitivity — Version 1.0.73+ from nodejs/package-lock.json is required (has copilot_runtime_host_start).
Deliverables
Files to create
java/sdk/src/test/java/com/github/copilot/e2e/InProcessTransportIT.java — Failsafe IT that:
Starts the replay proxy (via E2ETestContext / CapiProxy).
Uses InProcessEnvGuard to set COPILOT_API_URL in the native process environment.
Creates a CopilotClient with RuntimeConnection.forInProcess().
All prior tests pass:mvn verify from java/ passes.
Spotless compliance:mvn spotless:check passes.
Out of scope
Running the full E2E suite under InProcess transport (this task creates the smoke test; running the full suite under both transports is a CI concern handled in task 4.9).
Overview
Create a Failsafe integration test that exercises the InProcess FFI transport end-to-end with a real
runtime.nodebinary: client connects, creates a session, sends a message, and receives a response — all via the InProcess transport throughFfiRuntimeHost.This is task 4.8 of 9 in the implementation plan. Tasks are assigned, completed, and merged serially in this listed order. Tasks 4.1–4.7 are complete on the base branch before this task begins.
Branch:
edburns/1917-java-embed-rust-cli-runtime-dd-3039924-agentic-run-02onupstreamPlan and supporting resources
On the
edburns/1917-java-embed-rust-cli-runtime-dd-3039924-agentic-run-02branch, 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 (task 4.7).-PinprocessMaven profile).InProcessEnvGuardrequirement — callsSetEnvironmentVariableW(Windows) orsetenv()(Linux/macOS) via JNA to mutate process environment beforehost_start. Restores onclose(). Seespike-3-11/java-inprocess-e2e-win32-x64/for proven implementation.InProcessEnvGuardmutates process-global state. Usesurefire.forkCount=1or JUnit 5@ResourceLock.@SkipInProcessannotation — 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.yml. Activates-PinprocessMaven profile. Scope:ubuntu-latest(linux-x64) only.Resolved decisions that constrain this task
-Pinprocessprofile with properties:COPILOT_SDK_DEFAULT_CONNECTION=inprocessforkCount=1,parallel=noneinmaven-failsafe-pluginInProcessEnvGuard— Must be created incom.github.copilot.ffi(or test harness package). Calls native env-setting functions via JNA. ImplementsAutoCloseable.E2ETestContext.createClient()dispatch — WhenCOPILOT_SDK_DEFAULT_CONNECTION=inprocess, applyInProcessEnvGuardbefore starting client. Close in@AfterEach/ try-with-resources.1.0.73+ fromnodejs/package-lock.jsonis required (hascopilot_runtime_host_start).Deliverables
Files to create
java/sdk/src/test/java/com/github/copilot/e2e/InProcessTransportIT.java— Failsafe IT that:E2ETestContext/CapiProxy).InProcessEnvGuardto setCOPILOT_API_URLin the native process environment.CopilotClientwithRuntimeConnection.forInProcess().java/sdk/src/test/java/com/github/copilot/ffi/InProcessEnvGuard.java(or in test harness package) — Utility that:SetEnvironmentVariableW(Windows) orsetenv()(Linux/macOS) via JNA.AutoCloseable— restores saved values onclose().java/sdk/src/test/java/com/github/copilot/e2e/SkipInProcess.java(optional) — JUnit 5@DisabledIfcondition annotation for tests incompatible with InProcess transport.Files to modify
java/sdk/pom.xml— Add the-PinprocessMaven profile:Snapshot files — Reuse existing snapshots or create new ones as needed for the InProcess smoke test.
Gating tests and criteria
InProcessTransportITpasses onubuntu-latestwith the realruntime.nodebinary on classpath.InProcessEnvGuardcorrectly sets and restores native process environment variables.mvn verify -Pinprocessruns the InProcess E2E tests withforkCount=1.mvn verify(without-Pinprocess) runs existing subprocess E2E tests unchanged.mvn verifyfromjava/passes.mvn spotless:checkpasses.Out of scope
linux-x64.