Skip to content

fix: worker upstream error preservation - #1664

Merged
willkill07 merged 1 commit into
NVIDIA:release/0.11from
willkill07:fix/0.11-worker-upstream-errors
Nov 5, 2026
Merged

willkill07 merged 1 commit into
NVIDIA:release/0.11from
willkill07:fix/0.11-worker-upstream-errors

Conversation

@willkill07

@willkill07 willkill07 commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Overview

Backport #1654 to release/0.11 so a pass-through worker plugin preserves the provider's original HTTP status, response body, and headers instead of turning upstream failures into HTTP 400.

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

Details

  • Backport token recovery and review hardening from commits 996d3d356 and 8b14d63af.
  • Recover the single distinct captured attempt from wrapped worker errors, including quoted gRPC error dumps and repeated mentions of the same token.
  • Reject malformed token suffixes and ambiguous messages without consuming captured failures.
  • Adapt the server tests to nemo_relay::error::FlowError, the existing 0.11 runtime export.
  • Cover HTTP 401, 429, 500, and 529, unchanged bodies, retry-after, duplicate headers, request isolation, and concurrent buffered/streaming attempt selection.

Validation on release/0.11:

  • All five focused gateway regression tests passed.
  • just test-rust: 6,649 passed, four skipped.
  • Staged repository hooks passed, including formatting, Clippy, cargo check, and dependency audits.
  • The Python worker example was not run directly; regression tests simulate its error wrapping. Separate Python, Node.js, and Go test suites were not run for this CLI-only change.

Where should the reviewer start?

Start with CapturedUpstreamFailures::take in crates/cli/src/gateway/mod.rs, then the gateway token tests and concurrent-attempt server tests. The only release-specific adaptation is the error import used by the server tests.

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

Summary by CodeRabbit

  • Bug Fixes
    • Fixed cases where an upstream error wrapped in additional context could prevent the original response from reaching the client. The response status, headers, and body are now preserved across direct, buffered, and streaming requests. When an error refers to multiple captured upstream failures, none is incorrectly selected.

Backport the gateway token recovery and review hardening from NVIDIA#1654, adapting FlowError imports to the 0.11 runtime.

Signed-off-by: Will Killian <[email protected]>
@willkill07
willkill07 requested a review from a team as a code owner November 5, 2026 13:59
@github-actions github-actions Bot added size:S PR is small Bug issue describes bug; PR fixes bug lang:rust PR changes/introduces Rust code labels Nov 5, 2026
@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

CapturedUpstreamFailures::take now finds captured-failure UUIDs within wrapped error messages. Tests cover retrieving captured responses after error wrapping, preserving response details, and handling ambiguous or invalid tokens.

Changes

Captured upstream failure recovery

Layer / File(s) Summary
Match captured failures in wrapped errors
crates/cli/src/gateway/mod.rs, crates/cli/tests/coverage/shared/gateway_tests.rs
take scans error messages for captured-failure UUIDs. It returns a failure only when one distinct captured token matches, and leaves entries untouched when multiple distinct tokens match. Tests cover response details, single-use retrieval, invalid tokens, and ambiguous messages.
Exercise worker-wrapped failures
crates/cli/tests/coverage/shared/server_tests.rs
Buffered and streaming failure tests wrap selected attempt errors in worker-style FlowError::Internal context and continue to check the upstream response.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

  • NVIDIA/NeMo-Relay#1654: Implements the same captured-upstream-failure recovery and worker-error wrapping behavior.
  • NVIDIA/NeMo-Relay#1338: Includes related HTTP error-status preservation changes for plugins and remote HTTP errors.
  • NVIDIA/NeMo-Relay#1317: Preserves HTTP statuses from plugin callbacks and remote integrations, including worker error conversion.
Merge Risk: Minimal · up to d828f

No merge-blocking issue is identified in the supplied changes.

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

Failed Failed checks: 1 error

Check name Status Explanation Resolution
Title check Error The title uses an allowed Conventional Commits type and clearly describes the change, but its summary is a noun phrase rather than an imperative summary. Use an imperative summary, such as "fix: preserve worker upstream errors".
Passed Passed checks: 4 passed

Check name Status Explanation
Description check Passed The description includes the required Overview, Details, reviewer guidance, contribution and duplication confirmations, and a Related Issues section using the permitted "Relates to" keyword. It also p…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description includes the required Overview, Details, reviewer guidance, contribution and duplication confirmations, and a Related Issues section using the permitted "Relates to" keyword. It also provides clear scope, validation results, and reviewer entry points.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 4 functions across 3 files.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 4e731c7 and d828f9a.

Files selected for processing: 3

  • crates/cli/src/gateway/mod.rs
  • crates/cli/tests/coverage/shared/gateway_tests.rs
  • crates/cli/tests/coverage/shared/server_tests.rs

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

Recent review details

Context from checks skipped due to timeout: 2

  • GitHub Check: Changes / Detect
  • GitHub Check: Preview docs
Additional context used

Path-based instructions: 1

Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.

CodeRabbit configuration file

Files:

  • crates/cli/tests/coverage/shared/gateway_tests.rs
  • crates/cli/tests/coverage/shared/server_tests.rs
Additional comments: 3

crates/cli/src/gateway/mod.rs: 1

433-436: LGTM!

Also applies to: 441-460

crates/cli/tests/coverage/shared/gateway_tests.rs: 1

2759-2797: LGTM!

Also applies to: 2799-2834, 2836-2855

crates/cli/tests/coverage/shared/server_tests.rs: 1

5481-5486: LGTM!

Also applies to: 5565-5570

@willkill07 willkill07 added this to the 0.11 milestone Nov 5, 2026
@willkill07 willkill07 changed the title fix: backport worker upstream error preservation to 0.11 fix: worker upstream error preservation Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

@willkill07 willkill07 self-assigned this Nov 5, 2026
@willkill07
willkill07 merged commit 6ae548b into NVIDIA:release/0.11 Nov 5, 2026
52 of 53 checks passed
@bbednarski9 bbednarski9 mentioned this pull request Nov 5, 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 branch was previously deployed

1 inactive deployment
fern — d828f9aa Deployed Nov 5, 2026 by willkill07 via Clean up docs preview #7077
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug issue describes bug; PR fixes bug lang:rust PR changes/introduces Rust code size:S PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants