Skip to content

feat: support full LLM middleware in daemon workers - #1281

Merged
mnajafian-nv merged 2 commits into
NVIDIA:release/0.10from
willkill07:feat/release-0.10-daemon-llm-middleware
Oct 12, 2026
Merged

mnajafian-nv merged 2 commits into
NVIDIA:release/0.10from
willkill07:feat/release-0.10-daemon-llm-middleware

Conversation

@willkill07

@willkill07 willkill07 commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Overview

Daemon workers previously rejected LLM execution intercepts. They now support all six LLM middleware types for OpenAI Chat Completions, OpenAI Responses, and Anthropic Messages, including streaming calls. Request intercepts also retain their pending marks instead of losing them on raw response delivery.

  • 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

  • Use the existing managed gateway pipeline when request intercepts, conditional execution guardrails, or unary/streaming execution intercepts are registered. Preserve raw forwarding for calls with only observability middleware or no LLM middleware.
  • Share worker sessions with managed execution and balance session accounting on cancellation or response-setup timeout. A configured response-header deadline does not impose an idle timeout on an active stream.
  • Raise the default observation capture limit from 4 MiB to 16 MiB.
  • Document supported middleware and the response behavior in plain language, including APIs that bypass LLM middleware.
  • Verify request edits, conditional allow/block behavior, request and response sanitization, both execution intercept types, pending marks, response replacement, provider errors, cancellation, and timeouts.

Compatibility: request intercepts and conditional execution guardrails now use the gateway's existing request and response contracts. With an active request codec, request-body edits use annotated_request. Successful managed responses return HTTP 200 and do not preserve original success headers, trailers, or SSE formatting. Sanitizers still affect only recorded event data.

Validation:

  • just test-rust: 5,796 tests passed. Removed inherited NEMO_RELAY_LOG and NEMO_RELAY_LOG_STDERR_FORMAT overrides for this run.
  • Focused daemon worker module: 51 tests passed.
  • just docs: passed. Published-redirect comparison was skipped because FDR returned HTTP 403.
  • uv run pre-commit run: all hooks passed except cargo-deny, which flags the existing, unchanged unsafe-libyaml dependency as unmaintained (RUSTSEC-2024-0449). That hook is skipped for the commit; no dependency or advisory-policy changes are included.
  • Python, Node.js, and Go suites were not run because this changes CLI daemon behavior without changing binding APIs.

Where should the reviewer start?

Start with crates/cli/src/daemon/worker/managed.rs for middleware delivery selection, then crates/cli/src/gateway/mod.rs for shared execution and cancellation cleanup. crates/cli/tests/coverage/daemon/worker_managed_tests.rs covers all six LLM middleware types together and the failure paths.

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

  • Relates to: none

Summary by CodeRabbit

  • New Features

    • Daemon workers now support LLM middleware for streaming and non-streaming provider requests, including request interception, execution, and guardrails.
    • Middleware can modify provider requests, block calls, and process streaming responses.
  • Bug Fixes

    • Provider errors and request cancellations are handled during managed execution.
    • Increased the default observation capture limit from 4 MiB to 16 MiB.
  • Documentation

    • Clarified middleware support, response handling, and timeout behavior for daemon workers.

@willkill07
willkill07 requested review from a team as code owners October 12, 2026 13:52
@github-actions github-actions Bot added size:L PR is large Feature a new feature lang:rust PR changes/introduces Rust code labels Oct 12, 2026
@willkill07 willkill07 self-assigned this Oct 12, 2026
@willkill07 willkill07 added this to the 0.10 milestone Oct 12, 2026
@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/NeMo-Relay/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Enterprise
  • Run ID: 398d378e-bbc8-4ab5-bbec-fa488da7a5a0

📥 Commits

Reviewing files that changed from the base of the PR and between 3b79ea6 and b326ae4.


You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/NeMo-Relay/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Enterprise
  • Run ID: 1aa1e157-a308-430d-a0ae-546c8dba9f21

📥 Commits

Reviewing files that changed from the base of the PR and between 494018a and 3b79ea6.


📒 Files selected for processing (6)
  • crates/cli/src/daemon/worker/managed.rs
  • crates/cli/src/gateway/mod.rs
  • crates/cli/src/server/mod.rs
  • crates/cli/tests/coverage/daemon/worker_managed_tests.rs
  • docs/build-plugins/workers/middleware-and-continuations.mdx
  • docs/daemon/reference.mdx

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. (14)
  • GitHub Check: Rust / Package (windows-amd64)
  • GitHub Check: Rust / Package (macos-arm64)
  • GitHub Check: Rust / Package (linux-musl-arm64)
  • GitHub Check: Rust / Test (linux-arm64)
  • GitHub Check: Rust / Package (linux-amd64)
  • GitHub Check: Rust / Package (linux-musl-amd64)
  • GitHub Check: Rust / Package (windows-arm64)
  • GitHub Check: Rust / Test (macos-arm64)
  • GitHub Check: Rust / Package (linux-arm64)
  • GitHub Check: Rust / Test (windows-arm64)
  • GitHub Check: Rust / Test (linux-amd64)
  • GitHub Check: Rust / Test (windows-amd64)
  • GitHub Check: Check / Run
  • GitHub Check: Preview docs

🧰 Additional context used
📚 Code guidelines (5)
.agents/skills/contribute-docs/SKILL.md — configured
.agents/skills/review-doc-style/SKILL.md — configured
CONTRIBUTING.md — configured
.agents/skills/prepare-code-freeze/SKILL.md — configured
.agents/skills/draft-release-notes/SKILL.md — configured

📓 Path-based instructions (8)
Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.

⚙️ CodeRabbit configuration file

Files:

  • docs/build-plugins/workers/middleware-and-continuations.mdx
  • docs/daemon/reference.mdx

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/daemon/worker_managed_tests.rs

Source excerpt: In MDX files, top-of-file comments must use JSX comment delimiters: `{/*` to open and `*/}` to close.

📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)

Files:

  • docs/build-plugins/workers/middleware-and-continuations.mdx
  • docs/daemon/reference.mdx

Source excerpt: Verify MDX files use JSX delimiters for top-of-file SPDX comments.

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)

Files:

  • docs/build-plugins/workers/middleware-and-continuations.mdx
  • docs/daemon/reference.mdx

Source excerpt: **Formatting**: `cargo fmt` (rustfmt defaults) Source excerpt: **Linting**: `cargo clippy -- -D warnings` -- all warnings are treated as errors

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Files:

  • crates/cli/src/gateway/mod.rs
  • crates/cli/src/daemon/worker/managed.rs
  • crates/cli/src/server/mod.rs
  • crates/cli/tests/coverage/daemon/worker_managed_tests.rs

Source excerpt: Search documentation source for references to the old version and update current-version install commands, package examples, and configuration examples to `` where appropriate: Review matches before changing th...

📄 CodeRabbit inference engine (.agents/skills/prepare-code-freeze/SKILL.md)

Files:

  • docs/build-plugins/workers/middleware-and-continuations.mdx
  • docs/daemon/reference.mdx

Source excerpt: Use the naming conventions appropriate to each language: Rust `snake_case`, C FFI exports prefixed `nemo_relay_`, Go `PascalCase`, Node.js `camelCase`, Python `snake_case`.

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Files:

  • crates/cli/src/gateway/mod.rs
  • crates/cli/src/daemon/worker/managed.rs
  • crates/cli/src/server/mod.rs
  • crates/cli/tests/coverage/daemon/worker_managed_tests.rs

Source excerpt: Preserve MDX front matter and the JSX SPDX comment.

📄 CodeRabbit inference engine (.agents/skills/draft-release-notes/SKILL.md)

Files:

  • docs/build-plugins/workers/middleware-and-continuations.mdx
  • docs/daemon/reference.mdx

🪛 LanguageTool
docs/daemon/reference.mdx

[style] ~516-~516: Consider using a different verb to strengthen your wording.
Context: ...s still arrive in parts. Relay does not keep the original formatting, stream comme...

(KEEP_PRESERVE)


🔇 Additional comments (9)
crates/cli/src/daemon/worker/managed.rs (4)

148-148: LGTM!

Also applies to: 155-155


1210-1215: LGTM!

Also applies to: 1232-1240


100-100: LGTM!


376-382: 🎯 Functional Correctness

ProviderRoute::from_path accepts all paths returned by provider_surface, including /v1/messages. daemon_execute passes the request path to prepare_gateway_request, which resolves it through that parser. The claimed unsupported-path failure is not present.


crates/cli/src/server/mod.rs (1)

522-568: LGTM!


crates/cli/tests/coverage/daemon/worker_managed_tests.rs (1)

19-20: LGTM!

Also applies to: 358-358, 389-391, 1138-1143, 1543-1557, 1559-1605, 1606-1821, 1823-1872, 1873-1973, 1974-2029, 2032-2087, 2096-2106, 2127-2127, 2163-2181, 2196-2197, 2220-2220, 2261-2265


docs/build-plugins/workers/middleware-and-continuations.mdx (1)

29-32: LGTM!


docs/daemon/reference.mdx (1)

463-465: LGTM!

Also applies to: 493-530, 634-634


crates/cli/src/gateway/mod.rs (1)

182-228: 🔒 Security & Privacy

Check that managed provider errors cannot pass worker-internal headers to the daemon.

response_headers copies non-hop-by-hop upstream headers without filtering WORKER_ROUTE_FAILURE_HEADER or the x-nemo-relay- prefix. The managed worker path must remove these headers from provider responses before forwarding them to the daemon. Otherwise, a provider error containing x-nemo-relay-worker-route-failure can trigger daemon route-failure handling.



Walkthrough

Daemon workers now route requests through managed gateway execution when registered middleware requires it, while retaining existing forwarding paths otherwise. The change adds session and timeout handling, expands middleware coverage tests, increases the observation capture default, and updates daemon middleware documentation.

Changes

Managed daemon middleware execution

Layer / File(s) Summary
Middleware selection and gateway execution
crates/cli/src/daemon/worker/managed.rs, crates/cli/src/gateway/mod.rs, crates/cli/src/server/mod.rs
Middleware requirements select managed execution for qualifying requests. The worker uses the managed gateway with shared sessions and configured response timeout behavior.
Managed execution coverage
crates/cli/tests/coverage/daemon/worker_managed_tests.rs
Tests cover middleware selection and transformations, guardrail blocking, provider errors, cancellation, timeout handling, and session cleanup.
Forwarding behavior and documentation
crates/cli/src/daemon/worker/managed.rs, docs/build-plugins/workers/middleware-and-continuations.mdx, docs/daemon/reference.mdx
The observation capture default changes to 16 MiB. Documentation describes middleware support, response handling, timeouts, and unchanged forwarding behavior.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant ManagedRuntime
  participant daemon_execute
  participant AppState
  participant Provider
  ManagedRuntime->>daemon_execute: Request, gateway state, and operational context
  daemon_execute->>AppState: Prepare request and session call
  AppState->>Provider: Execute request through the managed gateway pipeline
Loading

Merge Risk: ⚪ Minimal · up to 3b79e

Daemon workers now route calls through the managed gateway when execution-affecting middleware is registered. Other calls keep the existing forwarding path. Review found no established defect blocking merge. Owners may still want to confirm that provider error headers on the managed path cannot look like worker route failures.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 25 functions across 4 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title uses the allowed lowercase type "feat", provides a concise imperative summary, stays within 72 characters, and has no trailing period.
Description check Passed The description includes all required template sections, completed contribution and duplication checks, detailed implementation notes, reviewer guidance, validation results, and a related-issues entry…
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: Docstring Coverage

Explanation

Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 25 functions across 4 files. (2 skipped: 2 unsupported.)


✨ Finishing Touches 💡 1
🧪 Generate unit tests (beta)
  • Create a new PR


🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

@mnajafian-nv mnajafian-nv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mnajafian-nv
mnajafian-nv merged commit 933e362 into NVIDIA:release/0.10 Oct 12, 2026
72 of 78 checks passed
willkill07 added a commit that referenced this pull request Oct 14, 2026
#### Overview

Add 0.10.1 release notes covering the fifteen PRs merged into
`release/0.10` since `0.10.0`, plus the anticipated merge of #1317, with
matching patch-upgrade guidance. Preserve the 0.10.0 notes and follow
the NVIDIA documentation style guide.

- [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

- Cover daemon-worker LLM middleware (#1281), the YAML dependency update
(#1282), hook timeout and failure-policy fixes (#1288, #1289, #1290),
and request-edit preservation (#1296).
- Cover Anthropic streaming storage (#1303), Python typed reconstruction
(#1304), Go native handle lifetimes (#1302), authenticated Pi hooks and
session ownership (#1306), dynamic plugin trust failures (#1305), and
verified native plugin loading (#1307).
- Cover Pi named-upstream restrictions (#1314), LangChain tool-schema
edits (#1316), and the configurable ChatGPT Codex endpoint (#1319).
- Assume #1317 will merge: document plugin HTTP error helpers and
prefixes, preservation of remote Guardrails and forwarded hook HTTP
error statuses, verified reporting identities, and streaming limits.
Verified against its current head
`b61bb7da0bc6de7b7d5d27a569981867b7b2fcb9`; its implementation is not
merged into this branch.
- Add upgrade guidance for hook credentials and registration, generated
hooks, daemon response behavior, request edits, Pi extensions and
private provider endpoints, native plugin dependencies, stored Python
typed values, ChatGPT endpoints, and HTTP error handling.
- Keep PR references and counts out of user-facing release notes.
Preserve the prior CodeRabbit corrections for MCP route registration,
forwarded-stream observation limits, sanitizer-only behavior, and 0.10.1
installation pins.
- Merge the latest `release/0.10` into the PR branch. Distinguish
personal hook refresh commands from administrator-managed daemon
bundles.

Validation: `just docs`, `uv run pre-commit run`, and `git diff --cached
--check` passed. Fern skipped the published redirect-history check
because FDR returned HTTP 403. Verified the merged release range against
source and public documentation, and the assumed #1317 behavior against
its current PR source and docs.
Language test suites were not run because the PR diff only updates
documentation prose and installation version pins. Package installation
commands, live daemon upgrades, plugin activations, and hook refreshes
were not executed. Validation runs on the current release branch; #1317
remains an explicit release-content assumption.

#### Where should the reviewer start?

Start with `Release 0.10.1` in
`docs/about-nemo-relay/release-notes/index.mdx`, then review `Update
from NeMo Relay 0.10.0 to 0.10.1` in
`docs/reference/migration-guides.mdx`. Review the new Pi endpoint,
ChatGPT endpoint, LangChain tool-edit, and HTTP error guidance,
including the #1317 merge assumption. Check matching version pins in
`docs/getting-started/installation.mdx`.

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

- Relates to: none


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
* Added NeMo Relay 0.10.0 and 0.10.1 release notes, including feature
highlights, compatibility updates, fixes, and known issues.
* Expanded migration guidance with upgrade steps and details on hook
credentials and delivery, daemon-worker middleware behavior, request
editing, plugin requirements, and Python value handling.
* Updated installation examples across supported platforms, packages,
and integrations to reference version 0.10.1.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Will Killian <[email protected]>
@willkill07
willkill07 deleted the feat/release-0.10-daemon-llm-middleware branch October 30, 2026 14:47

This branch was previously deployed

1 inactive deployment
fern — b326ae40 Deployed Oct 12, 2026 by mnajafian-nv via Clean up docs preview #5591
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature a new feature lang:rust PR changes/introduces Rust code size:L PR is large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants