fix(server): treat signal-killed Claude subprocess as interrupted - #5142
fix(server): treat signal-killed Claude subprocess as interrupted#5142marcoamt wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved 8f898ff Straightforward bug fix that adds two string patterns to an existing pattern-matching function. The change correctly classifies SIGTERM/SIGINT subprocess terminations as 'interrupted' rather than runtime errors, following the same pattern already used for similar cases. Includes comprehensive test coverage. You can customize Macroscope's approvability policy. Learn more. |
- ClaudeAdapter now recognizes "terminated by signal SIGTERM/SIGINT" from the Claude Agent SDK's ProcessTransport as a graceful interruption instead of surfacing a runtime.error - Covers the case where the OS delivers the signal directly to the subprocess (e.g. desktop app quit) ahead of our own stopSession()-driven close - Add regression test asserting no runtime.error is emitted and the turn completes with state "interrupted"
8f898ff to
e6c7331
Compare
What Changed
ClaudeAdapternow recognizes "terminated by signal SIGTERM/SIGINT" messages from the Claude Agent SDK'sProcessTransportas a graceful interruption instead of surfacing aruntime.error. Added a regression test asserting noruntime.erroris emitted and the turn completes with stateinterrupted.Why
When the OS delivers SIGTERM/SIGINT directly to the Claude subprocess (e.g. on desktop app quit) ahead of our own
stopSession()-driven close, the SDK's error message for the signal-killed process was being treated as a runtime error instead of a normal interruption.UI Changes
When Cmd+Q app and reopen a Claude Code thread it looks like screenshot
Checklist
Note
Fix
isClaudeInterruptedMessageto treat SIGTERM/SIGINT-killed subprocesses as interruptedWhen the Claude CLI subprocess is killed by SIGTERM or SIGINT before
stopSession()completes, the Claude Agent SDK surfaces an error message containing'terminated by signal sigterm'or'terminated by signal sigint'. Previously these were treated as runtime errors; nowisClaudeInterruptedMessagematches these substrings and returnsinterruptedstate instead.Macroscope summarized e6c7331.