Conversation
- keep reading ReceiveResponseAsync during cancellation to flush buffered messages - trigger InterruptAsync from cancellation callback instead of aborting the reader token - stop disposing the client inside ClaudeSdkClient.InterruptAsync so buffered output is not lost to the next query (cherry picked from commit 2f1d4ec9a0cc27ce5741a10d6ff6afd3ae277485) Signed-off-by: zxyao145 <zxyao145@gmail.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8829c9a62a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // | ||
| var interruptRequested = 0; | ||
| using var cancellationRegistration = cancellationToken.Register(() => | ||
| { |
There was a problem hiding this comment.
Keep cancellation registration alive during streaming
The using var cancellationRegistration = cancellationToken.Register(...) is scoped to SendUserInput, so the registration is disposed as soon as the method returns. That means cancellations that happen while the caller is still streaming responses will never invoke InterruptAsync. Since you also switched the client calls to CancellationToken.None, this change effectively disables mid-stream cancellation, so long-running responses will continue to run even after the caller cancels. Consider keeping the registration alive for the duration of the stream (or passing the token through) so cancellation still interrupts the client.
Useful? React with 👍 / 👎.
No description provided.