Skip to content

[#17016][feat] Add selectable OpenEngine gRPC server - #17084

Open
connorcarpenter15 wants to merge 4 commits into
NVIDIA:mainfrom
connorcarpenter15:feat/openengine-server-stub
Open

[#17016][feat] Add selectable OpenEngine gRPC server#17084
connorcarpenter15 wants to merge 4 commits into
NVIDIA:mainfrom
connorcarpenter15:feat/openengine-server-stub

Conversation

@connorcarpenter15

@connorcarpenter15 connorcarpenter15 commented Jul 30, 2026

Copy link
Copy Markdown

Dev Engineer Review

  • Adds selectable smg and openengine gRPC protocols.
  • Preserves SMG as the default for existing --grpc usage.
  • Adds an intentionally unimplemented OpenEngineServer.
  • Keeps tensorrt_llm.grpc protocol-neutral.
  • Adds the openengine optional dependency extra and Docker packaging support.
  • Adds dependency, provenance, compatibility, and maintenance documentation.
  • Rejects invalid protocol combinations and unsupported VisualGen gRPC mode.
  • Updates CLI stability metadata for OpenEngine host and port options.
  • Review focus: verify optional dependency handling, CLI validation, server lifecycle behavior, bind failure handling, and SMG import compatibility.

QA Engineer Review

  • Test changes are limited to tests/unittest/api_stability/references/trtllm_serve_cli.yaml.
  • The reference adds prototype entries for --openengine-host and --openengine-port.
  • No test functions were added, modified, or removed.
  • The reported validation covers dependency installation, RPC status behavior, CLI launching, pre-commit checks, bytecode compilation, and diff formatting.
  • Verdict: sufficient.

Description

Implement the gRPC protocol structure and first OpenEngine integration proposed in #17016.

  • Move the existing SMG implementation under tensorrt_llm/grpc/smg/ and keep tensorrt_llm.grpc protocol-neutral.
  • Add prototype --grpc-protocol {smg,openengine} selection to trtllm-serve. Existing --grpc invocations continue to select SMG by default.
  • Add tensorrt_llm.grpc.openengine.OpenEngineServer as a dedicated gRPC server selected with --grpc --grpc-protocol openengine.
  • Register the generated OpenEngine InferenceServicer and ControlServicer bases directly, so all 11 v0.1.0 RPCs intentionally return UNIMPLEMENTED and no request reaches the TensorRT-LLM engine.
  • Add the OpenEngine bindings as an opt-in openengine pip extra. The default install gains no new dependency.
  • Reject --grpc-protocol openengine without --grpc and reject gRPC mode for VisualGen. The normal OpenAI HTTP path is unchanged.
  • Preserve actionable dependency errors for both SMG and OpenEngine.

The OpenEngine bindings come from the public OpenEngine repository release v0.1.0 and the Buf Schema Registry module at immutable commit 768a93c7b44e40f28c692ad0b471a8f2. Package versions, SHA-256 provenance, installation instructions, and the adapter maintenance boundary are documented in tensorrt_llm/grpc/openengine/README.md.

This PR deliberately does not copy proto files or add request conversion, engine hooks, LoRA behavior, KV integration, or request tracking.

Maintainer action: please apply the api-compatible label for the prototype CLI metadata change. GitHub does not grant external contributors permission to add repository labels.

Test Coverage

  • Installed the optional dependencies from the Buf index in a clean Python 3.10 environment; dependency consistency check passed.
  • Manually validated in a local loopback environment that all 11 unary and streaming RPCs return exact status grpc.StatusCode.UNIMPLEMENTED.
  • This initial stub PR deliberately adds no OpenEngine test module, TRT-LLM test-list registration, or Jenkins dependency installation.
  • Ran pre-commit against all changed files; all applicable hooks passed.
  • Ran Python bytecode compilation and git diff --check for the changed implementation.
  • The full CLI stability suite requires the current TensorRT-LLM compiled bindings and is left to upstream CI; its reference metadata is updated for --grpc-protocol.

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • If PR introduces API changes, an appropriate PR label is added - either api-compatible or api-breaking. For api-breaking, include BREAKING in the PR title.

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

To see a list of available CI bot commands, please comment /bot help.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: c515e3d1-729f-4c66-8371-ed8a8152218d

📥 Commits

Reviewing files that changed from the base of the PR and between 0a455c3 and 478c3c2.

📒 Files selected for processing (4)
  • tensorrt_llm/commands/serve.py
  • tensorrt_llm/grpc/openengine/server.py
  • tensorrt_llm/grpc/smg/__init__.py
  • tensorrt_llm/grpc/smg/server.py
🚧 Files skipped from review as they are similar to previous changes (4)
  • tensorrt_llm/grpc/openengine/server.py
  • tensorrt_llm/grpc/smg/init.py
  • tensorrt_llm/grpc/smg/server.py
  • tensorrt_llm/commands/serve.py

Walkthrough

Changes

OpenEngine dependencies and packaging

Layer / File(s) Summary
OpenEngine dependency and build inputs
requirements-openengine.txt, setup.py, docker/Dockerfile.multi, .github/CODEOWNERS
Adds pinned OpenEngine packages and compatible grpcio and protobuf versions. Exposes the dependencies through the openengine package extra and copies the requirements file into the wheel build stage.

SMG gRPC server lifecycle

Layer / File(s) Summary
SMG package and server launcher
tensorrt_llm/grpc/smg/*
Adds optional SMG protobuf and servicer loading, backend initialization, gRPC registration, signal handling, graceful shutdown, and public exports.

OpenEngine gRPC stub lifecycle

Layer / File(s) Summary
OpenEngine server and integration contract
tensorrt_llm/grpc/openengine/*
Adds OpenEngineServer with bind, start, stop, and termination handling. Exports its lifecycle entry point and documents its UNIMPLEMENTED RPC behavior and pinned schema packages.

Serving lifecycle and CLI wiring

Layer / File(s) Summary
Protocol-specific serving dispatch
tensorrt_llm/commands/serve.py, tensorrt_llm/grpc/__init__.py, tests/unittest/api_stability/references/trtllm_serve_cli.yaml
Adds --grpc-protocol, validates gRPC frontend and VisualGen combinations, dispatches to SMG or OpenEngine, provides missing-binding guidance, and removes legacy top-level gRPC exports.

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

Possibly related issues

Possibly related PRs

Suggested reviewers: qijune, brnguyen2

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. 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 clearly identifies the selectable OpenEngine gRPC server feature and follows the repository's issue and type format.
Description check ✅ Passed The description explains the change, scope, dependency handling, test coverage, and checklist status in the required template structure.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tensorrt_llm/commands/serve.py (1)

517-534: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Complete annotations for the modified callables.

  • tensorrt_llm/commands/serve.py#L517-L534: annotate launch_server with -> None.
  • tensorrt_llm/commands/serve.py#L640-L655: annotate serve_http_and_openengine with -> None.
  • tensorrt_llm/commands/serve.py#L1317-L1341: annotate serve with -> None.
  • tests/unittest/openengine/test_server.py#L38-L40: annotate the parametrized inputs using precise stub/request factory types.

As per coding guidelines, “Annotate every function.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tensorrt_llm/commands/serve.py` around lines 517 - 534, Complete the callable
annotations: add -> None to launch_server, serve_http_and_openengine, and serve
in tensorrt_llm/commands/serve.py. In tests/unittest/openengine/test_server.py
lines 38-40, annotate the parametrized inputs with the precise stub and
request-factory types used by the test.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@requirements-openengine.txt`:
- Line 1: Add the required NVIDIA SPDX copyright and license header at the
beginning of requirements-openengine.txt, placing it before the existing
--extra-index-url directive and preserving the pip configuration unchanged.

In `@tensorrt_llm/openengine/server.py`:
- Line 32: Update the address construction in OpenEngineServer to bracket IPv6
literal hosts before appending the port, producing targets such as [::1]:50051
while preserving existing formatting for IPv4 addresses and hostnames.

In `@tensorrt_llm/serve/openai_server.py`:
- Line 270: Document the new lifecycle parameters: in
tensorrt_llm/serve/openai_server.py at lines 270-270, update the public function
docstring to explain that shutdown_generator=False delegates LLM shutdown to the
sibling-server owner; in tensorrt_llm/openengine/server.py at lines 43-46, add a
Google-style Args entry describing grace and its effect on gRPC termination.

---

Outside diff comments:
In `@tensorrt_llm/commands/serve.py`:
- Around line 517-534: Complete the callable annotations: add -> None to
launch_server, serve_http_and_openengine, and serve in
tensorrt_llm/commands/serve.py. In tests/unittest/openengine/test_server.py
lines 38-40, annotate the parametrized inputs with the precise stub and
request-factory types used by the test.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 7b583cd8-ee03-4596-b2b2-2906e5d7728f

📥 Commits

Reviewing files that changed from the base of the PR and between c083da6 and 0572db3.

📒 Files selected for processing (10)
  • docker/Dockerfile.multi
  • requirements-openengine.txt
  • setup.py
  • tensorrt_llm/commands/serve.py
  • tensorrt_llm/openengine/README.md
  • tensorrt_llm/openengine/__init__.py
  • tensorrt_llm/openengine/server.py
  • tensorrt_llm/serve/openai_server.py
  • tests/unittest/api_stability/references/trtllm_serve_cli.yaml
  • tests/unittest/openengine/test_server.py

Comment thread requirements-openengine.txt
Comment thread tensorrt_llm/openengine/server.py Outdated
Comment thread tensorrt_llm/serve/openai_server.py Outdated
@mikeiovine
mikeiovine requested a review from Mgluhovskoi July 31, 2026 15:49
Comment on lines +2 to +4
openengine-openengine-grpc-python==1.67.1.2.20260730172104+768a93c7b44e
openengine-openengine-protocolbuffers-python==31.1.0.2.20260730172104+768a93c7b44e
openengine-openengine-protocolbuffers-pyi==31.1.0.2.20260730172104+768a93c7b44e

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The provenance of these packages is not documented well in the package metadata, so I'll need to do some digging before we can approve this.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hi @tburt-nv, for some additional context:

OpenEngine is a gRPC proto being developed by the Dynamo team for interactions between Dynamo and inference engines. The schema source lives in ai-dynamo/openengine, and releases are published to Buf Build openengine/openengine. The packages above are automatically generated by Buf (which is why the names are a bit ugly and documentation is sparse) and published for use.

@connorcarpenter15
connorcarpenter15 requested a review from a team as a code owner August 3, 2026 17:15

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🧹 Nitpick comments (1)
tests/unittest/grpc/openengine/test_server.py (1)

40-59: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Cover the startup-failure path before merging.

await server.start() runs before try, so a startup exception bypasses the finally block and server.stop(grace=0). Move await server.start() inside try. Add a regression case that forces startup to fail after the constructor binds the port. grpc.aio.Server.stop() is documented as callable at any time. (grpc.github.io)

Test coverage summary

  • Added: test_all_openengine_rpcs_are_unimplemented, test_format_bind_address.
  • Removed: none.
  • CI list: tests/integration/test_lists/test-db/l0_cpu_x86.yml includes unittest/grpc/openengine/test_server.py.
  • Manual QA list: not provided, so membership is not verifiable.
  • Coverage verdict: needs follow-up. RPC status and address formatting are covered. Startup-failure cleanup and bind-failure behavior are not covered.

As per path instructions, this summary reports changed test functions, test-list membership, and a coverage verdict.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unittest/grpc/openengine/test_server.py` around lines 40 - 59, Move
await server.start() inside the existing try/finally in
test_all_openengine_rpcs_are_unimplemented so server.stop(grace=0) always runs,
including startup failures. Add a regression test that forces startup to fail
after OpenEngineServer construction has bound the port, and verify cleanup
remains safe when stop is called after the failed start.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tensorrt_llm/grpc/openengine/lifecycle.py`:
- Around line 29-34: Update the lifecycle startup flow to initialize
openengine_server as None, then call stop(grace=0) after a constructed
OpenEngineServer fails during start() and before on_startup_failure() re-raises
the exception. Guard the cleanup so stop is called only when construction
succeeded, including the existing cancellation and exception paths.

In `@tensorrt_llm/grpc/openengine/README.md`:
- Around line 50-51: Update the documentation sentence near the Buf link to
hyphenate the compound modifier, changing “Python generated SDK guide” to
“Python-generated SDK guide” without altering the link or surrounding wording.

---

Nitpick comments:
In `@tests/unittest/grpc/openengine/test_server.py`:
- Around line 40-59: Move await server.start() inside the existing try/finally
in test_all_openengine_rpcs_are_unimplemented so server.stop(grace=0) always
runs, including startup failures. Add a regression test that forces startup to
fail after OpenEngineServer construction has bound the port, and verify cleanup
remains safe when stop is called after the failed start.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 7f7b6218-7b8c-4897-9ab1-199a6995afbc

📥 Commits

Reviewing files that changed from the base of the PR and between 0572db3 and 200f1a1.

📒 Files selected for processing (10)
  • .github/CODEOWNERS
  • jenkins/L0_Test.groovy
  • requirements-openengine.txt
  • tensorrt_llm/commands/serve.py
  • tensorrt_llm/grpc/openengine/README.md
  • tensorrt_llm/grpc/openengine/__init__.py
  • tensorrt_llm/grpc/openengine/lifecycle.py
  • tensorrt_llm/grpc/openengine/server.py
  • tests/integration/test_lists/test-db/l0_cpu_x86.yml
  • tests/unittest/grpc/openengine/test_server.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • requirements-openengine.txt
  • tensorrt_llm/commands/serve.py

Comment thread tensorrt_llm/grpc/openengine/lifecycle.py Outdated
Comment thread tensorrt_llm/grpc/openengine/README.md Outdated
Signed-off-by: Connor Carpenter <connorc@nvidia.com>
Signed-off-by: Connor Carpenter <connorc@nvidia.com>
@connorcarpenter15
connorcarpenter15 force-pushed the feat/openengine-server-stub branch from a5e629b to 0a455c3 Compare August 3, 2026 23:02
@connorcarpenter15 connorcarpenter15 changed the title [None][feat] Add OpenEngine stub gRPC server [#17016][feat] Add selectable OpenEngine gRPC server Aug 3, 2026

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tensorrt_llm/commands/serve.py (1)

1321-1346: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Reject multiple frontends in gRPC mode.

num_serve_frontends is not in unsupported_args. Neither tensorrt_llm.grpc.smg.server.launch_server nor tensorrt_llm.grpc.openengine.server.launch_server creates attached frontend processes. Reject num_serve_frontends != 1 here, or implement the required gRPC multi-frontend lifecycle.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tensorrt_llm/commands/serve.py` around lines 1321 - 1346, The gRPC validation
in the serve command does not reject unsupported multiple frontends. Update the
grpc branch near unsupported_args to validate num_serve_frontends and raise a
ValueError unless it equals 1, before launching either gRPC server path;
preserve the existing unsupported-argument checks.
🧹 Nitpick comments (1)
tensorrt_llm/grpc/openengine/server.py (1)

67-68: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document the public parameters.

launch_server is exported, but its docstring does not document host or port. Add an Args: section.

As per coding guidelines, “Prefer docstrings for external interfaces, use Google-style docstrings, document public function arguments.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tensorrt_llm/grpc/openengine/server.py` around lines 67 - 68, Update the
public launch_server docstring to include a Google-style Args section
documenting the host and port parameters, including their expected values or
purpose.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tensorrt_llm/grpc/smg/__init__.py`:
- Around line 84-95: Sort the __all__ entries in the smg package according to
Ruff’s configured ordering, including PROTOS_AVAILABLE, GrpcRequestManager, and
the remaining exported symbols, without changing which names are exported.

In `@tensorrt_llm/grpc/smg/server.py`:
- Around line 97-100: Update the server startup flow around add_insecure_port
and the startup logger to capture its returned bound port, then log the resolved
host and port; this must report the actual dynamically assigned port when the
configured port is zero while preserving the configured-port behavior otherwise.

---

Outside diff comments:
In `@tensorrt_llm/commands/serve.py`:
- Around line 1321-1346: The gRPC validation in the serve command does not
reject unsupported multiple frontends. Update the grpc branch near
unsupported_args to validate num_serve_frontends and raise a ValueError unless
it equals 1, before launching either gRPC server path; preserve the existing
unsupported-argument checks.

---

Nitpick comments:
In `@tensorrt_llm/grpc/openengine/server.py`:
- Around line 67-68: Update the public launch_server docstring to include a
Google-style Args section documenting the host and port parameters, including
their expected values or purpose.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: f329d5d5-77b8-4132-89ac-f05e8cee07a4

📥 Commits

Reviewing files that changed from the base of the PR and between a5e629b and 0a455c3.

📒 Files selected for processing (15)
  • .github/CODEOWNERS
  • docker/Dockerfile.multi
  • jenkins/L0_Test.groovy
  • requirements-openengine.txt
  • setup.py
  • tensorrt_llm/commands/serve.py
  • tensorrt_llm/grpc/__init__.py
  • tensorrt_llm/grpc/openengine/README.md
  • tensorrt_llm/grpc/openengine/__init__.py
  • tensorrt_llm/grpc/openengine/server.py
  • tensorrt_llm/grpc/smg/__init__.py
  • tensorrt_llm/grpc/smg/request_manager.py
  • tensorrt_llm/grpc/smg/server.py
  • tensorrt_llm/grpc/smg/servicer.py
  • tests/integration/test_lists/test-db/l0_cpu_x86.yml
🚧 Files skipped from review as they are similar to previous changes (7)
  • jenkins/L0_Test.groovy
  • tests/integration/test_lists/test-db/l0_cpu_x86.yml
  • .github/CODEOWNERS
  • setup.py
  • requirements-openengine.txt
  • docker/Dockerfile.multi
  • tensorrt_llm/grpc/openengine/README.md

Comment thread tensorrt_llm/grpc/smg/__init__.py
Comment thread tensorrt_llm/grpc/smg/server.py Outdated
Signed-off-by: Connor Carpenter <connorc@nvidia.com>
Signed-off-by: Connor Carpenter <connorc@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants