fix(streaming): clear output callback on cancellation#1839
Open
chaliy wants to merge 1 commit into
Open
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 2f2d295 | Commit Preview URL | Jun 02 2026, 09:36 AM |
d9799ec to
2f2d295
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Description
OutputCallbackGuardthat installs the callback viainstalland clears it inDropto make cleanup cancellation-safe and robust across await points. (crates/bashkit/src/lib.rs)Sendwith a safety comment so it can travel across executor boundaries while still ensuring unique access to the interpreter. (crates/bashkit/src/lib.rs)exec_streaming_with_extensionsso callbacks are cleared even if the streaming future is cancelled. (crates/bashkit/src/lib.rs)test_exec_streaming_cancel_clears_callbackproving a timed-out/cancelled streaming run does not receive later output. (crates/bashkit/src/lib.rs)test_execute_on_output_cancel_does_not_poison_future_callscoveringasyncio.wait_forcancellation for bothBashandBashTool. (crates/bashkit-python/tests/test_streaming_output.py)Testing
cargo test -p bashkit test_exec_streaming_cancel_clears_callback --lib— passed.VIRTUAL_ENV=$PWD/.uv-venv-bashkit PATH=$PWD/.uv-venv-bashkit/bin:$PATH uvx maturin develop --manifest-path crates/bashkit-python/Cargo.tomlandpython -m pytest crates/bashkit-python/tests/test_streaming_output.py -q— Python tests passed (26 passed).cargo clippy -p bashkit --lib -- -D warnings— passed.cargo fmt --checkandruff check/ruff format --checkon the modified Python test file — passed.Codex Task