Repository navigation
fix: wait for graceful subprocess shutdown before SIGTERM - #642
Conversation
After closing stdin, give the CLI process up to 5 seconds to flush its session file before sending SIGTERM. Previously, terminate() was called immediately after stdin EOF, which could interrupt the session file write and cause the last assistant message to be lost. Fixes anthropics#625 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…aths Add two tests for the close() grace period behavior: - test_close_terminates_after_grace_period_timeout: verifies SIGTERM is sent when the subprocess doesn't exit within the grace period - test_close_skips_wait_when_already_exited: verifies no terminate call when process has already exited (returncode != None) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Quick follow-up from my side: I’m treating review-required PRs as top priority this week. If you want any specific changes, rebase, or split, I can turn them around quickly. |
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
|
LGTM — thanks for tracking this down. Verified e2e: on main, One tiny thing: the timeout test patches |
Summary
terminate()was called immediately after stdin EOF, which could interrupt session file writes and lose the last assistant messageterminateis not called when the process exits gracefullyFixes #625