Skip to content

feat(server): launch proxy applications from YAML manifests - #2468

Open
Pouyanpi wants to merge 10 commits into
pouyanpi/proxy-declarative-composition-afrom
pouyanpi/proxy-declarative-launcher-b
Open

Pouyanpi wants to merge 10 commits into
pouyanpi/proxy-declarative-composition-afrom
pouyanpi/proxy-declarative-launcher-b

Conversation

@Pouyanpi

@Pouyanpi Pouyanpi commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Add bounded YAML loading and server-owned validate, inspect, schema and serve commands. Include a local Rails example and offline socket tests; reuse the typed configuration and existing lifespan.

Stack: #2466 → #2467 → #2468. Package separation follows separately; API-docs prototype excluded.

PR Base
#2467: typed composition #2466
#2468: YAML/launcher #2467

Summary by CodeRabbit

  • New Features

    • Added an experimental YAML-configured proxy launcher.
    • Added commands to validate, inspect, generate schemas, and serve proxy manifests.
    • Added support for Chat Completions and Responses operations with configurable providers.
    • Added manifest validation with clear diagnostics and safe configuration handling.
    • Added example proxy and Rails configurations with input and output content checks.
  • Documentation

    • Documented installation, manifest configuration, CLI usage, security settings, streaming behavior, and troubleshooting.
  • Tests

    • Expanded coverage for validation, streaming, blocked content, disconnect handling, and launcher lifecycle.

@github-actions github-actions Bot added status: needs triage New issues that have not yet been reviewed or categorized. size: L labels Oct 15, 2026
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-launcher-b branch from d7219fd to 2600591 Compare October 20, 2026 08:12
@codecov

codecov Bot commented Oct 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.75325% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
nemoguardrails/server/experimental/__main__.py 0.00% 3 Missing ⚠️
...rails/server/experimental/_application_manifest.py 99.00% 1 Missing ⚠️
nemoguardrails/server/experimental/cli.py 98.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Pouyanpi
Pouyanpi added this pull request to stack #2477 October 20, 2026 12:19
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-launcher-b branch from 2600591 to b2a73ec Compare October 20, 2026 12:31
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-launcher-b branch from b2a73ec to f3cf727 Compare October 20, 2026 13:54
@Pouyanpi
Pouyanpi marked this pull request as ready for review October 20, 2026 13:59
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-launcher-b branch from f3cf727 to f241e8e Compare October 20, 2026 15:41
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-launcher-b branch from f241e8e to e255248 Compare October 20, 2026 17:06
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-launcher-b branch from e255248 to c907cfe Compare October 20, 2026 19:56
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-launcher-b branch 2 times, most recently from 11b0439 to 45d3cda Compare October 21, 2026 09:41
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-launcher-b branch from 8d51c8c to c7c2f0f Compare October 21, 2026 11:06
@Pouyanpi Pouyanpi self-assigned this Oct 21, 2026
@Pouyanpi Pouyanpi added status: triaged Triaged by a maintainer; eligible for automated review (CodeRabbit/Greptile). and removed status: needs triage New issues that have not yet been reviewed or categorized. labels Oct 21, 2026
@coderabbitai

coderabbitai Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA-NeMo/Guardrails/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 570c0721-8043-4b63-b2c1-9f6ef53b9bee
📥 Commits

Reviewing files that changed from the base of the PR and between bf9dc0a and c7c2f0f.

📒 Files selected for processing: 9
  • nemoguardrails/server/experimental/__main__.py
  • nemoguardrails/server/experimental/_application_manifest.py
  • nemoguardrails/server/experimental/application.md
  • nemoguardrails/server/experimental/cli.py
  • nemoguardrails/server/experimental/examples/basic/proxy.yaml
  • nemoguardrails/server/experimental/examples/basic/rails/config.yml
  • tests/server/experimental/test_application_manifest.py
  • tests/server/experimental/test_proxy_launcher.py
  • tests/server/experimental/test_streaming_http.py

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

📝 Walkthrough

The experimental server now loads bounded YAML manifests and provides commands to validate, inspect, generate a schema for, and serve proxy applications. The change also adds a basic policy example, launcher integration tests, documentation, and a conditional timeout in a streaming cleanup test.

Changes: Proxy manifest launcher

Layer / File(s) Summary
Manifest schema and bounded loading
nemoguardrails/server/experimental/_application_manifest.py, tests/server/experimental/test_application_manifest.py
The loader validates manifest declarations, rejects unsupported YAML constructs, enforces input limits, and resolves Rails configuration paths relative to the manifest. Tests cover parsing, validation, and sanitized errors.
CLI preparation and application commands
nemoguardrails/server/experimental/cli.py, nemoguardrails/server/experimental/__main__.py, nemoguardrails/server/experimental/application.md, tests/server/experimental/test_application_manifest.py
The CLI adds validate, inspect, schema, and serve commands. Tests cover assembly, inspection, schema output, command usage, and startup rollback. The documentation describes command behavior and configuration constraints.
Example policy and proxy integration
nemoguardrails/server/experimental/examples/basic/*, nemoguardrails/server/experimental/application.md, tests/server/experimental/test_proxy_launcher.py
The example configures a local OpenAI provider and email checks for input and output. Documentation and integration tests cover Chat Completions and Responses, buffered and streaming checks, and disconnect handling.

Streaming cleanup timeout test

Layer / File(s) Summary
Conditional cleanup timeout
tests/server/experimental/test_streaming_http.py
The test uses a 0.1-second cleanup timeout when cleanup hangs and a 0.01-second timeout in other modes.

Priority: ⬇️ Low

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  actor Operator
  participant TyperCLI
  participant Prepare as _prepare
  participant ManifestLoader as load_manifest
  participant FastAPIAssembly as FastAPI application assembly
  participant Uvicorn
  Operator->>TyperCLI: run serve with manifest
  TyperCLI->>Prepare: prepare application
  Prepare->>ManifestLoader: load manifest path
  ManifestLoader-->>Prepare: return ProxyConfig
  Prepare->>FastAPIAssembly: assemble application
  FastAPIAssembly-->>Prepare: return FastAPI application
  Prepare-->>TyperCLI: return config and application
  TyperCLI->>Uvicorn: run application with host and port
Loading
Merge Risk: ⚪ Minimal · up to c7c2f

No actionable merge-blocking issue remains in the reviewed launcher changes.

Pre-merge checks: Passed 5 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 38.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 44 functions across 6 files. (3 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 5 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: launching proxy applications from YAML manifests.
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.
Test Results For Major Changes Passed The PR is a major feature change, and its description includes testing information: it states that the change includes offline socket tests. The supplied validation summary also reports 98 launcher an…
Full details: Test Results For Major Changes

Explanation

The PR is a major feature change, and its description includes testing information: it states that the change includes offline socket tests. The supplied validation summary also reports 98 launcher and streaming HTTP tests on Python 3.10 and 3.13, plus passing pre-commit checks.

Full details: Docstring Coverage

Explanation

Docstring coverage is 38.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 44 functions across 6 files. (3 skipped: 3 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • 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.

@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no outstanding findings remain.

Summary

Adds a YAML launcher for proxy applications.

  • Proxy manifests load as bounded, fixed-selection configuration.
  • Operators can inspect and run a proxy from a YAML manifest.
  • The streaming test adjusts its timeout only for hanging closes.

The previous documentation finding is fixed. No new actionable issues were found. Runtime tests were not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[YAML manifest] --> B[Bounded loader]
  B --> C[Typed configuration]
  C --> D[Application assembly]
  D --> E[validate]
  D --> F[inspect]
  D --> G[serve]
  G --> H[Existing application lifespan]
  H --> I[Load trusted Rails and start HTTP owners]
  J[Manifest model] --> K[schema]
Loading

Reviews (4) · Last reviewed commit: "fix(server): retain resolver deadlines t..." · Reviewed by Greptile

Comment on lines +77 to +79
`validate` checks the declaration, directory/config-file availability, upstream
URL rules and route composition. It does not read Rails contents, import their
actions, start engines, contact providers or prove checker compatibility.

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.

P2 Validation promises too much

validate only checks that each Rails directory exists, not that config files are available. The new tests explicitly accept an empty directory. Remove “config-file availability” from this description so operators do not rely on a guarantee the command does not provide.

Suggested change
`validate` checks the declaration, directory/config-file availability, upstream
URL rules and route composition. It does not read Rails contents, import their
actions, start engines, contact providers or prove checker compatibility.
`validate` checks the declaration, directory availability, upstream URL rules
and route composition. It does not check config-file availability, read Rails
contents, import their actions, start engines, contact providers or prove checker
compatibility.
Prompt To Fix With AI
This is a comment left during a code review.
Path: nemoguardrails/server/experimental/application.md
Line: 77-79

Comment:
**Validation promises too much**

`validate` only checks that each Rails directory exists, not that config files are available. The new tests explicitly accept an empty directory. Remove “config-file availability” from this description so operators do not rely on a guarantee the command does not provide.

```suggestion
`validate` checks the declaration, directory availability, upstream URL rules
and route composition. It does not check config-file availability, read Rails
contents, import their actions, start engines, contact providers or prove checker
compatibility.
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-launcher-b branch from c7c2f0f to 0a725ca Compare October 21, 2026 11:56
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-launcher-b branch from 0a725ca to 076e078 Compare October 21, 2026 15:42
Let operators validate, inspect and serve the existing typed composition without Python glue. Keep the CLI inside the server so independent packaging does not depend on the library executable.

Derive manifest validation and editor schema from the Python configuration, require fixed Rails bindings, bound YAML parsing, reject indirection and sanitize diagnostics. Inspect actual directional profiles without exposing unfinished variant selection.

Reuse the existing lifespan and provide separate proxy/Rails example files. Manifest and CLI regressions include real-core partial catalogue rollback. Core cancellation and incomplete-cleanup prerequisites remain separate; the known queue cleanup retry regression still fails.

Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Adapt the preserved local-upstream harness to the server-owned module CLI and existing application assembly. Check native and LiteLLM Chat and Responses in buffered and streaming modes, block input before dispatch, and withhold blocked output.

Verify guarded and passthrough disconnects close upstream sockets, later requests still work, and launcher subprocesses terminate cleanly. Fixtures are synthetic and use no live provider credentials. These smoke tests do not establish resolution of the separate interrupted-cleanup prerequisites.

Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Keep the manifest and Rails example under the server's ownership so the planned standalone-package move can carry them together. Update guide commands and socket-test paths without changing runtime or configuration behavior.

Validation: 71 manifest and localhost launcher tests passed; changed-file pre-commit passed.
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Replace smoke-test markers with a local email-pattern input/output rule and use explicit 200/50 streaming windows. Explain provider-delta units, buffering latency, detection limits, and the inability to retract previously released prefixes.

Exercise the shipped configuration over real sockets, including split addresses, partial and full blocked windows, and downstream disconnects. Leave temporary smoke tooling untouched.

Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Copy the complete bundled example into a deployment-owned directory and use the local proxy.yaml path for launcher commands. Keep the module entry point supported by this branch; the standalone executable belongs to the later packaging change.

Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Create an isolated Windows process group and send CTRL_BREAK_EVENT, which Uvicorn handles for graceful shutdown, instead of forcefully terminating the process. Keep the bounded shutdown wait, forced reap on failure and shutdown-complete assertion on every platform; scope the POSIX signal exit-code assertion to POSIX.

Validation: all five real-socket launcher tests passed on Python 3.10 and 3.13; pre-commit passed. Windows execution requires CI confirmation.
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Allow 30 seconds for server draining and the existing Rails and HTTP cleanup budgets. Reap the child before reporting a timeout and include its complete output. Require shutdown completion without cleanup-failure or cleanup-timeout warnings on every platform.

Validation: all five real-socket launcher tests passed on Python 3.10 and 3.13; pre-commit passed.
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Send an explicit TCP write EOF and drain the peer's remaining response before closing the downstream socket. Keep the live ASGI disconnect, upstream closure and continued-serving assertions while avoiding a reset that can interrupt Windows Proactor socket cleanup before server detachment. Preserve normal cleanup budgets for healthy closers and shorten them only for intentionally hanging test doubles.

Validation: 98 launcher and streaming HTTP tests passed on Python 3.10 and 3.13; pre-commit passed.
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-launcher-b branch from 076e078 to a85214f Compare October 21, 2026 18:19
@Pouyanpi
Pouyanpi removed this pull request from stack #2477 October 22, 2026 10:55
@Pouyanpi
Pouyanpi added this pull request to stack #2487 October 22, 2026 10:57

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: L status: triaged Triaged by a maintainer; eligible for automated review (CodeRabbit/Greptile). temp: guardrails-proxy

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant