Repository navigation
fix: surface managed streaming failures to clients - #1652
Merged
willkill07 merged 1 commit intoNov 4, 2026
Merged
Conversation
Signed-off-by: Will Killian <[email protected]>
greysonlalonde
approved these changes
Nov 4, 2026
2 tasks done
willkill07
added a commit
that referenced
this pull request
Nov 6, 2026
#### Overview Resolve the conflicts blocking the `release/0.11` → `main` forward merge in #1650. The release fixes were written against the combined core crate; main now separates types, codecs, runtime, and observability. This branch places the fixes in those current crates while retaining the original release commits. **An authorized admin must land this manual forward merge using “Create a Merge Commit”; do not squash or rebase. Keep #1650 open.** This repository disables the auto-merger, so `/merge nosquash` does not apply here. After this resolution lands in main, the forward-merger should reconcile the original PR. See the [repository bot’s merge instructions](#1650 (comment)). - [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 - Preserve the six pending release fixes: Responses request history (#1643), tool ownership hints (#1645), managed streaming errors (#1652), worker upstream errors (#1664), free-form tool-call evidence (#1644), and interrupted LangGraph tool attempts (#1667). - Keep provider-specific telemetry interpretation in codecs. The runtime supplies portable request and tool-call views through the existing normalizer/observability host contracts. Exporters consume these views without adding a production dependency from observability to codecs or runtime. - Preserve the original provider annotations for encoding, invocation IDs for result correlation, and free-form tool input as text. - Retain the standalone exporter fallback. An explicitly empty supplied call list overrides raw fallback data; malformed entries do not discard neighboring valid calls or renumber positional fallback IDs. - Move provider-aware exporter tests into plugin-host integration coverage and share the raw-response field selectors across the provider and fallback paths. No dependency manifests or lockfiles change. The PR history contains the six original release commits followed by one signed and signed-off resolution merge commit (`dd4e167`). The branch includes main at `72cc0ebe3` and release/0.11 at `74e432155`. The consolidated merge retains the previously reviewed production changes. It also includes two test-only review fixes: parse SSE assertions by event delimiters instead of body chunks, and preserve explicitly empty call lists in the telemetry test accessor while checking both empty and populated results. **Validation** - `just test-rust`: 6,743 passed, 4 skipped after the test-only review fixes. - Focused SSE and telemetry regressions: 8 passed, including the ATIF authoritative-empty-list regression. - `just test-python`: 81 native binding tests, 1,531 package tests, and 24 example tests passed; 1 skipped after the latest release merge. - `just test-python-langchain`: 402 passed, including LangGraph interrupt/resume regressions. - `just test-node`: 10 native binding tests, 551 package tests, and 26 example tests passed on the initial resolution. Node and shared runtime sources were unchanged by the subsequent refresh, so this suite was not repeated. - Repository pre-commit hooks passed before each commit, with the complete staged file lists explicitly supplied during merges. Applicable checks included Clippy, compilation, formatting, Python typing, documentation links, and dependency audits. - Verified the signature, sign-off, clean worktree, unchanged original release commit IDs, and exactly one merge commit. The review fixes changed only three test-related files; binding suites were not repeated for this test-only revision. #### Where should the reviewer start? Start with `TelemetryToolCall` and the optional `LlmNormalizer` telemetry methods in `crates/types/src/codec/normalization.rs`, then the provider views in `crates/codecs/src/telemetry.rs` and their consumption in `crates/observability/src/normalization.rs`. The exporter regressions are under `crates/plugin-host/tests/integration/observability/`. The standalone fallback regression is in `crates/observability/tests/unit/atif_projection_tests.rs`. #### Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to) - Relates to #1650 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * OpenAI Responses custom tool calls and results are supported, preserving call IDs and free-form input across processing and observability exports. * LangGraph tool execution handles approval interrupts consistently in synchronous and asynchronous workflows. * **Bug Fixes** * Managed streams return protocol-compatible error events when execution fails after streaming begins, retaining already-sent content and omitting successful completion markers. * Tool-call telemetry better preserves provider details and skips malformed entries without losing valid calls. * **Documentation** * Clarified error behavior in managed streaming responses. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This was referenced Nov 12, 2026
This was referenced Nov 20, 2026
willkill07
pushed a commit
that referenced
this pull request
Nov 23, 2026
…1782) #### Overview Adds a `validate_stream` wrapper to the Anthropic streaming codec, so a stream that carries an Anthropic `error` event (for example `overloaded_error`) ends with an error and is recorded as `ERROR`, instead of `OK` with partial output. - [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 - `crates/core/src/codec/anthropic.rs`: `AnthropicMessagesStreamingCodec::validate_stream` wraps the source in `AnthropicCompletionStream`, which forwards every event unchanged and, after forwarding an `error` event, returns `FlowError::Internal("Anthropic stream reported <type>: <message>")` on the next poll, before polling the source again, so a stalled source or a later transport error cannot delay or replace it. `terminalize` and `close` are forwarded, as the trait requires. - The wrapper detects the error from the events it forwards, not from collector state, so the check does not depend on when the collector runs (the ordering issue described in #1757). - It uses `FlowError::Internal`, like the Responses completion check, rather than `FlowError::Upstream`: the gateway's retry-aware routing acts on `Upstream` failures, and a retry after partial output has reached the client could duplicate output. - Unknown event types are still ignored; the `observe` comment now notes that `validate_stream` reports `error` events. - The gateway is the caller of `validate_stream` (`crates/cli/src/gateway/mod.rs`), so this covers the gateway path where #1781 was reproduced. - Side effect: after Anthropic's `error` event, the gateway also sends its generic `event: error` (#1652), because the stream now ends with an error. The Anthropic SDK raises on in-stream `error` events (as noted in #1648), so it raises on `overloaded_error` first; a client reading the raw stream sees both. Happy to adjust if you'd prefer to suppress the second event. - Out of scope: the Responses wrapper treats `response.failed` as a normal terminal event. - No breaking changes. Tested on macOS, on `release/0.11` at `56965db4`: - New `anthropic_stream_validation_reports_error_events_and_preserves_close`: normal, unknown-event, and `error` streams, plus upstream-error and close forwarding. New `anthropic_stream_validation_reports_error_events_before_polling_the_source_again`: a source that stalls after the `error` event, and one that then returns a transport error. New `anthropic_sessions_record_in_stream_error_events_as_errors`: the end event is `ERROR` with the provider's error type, partial output is kept, and a normal stream stays `OK`. The first and third failed on `release/0.11` without the fix; the second failed on the previous revision of this PR. All pass now. - `cargo nextest run -p nemo-relay -E 'test(~anthropic) | test(~stream)'`: 298 passed. - `just test-rust`: 6746 passed, 4 skipped (with `ulimit -n 4096`). - `cargo fmt --all -- --check` and `cargo clippy -p nemo-relay --all-targets -- -D warnings` pass. - End to end through `nemo-relay --bind` with the mock from #1781: on `main` (`23f05206`) the call was recorded `OK`; with this branch it is `ERROR` (`Anthropic stream reported overloaded_error: Overloaded`), the partial output is kept, and the client receives `overloaded_error` first. - Pre-commit hooks pass, except `npm audit` and `uv audit`, which I skipped; this change touches no lockfiles. On the last commit, I also skipped the docs link check, which failed on an unreachable external link in an unrelated page; this change touches no docs. Not tested on Linux or Windows; CI covers those. #### Where should the reviewer start? `AnthropicCompletionStream` in `crates/core/src/codec/anthropic.rs`. #### Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to) Closes #1781 --------- Signed-off-by: Sakshi Tapkir <[email protected]> Co-authored-by: Maryam Najafian <[email protected]>
This branch was previously deployed
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.
Overview
Managed streaming previously turned a provider connection failure after partial output into a clean EOF that OpenAI and Anthropic SDKs accepted as a successful-looking response. Emit an explicit SSE error so clients reject interrupted responses while valid HTTP framing preserves the assigned daemon worker route.
Details
Validation
just test-rust: 6,642 passed, four skipped.openai==3.45.0andanthropic==2.5.0: interrupted Chat and Responses streams now raiseAPIError; Anthropic Messages raisesAPIStatusError. Complete streams retain their normal finish reasons, and raw HTTP framing remains valid.just docs: passed. The comparison against published redirects was skipped because FDR returned HTTP 403.cargo fmt --all -- --check: passed.uv run pre-commit run: passed, including Clippy, compilation, dependency audits, and documentation links.Where should the reviewer start?
Start with
client_sse_bodyandencode_sse_error_frameincrates/cli/src/gateway/mod.rs. The protocol and cleanup regression isstreaming_response_reports_midstream_errors_in_the_provider_protocolincrates/cli/tests/coverage/shared/gateway_tests.rs. The extended daemon tests verify that application errors preserve the worker route and the next request.Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)