Skip to content

Claude Agent SDK Java 1.7.0

Latest

Choose a tag to compare

@markpollack markpollack released this 17 Sep 17:10
· 3 commits to main since this release

Claude Agent SDK Java 1.7.0

Fixes a hang when closing or cancelling a session: the SDK now destroys the Claude CLI process tree
before closing its streams.

Why this release exists

destroyProcessTree() is bounded — descendants first, destroy, wait up to 5 s, destroy forcibly, wait up to
2 s — but it ran after the transport closed its streams, and closing a pipe reader while another thread is
blocked reading it is not bounded at all. The bound never got the chance to apply.

Measured before the change, one close took 3 minutes 20 seconds against a CLI that never wrote to stdout, and
another had not returned after 420 seconds. On the real CLI, after a live cancel the prompt returned in
0.1 s but the claude child process stayed alive through a 45-second settle and the following turn.

Destroying the process tree first gives the blocked reader its EOF, so the stream close that follows is
immediate — 34 ms measured after the change. The same ordering is corrected in closeGracefully(), so the
asynchronous path no longer hangs the same way.

What changed

  • Transport close() and closeGracefully() destroy the process tree before closing streams
    (282fb1ee), with StreamingTransportCloseOrderTest pinning the order.
  • Source headers name the current copyright holder (2b57b367).

No API change and no dependency change since 1.6.0.

Upgrading

Drop-in. Bump io.github.markpollack:claude-code-sdk to 1.7.0. Agent Client 0.31.0 builds on this release for
run cancellation.

Maven Central

io.github.markpollack version 1.7.0: claude-agent-sdk-parent, claude-code-sdk. Each carries its
consumer-rooted CycloneDX SBOM (-cyclonedx.json) as a signed attachment.