Skip to content

Forward-merge release/0.6 into main#476

Merged
GPUtester merged 1 commit into
mainfrom
release/0.6
Jul 17, 2026
Merged

Forward-merge release/0.6 into main#476
GPUtester merged 1 commit into
mainfrom
release/0.6

Conversation

@rapids-bot

@rapids-bot rapids-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

Forward-merge triggered by push to release/0.6 that creates a PR to keep main up-to-date. If this PR is unable to be immediately merged due to conflicts, it will remain open for the team to manually merge. See forward-merger docs for more info.

> [!WARNING]
> **BREAKING CHANGE — Rust and Go stream APIs:** `LlmJsonStream` is no longer a `Pin<Box<dyn Stream<...>>>` alias; Rust callers that construct it directly or rely on the aliased boxed-stream type must migrate to `LlmJsonStream::new` or `LlmJsonStream::from_closeable`. Go `LlmStream.Close` now returns an `error`, so code that depends on its previous `Close()` method type must update. Early explicit close now finalizes the partial response and emits an interrupted lifecycle end event.

#### Overview

Make explicit close behavior for managed LLM streams consistent across Rust, Python, Node, Go, and the C FFI.

- [x] I confirm this contribution is my own work, or I have the right to submit it under this project's license.
- [x] I searched existing issues and open pull requests, and this does not duplicate existing work.

#### Details

- Replace the opaque core stream alias with a close-aware managed stream wrapper that finalizes once, emits an interrupted end event, and rejects reads after close.
- Preserve Python `await stream.aclose()` while making it wait for async-generator cancellation and `aclose()` cleanup.
- Add Node `await stream.close()`, Go `stream.Close() error`, and C `nemo_relay_stream_close`.
- Make early close drain queued chunks and surface producer-cleanup errors consistently in each binding.
- Document explicit-close behavior and early-stop examples for the primary Rust, Python, and Node bindings.
- Add core, Python, Node, Go, and FFI regression coverage for idempotence, partial finalization, cleanup, and post-close exhaustion.

#### Where should the reviewer start?

Start with `crates/core/src/api/runtime/callbacks.rs` and `crates/core/src/stream.rs` for the shared close contract, then review the Python, Node, FFI, and Go bridge implementations. See `docs/instrument-applications/code-examples.mdx` for consumer usage.

#### Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

- Relates to: RELAY-496


## Summary by CodeRabbit

* **New Features**
  * Added explicit async stream cleanup/close APIs across Python (`aclose`), Node.js (`close`), Go (`Close() error`), and C (`nemo_relay_stream_close`), all with idempotent behavior and observable completion.
  * Streaming now supports cooperative cancellation and explicit completion signaling.
* **Bug Fixes**
  * Stopping early now reliably halts producers, finalizes partial responses, and emits the expected “interrupted” end behavior.
* **Documentation**
  * Updated migration notes, examples, and glossary to require explicit close/cleanup when exiting streams early and to clarify finalizer behavior.
* **Tests**
  * Updated/expanded coverage to validate the new close/cancellation lifecycle.

Authors:
  - Will Killian (https://github.com/willkill07)

Approvers:
  - Eric Evans II (https://github.com/ericevans-nv)
  - Maryam Najafian (https://github.com/mnajafian-nv)
  - Zhongxuan (Daniel) Wang (https://github.com/zhongxuanwang-nv)

URL: #465
@rapids-bot
rapids-bot Bot requested review from a team and lvojtku as code owners July 17, 2026 23:36
@GPUtester
GPUtester merged commit 66a514b into main Jul 17, 2026
1 check passed
@rapids-bot

rapids-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown
Author

SUCCESS - forward-merge complete.

@github-actions github-actions Bot added size:XL PR is extra large lang:go PR changes/introduces Go code lang:js PR changes/introduces Javascript/Typescript code lang:python PR changes/introduces Python code lang:rust PR changes/introduces Rust code labels Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lang:go PR changes/introduces Go code lang:js PR changes/introduces Javascript/Typescript code lang:python PR changes/introduces Python code lang:rust PR changes/introduces Rust code size:XL PR is extra large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants