Skip to content

fix: preserve completed results after cleanup failures - #140

Draft
bbednarski9 wants to merge 3 commits into
NVIDIA:mainfrom
bbednarski9:fix/preserve-runtime-result-on-stop-failure
Draft

fix: preserve completed results after cleanup failures#140
bbednarski9 wants to merge 3 commits into
NVIDIA:mainfrom
bbednarski9:fix/preserve-runtime-result-on-stop-failure

Conversation

@bbednarski9

@bbednarski9 bbednarski9 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Overview

Fix the runtime contract exposed by the Terminal-Bench task 010 failure, where a completed adapter response could be lost when shutdown failed afterward.

This change:

  • returns the completed output as a failed RunResult when one-shot runtime cleanup fails;
  • records the structured stop error in RunResult.error and metadata.cleanup_errors;
  • preserves adapter lifecycle stage, code, retryable, metadata, runtime ID, and diagnostics through Rust, PyO3, and the public Python exceptions;
  • keeps explicit Runtime.stop() failures visible as FabricRuntimeError; and
  • refreshes the three stale workspace package versions in Cargo.lock so locked Rust checks work from current main.

There are no breaking configuration or dependency changes.

Rust API compatibility

This intentionally changes the pre-1.0 Rust source contract for
FabricError::AdapterLifecycleOperation in NeMo Fabric 0.2.0. Downstream code
that constructs this variant must now provide retryable and metadata.
Pattern matches should bind those fields when needed or include .. to remain
compatible with future diagnostic fields. This keeps lifecycle error details
structured instead of embedding them in the human-readable diagnostics string.

Details

  • crates/fabric-core/src/runtime.rs preserves completed results across stop failures for CLI/native run_plan callers.
  • crates/fabric-python/src/lib.rs carries structured adapter lifecycle fields across the PyO3 exception boundary.
  • python/src/nemo_fabric/runtime.py applies the same one-shot cleanup behavior to the async Python lifecycle and retains structured errors for explicit runtime operations.
  • Rust, mocked SDK, and native adapter-shim regressions cover the task-010 sequence, including a retryable adapter stop failure after output is complete.
  • Public SDK documentation and the consumer integration skill now describe the cleanup-error contract and the Rust enum migration.

Validation

  • Rebased onto main at 2b4cf99.
  • cargo fmt --all -- --check
  • cargo check -p fabric-python --locked
  • cargo test --workspace --locked — 60 tests passed.
  • Rebuilt the native Python runtime with uv sync --reinstall-package nemo-fabric-runtime.
  • Full Python test suite — 515 passed, 15 skipped.
  • Focused post-rebuild native bridge and SDK contract checks — 3 passed.
  • Review-fix Rust regression suite — 38 tests passed.
  • Review-fix Python runtime/native SDK suites — 31 tests passed.
  • pre-commit run --from-ref upstream/main --to-ref HEAD — all applicable checks passed, including Cargo lock, Rust attribution, and dependency license-diff validation.
  • Focused pre-commit validation for the review fixes — passed.
  • git diff --check

Where should the reviewer start?

Start with crates/fabric-core/src/runtime.rs::run_plan and preserve_stop_failure, then review tests/python/test_native_sdk.py::test_native_sdk_preserves_completed_output_when_stop_fails for the end-to-end contract across the adapter host, Rust core, PyO3, and Python SDK.

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

  • Relates to: none

  • 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.

Summary by CodeRabbit

  • Bug Fixes

    • Preserved completed run output when shutdown or cleanup fails, while marking the result as failed.
    • Exposed structured lifecycle error details, including retryability and diagnostic metadata.
    • Improved handling when both invocation and cleanup operations fail.
  • Documentation

    • Clarified cleanup failure behavior, error reporting, and compatibility guidance for lifecycle errors.
  • Tests

    • Added coverage for structured errors and preservation of output after shutdown failures.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Lifecycle errors now include retryability and metadata. Runtime shutdown failures preserve completed output while marking results failed, and structured native errors propagate through Rust and Python APIs. Tests, adapter fixtures, API references, SDK documentation, and integration guidance cover the updated behavior.

Changes

Lifecycle error propagation

Layer / File(s) Summary
Rust lifecycle error contract and preservation
crates/fabric-core/src/error.rs, crates/fabric-core/src/runtime.rs
AdapterLifecycleOperation now carries retryability and metadata. Stop failures are normalized into failed results while preserving invocation output, events, and cleanup error metadata.
Python native error translation and SDK behavior
crates/fabric-python/src/lib.rs, python/src/nemo_fabric/*.py, tests/fixtures/hermes-shim-agent/..., tests/python/*
Structured native lifecycle errors are translated into Python runtime errors, and stop failures preserve completed results while exposing structured error details.
Lifecycle error and cleanup documentation
docs/reference/api/..., docs/sdk/python.mdx, skills/integrations/consumer/nemo-fabric-integrate/...
Documentation describes retryable lifecycle fields, preserved output after cleanup failure, and cleanup error handling across run(...) and async with.

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

Sequence Diagram(s)

sequenceDiagram
  participant PythonSDK
  participant NativeRuntime
  participant Adapter
  participant RunResult
  PythonSDK->>NativeRuntime: invoke runtime plan
  NativeRuntime->>Adapter: stop runtime after invocation
  Adapter-->>NativeRuntime: return structured lifecycle failure
  NativeRuntime->>RunResult: preserve output and mark failed
  NativeRuntime->>RunResult: record error and metadata.cleanup_errors
  NativeRuntime-->>PythonSDK: return normalized RunResult
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.71% 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
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.
Title check ✅ Passed The title follows Conventional Commits and accurately summarizes the main change.
Description check ✅ Passed The description matches the template well, including overview, reviewer start point, related issues, and validation details.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@github-actions

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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)
crates/fabric-core/src/runtime.rs (1)

1499-1518: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Redundant metadata embedding now that metadata is structured.

The pre-existing diagnostics string still appends a serialized copy of error.metadata ("adapter metadata: {json}") even though the same metadata is now carried structurally via the new metadata field (Lines 1515-1516). Combined with runtime_error_info re-inserting diagnostics back into the final metadata map (Line 1598-1603), the resulting error payload embeds a duplicate, nested serialization of the same data inside metadata["diagnostics"]. Consider dropping the string embedding now that the structured field exists.

♻️ Suggested cleanup
-            let mut diagnostics = local_host_diagnostics(host);
-            if !error.metadata.is_empty()
-                && let Ok(metadata) = serde_json::to_string(&error.metadata)
-            {
-                if !diagnostics.is_empty() {
-                    diagnostics.push('\n');
-                }
-                diagnostics.push_str("adapter metadata: ");
-                diagnostics.push_str(&metadata);
-            }
+            let diagnostics = local_host_diagnostics(host);
🤖 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 `@crates/fabric-core/src/runtime.rs` around lines 1499 - 1518, Remove the
serialized metadata append block from the lifecycle error construction around
local_host_diagnostics and lifecycle_error_with_details. Keep diagnostics
limited to the pre-existing host diagnostics while continuing to pass
error.metadata through the structured metadata argument.
🤖 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 `@crates/fabric-core/src/runtime.rs`:
- Around line 1585-1611: Update runtime_error_info’s AdapterLifecycleOperation
metadata enrichment to avoid overwriting adapter-provided keys: use distinct
namespaced keys for the derived runtime_id and diagnostics entries, preserving
the original adapter metadata when collisions occur. Add or update a test
covering both key collisions and confirming the adapter values remain intact.

In `@python/src/nemo_fabric/runtime.py`:
- Around line 456-461: Update the exception handling around stop_runtime in the
runtime cleanup flow to log the stop failure when invoke_error is already set,
while preserving the primary invoke error and existing _preserve_stop_failure
behavior for standalone stop failures. Use the module’s established logging
mechanism and include the caught error details before resetting stop_events.

---

Outside diff comments:
In `@crates/fabric-core/src/runtime.rs`:
- Around line 1499-1518: Remove the serialized metadata append block from the
lifecycle error construction around local_host_diagnostics and
lifecycle_error_with_details. Keep diagnostics limited to the pre-existing host
diagnostics while continuing to pass error.metadata through the structured
metadata argument.
🪄 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: ASSERTIVE

Plan: Enterprise

Run ID: ee40e8ce-b60c-46f0-9c60-6f3d18ccdddf

📥 Commits

Reviewing files that changed from the base of the PR and between 0f16259 and 3256974.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (13)
  • crates/fabric-core/src/error.rs
  • crates/fabric-core/src/runtime.rs
  • crates/fabric-python/src/lib.rs
  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • docs/sdk/python.mdx
  • python/src/nemo_fabric/client.py
  • python/src/nemo_fabric/runtime.py
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/python/test_native_sdk.py
  • tests/python/test_runtime.py
📜 Review details
⏰ Context from checks skipped due to timeout. (7)
  • GitHub Check: Test (Python 3.14, windows-amd64)
  • GitHub Check: Test (Python 3.14, macos-arm64)
  • GitHub Check: Test (Python 3.12, windows-amd64)
  • GitHub Check: Test (Python 3.12, macos-arm64)
  • GitHub Check: Test (Python 3.11, windows-amd64)
  • GitHub Check: Test (Python 3.13, windows-amd64)
  • GitHub Check: Pre-commit
🧰 Additional context used
📓 Path-based instructions (41)
**/*.{md,rst}

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

Update documentation and examples in the same branch as the public API change.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
{README.md,docs/**/*.{md,mdx,yml},examples/**/*.{md,mdx,yml}}

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

Keep package names, repository references, and build commands current in documentation and examples.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • docs/sdk/python.mdx
{docs/**/*.{md,mdx,yml},examples/**/*.{md,mdx,yml}}

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

Update relevant getting-started, reference, adapter, and example documentation when the corresponding examples or adapters change.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • docs/sdk/python.mdx
docs/**/*.{md,mdx,yml}

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

Run just docs when the documentation site changes.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • docs/sdk/python.mdx
**/*

📄 CodeRabbit inference engine (.agents/skills/karpathy-guidelines/SKILL.md)

**/*: Before implementing, explicitly state assumptions, surface ambiguity and tradeoffs, present multiple interpretations when relevant, and ask for clarification rather than silently deciding or proceeding when requirements are unclear.
Prefer the minimum code needed to solve the requested problem: avoid speculative features, unnecessary abstractions, unrequested flexibility, and handling of impossible scenarios; simplify overcomplicated solutions.
When editing existing code, make surgical changes only: do not modify unrelated code, comments, formatting, or pre-existing dead code; match the existing style, and remove only unused imports, variables, or functions introduced by your changes.
Define verifiable success criteria for each task, such as writing regression tests for bugs and invalid-input tests for validation, then verify the implementation against those criteria. For multi-step work, state a brief plan with a verification check for each step.

**/*: Always spell NVIDIA in all caps; do not use Nvidia, nvidia, nVidia, nVIDIA, or NV.
Use an NVIDIA before a noun, because the name begins with an “en” sound.
Do not add a registered trademark symbol after NVIDIA when referring to the company; use trademark symbols with product names only when required by the document type or legal guidance.
Verify official capitalization, spacing, hyphenation, and spelling for NVIDIA and third-party product names; do not rewrite official product names for grammar or title-case rules.
Precede NVIDIA product names with NVIDIA on first mention when natural and accurate, and link the first mention when the destination helps the reader.
On first use, include the company name and full model qualifier when it helps identify the model; preserve official capitalization and punctuation, and use shorter family names only after establishing the full name.
For learning-oriented and developer content, do not force trademark symbols unless explicitly required; for press, ...

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • crates/fabric-core/src/error.rs
  • tests/python/test_native_sdk.py
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
  • crates/fabric-python/src/lib.rs
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • python/src/nemo_fabric/client.py
  • docs/sdk/python.mdx
  • tests/python/test_runtime.py
  • python/src/nemo_fabric/runtime.py
  • crates/fabric-core/src/runtime.rs
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
**/*.{md,mdx,rst}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)

**/*.{md,mdx,rst}: For NeMo Fabric documentation, verify technical claims against the current repository, public API, or documented command before reviewing style.
Always spell NVIDIA in all caps; do not use Nvidia, nvidia, or NV.
Format commands, code elements, expressions, package names, file names, and paths as inline code.
Use descriptive link text; avoid raw URLs and weak anchors such as here or read more.
Use title case consistently for technical documentation headings.
Introduce code blocks, lists, tables, and images with complete sentences.
Write procedures as imperative, parallel steps; split long procedures into smaller tasks.
Prefer active voice, present tense, short sentences, contractions, and plain English while preserving necessary technical precision.
Use can for possibility and reserve may for permission.
Use after for temporal relationships instead of once, and prefer refer to over see when directing readers to another resource.
Avoid culture-specific idioms, unnecessary Latinisms, jokes, and marketing exaggeration in technical documentation.
Spell out months in body text, avoid ordinal dates, and use clear time zones.
Spell out whole numbers from zero through nine unless they are technical values, parameters, versions, or UI values; use numerals for 10 or greater and commas in thousands.
Do not add trademark symbols to learning-oriented documentation unless the source, platform, or legal guidance explicitly requires them.
Do not replace precise technical terms with simpler words when doing so would lose precision.
Do not flag passive voice when the actor is unknown or the action is the important part.
Do not rewrite API names, package names, command flags, or code literals for style.

**/*.{md,mdx,rst}: Use consistent title case for technical-document headings and table headers; avoid quotation marks, ampersands, and exclamation marks in headings, while preserving official product, event, research, and whitepaper title ...

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • docs/sdk/python.mdx
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
**/*.{md,rst,txt,adoc}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-language-mechanics.md)

**/*.{md,rst,txt,adoc}: For technical documentation, use professional, active, conversational, engaging, precise, and plain-English prose. Prefer active voice, present tense, short sentences, and scannable paragraphs. Avoid casual or imprecise language, swearing, threats, insults, jokes, puns, culture-specific idioms, marketing exaggeration, and unsupported third-party comparisons.
Use can for possibility and reserve may for permission; use after for temporal order; use refer to for cross-references; prefer short direct sentences and specific verbs; avoid unnecessary please in technical documentation.
Prefer active voice when the actor matters. Passive voice is acceptable when the actor is unknown or irrelevant, when the action or result is the focus, or in programmer documentation.
Use natural contractions in conversational technical prose, but do not force them in formal legal copy, API references, or generated text.
Prefer simpler English over Latinisms: use for example or such as instead of e.g., and so on instead of etc., that is instead of i.e., compared to instead of vs., and by, through, or using instead of via. Use industry-standard terms such as in silico, in vitro, and in vivo when appropriate, and italicize them in running text.
Use that without commas for essential clauses, and which with commas for nonessential clauses.
Format dates and times clearly: spell out months in body text; use forms such as June 12, 2025; avoid numeric or ordinal dates; capitalize days; use 12-hour time when appropriate; include a space before a.m. or p.m.; use ET and PT for needed time zones; avoid 24/7; and prefer from 12:30 to 1:00 p.m. for prose ranges.
Format numbers consistently: spell out zero through nine in body text, use numerals for 10 or greater and for technical values, use commas in thousands, do not begin a sentence with a numeral, spell out ordinals, and use numerals consistently within a category wh...

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
docs/**/*

📄 CodeRabbit inference engine (AGENTS.md)

Update Fern documentation under docs/ when public behavior, the nemo-fabric package, examples, or supported bindings change.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • docs/sdk/python.mdx
docs/reference/api/**

📄 CodeRabbit inference engine (AGENTS.md)

Regenerate or update generated API references under docs/reference/api/ when the public API changes.

Treat all files under docs/reference/api/ as generated output and do not modify them directly.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
**/*.{md,mdx}

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

**/*.{md,mdx}: Use the full product name NVIDIA NeMo Fabric on its first usage, typically in the title or H1; use NeMo Fabric thereafter.
Use fabric by itself only when referring to the CLI tool, and surround those references with backticks.
Capitalize NVIDIA correctly in public documentation.
Format commands, code elements, expressions, file names, paths, and filenames as inline code where needed.
Use title case consistently for headings in technical documentation.
Introduce code blocks, tables, and lists with complete lead-in sentences.
Use descriptive anchor text instead of raw URLs or generic link text such as here.
Prefer active voice, present tense, short sentences, and plain English.
Use consistent terminology for the same concept throughout a document.
Write procedures as imperative, parallel, easy-to-scan steps, and split long sequences into smaller tasks.
Use after instead of once when expressing temporal sequence.
Use can instead of may when the intended meaning is possibility rather than permission.
Avoid ambiguous numeric dates and ordinal dates in body text.
For learning-oriented documentation, do not force trademark symbols unless the source document explicitly requires them.
Introduce examples' code blocks with full sentences and ensure examples match current APIs and build commands.

For docs site changes, run just docs to regenerate Python and Rust API references and validate the Fern configuration.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • docs/sdk/python.mdx
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
**/*.{rs,py,html,md,mdx,toml,yml,yaml,sh,bash}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

All Rust, Python, HTML, Markdown, MDX, TOML, YAML, and shell source files must include the project SPDX copyright and Apache-2.0 license headers using the comment syntax appropriate to each file type.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • crates/fabric-core/src/error.rs
  • tests/python/test_native_sdk.py
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
  • crates/fabric-python/src/lib.rs
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • python/src/nemo_fabric/client.py
  • docs/sdk/python.mdx
  • tests/python/test_runtime.py
  • python/src/nemo_fabric/runtime.py
  • crates/fabric-core/src/runtime.rs
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
**/{README.md,*.md,*.mdx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Update relevant documentation when changes affect public behavior, adapters, examples, or workspace structure.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • docs/sdk/python.mdx
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
**/*.md

📄 CodeRabbit inference engine (.agents/skills/README.md)

Documentation and examples must be updated consistently with changes to public behavior and reviewed for NVIDIA technical-writing style.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
{docs/**,README.md,AGENTS.md}

⚙️ CodeRabbit configuration file

{docs/**,README.md,AGENTS.md}: Review documentation for technical accuracy against the current API, command correctness, and consistency with generated schemas.
For links between files under docs/, require paths relative to the source file with the target file's .mdx extension so they work in both Fern builds and repository browsers. Flag Fern site-root links such as NeMo Fabric overview; use the repository-relative equivalent, such as NeMo Fabric overview.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • docs/sdk/python.mdx
{*.md,**/*.md,**/*.mdx,**/*.ipynb}

⚙️ CodeRabbit configuration file

{*.md,**/*.md,**/*.mdx,**/*.ipynb}: Enforce the product name in user-facing prose: use "NVIDIA NeMo Fabric" on first use and "NeMo Fabric" thereafter. Flag standalone capitalized "Fabric" when it refers to the product. Do not flag the lowercase fabric CLI command, package/import/crate names, code identifiers, API symbols, configuration keys, file paths, or unrelated generic uses of the word.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • docs/sdk/python.mdx
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
**/*.{rs,py,pyi,json,yaml,yml}

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

Determine and update every affected public surface, including the CLI, PyO3 bindings, Python SDK, type stubs, schemas, and adapter contract, so they remain in parity.

Files:

  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • crates/fabric-core/src/error.rs
  • tests/python/test_native_sdk.py
  • crates/fabric-python/src/lib.rs
  • python/src/nemo_fabric/client.py
  • tests/python/test_runtime.py
  • python/src/nemo_fabric/runtime.py
  • crates/fabric-core/src/runtime.rs
**/*.{rs,py}

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

For native binding changes, run cargo check -p fabric-python --locked.

**/*.{rs,py}: When changing the Rust core or public schemas, run both the Rust and Python test suites.
When adding functionality, include tests in the corresponding Rust crate or the relevant area under tests/.

Files:

  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • crates/fabric-core/src/error.rs
  • tests/python/test_native_sdk.py
  • crates/fabric-python/src/lib.rs
  • python/src/nemo_fabric/client.py
  • tests/python/test_runtime.py
  • python/src/nemo_fabric/runtime.py
  • crates/fabric-core/src/runtime.rs
**/*.{py,pyi}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If Python code or a Python-facing adapter changes, run just test-python.

Files:

  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/python/test_native_sdk.py
  • python/src/nemo_fabric/client.py
  • tests/python/test_runtime.py
  • python/src/nemo_fabric/runtime.py
**/*.{rs,py,pyi}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

**/*.{rs,py,pyi}: If public configuration types change, confirm schema snapshot tests in just test-rust pass and review generated schema diffs.
For schema or public contract changes, run both language suites and review changes under schemas/ and generated API references.

Files:

  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • crates/fabric-core/src/error.rs
  • tests/python/test_native_sdk.py
  • crates/fabric-python/src/lib.rs
  • python/src/nemo_fabric/client.py
  • tests/python/test_runtime.py
  • python/src/nemo_fabric/runtime.py
  • crates/fabric-core/src/runtime.rs
**/*.{py,pyi,rs}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

For Python SDK or PyO3 binding changes, use python-tests, run focused pytest tests first, then just test-python; rebuild with just build-python when native code or packaging changes.

Files:

  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • crates/fabric-core/src/error.rs
  • tests/python/test_native_sdk.py
  • crates/fabric-python/src/lib.rs
  • python/src/nemo_fabric/client.py
  • tests/python/test_runtime.py
  • python/src/nemo_fabric/runtime.py
  • crates/fabric-core/src/runtime.rs
tests/**/*.py

📄 CodeRabbit inference engine (.agents/skills/python-tests/SKILL.md)

tests/**/*.py: Use Pytest to run Python tests.
Do not add @pytest.mark.asyncio to tests; async tests are automatically detected and run by the async runner.
Do not add -> None return type annotations to test functions.
When mocking a class, use unittest.mock.MagicMock or unittest.mock.AsyncMock, using the spec argument when necessary, rather than defining a new class.
Prefix mocked class names with mock, not fake.
Prefer pytest fixtures over helper methods.
Do not repeat fixtures; place fixtures needed by multiple test files in conftest.py.
Define fixtures using @pytest.fixture(name="<fixture_name>"[, scope="<scope>"]) and a function named <fixture_name>_fixture; specify scope only when it is not function.
Prefer pytest.mark.parametrize over separate tests for different input types.
Use @pytest.mark.usefixtures when a fixture is needed but its return value is unused or it does not return a value.
Use the autouse restore_environ_fixture from tests/conftest.py to restore environment variables; modify variables with os.environ and do not use monkeypatch.setenv.
Avoid defensive programming in tests; access expected data directly so missing data raises a clear failure, such as using results["data"] instead of results.get("data").

Files:

  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/python/test_native_sdk.py
  • tests/python/test_runtime.py
**/*.{rs,py,toml}

📄 CodeRabbit inference engine (.agents/skills/update-project-version/SKILL.md)

When editing version helpers, verify every nemo-fabric-* workspace package through Cargo metadata and reject a static version in python/pyproject.toml.

Files:

  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • crates/fabric-core/src/error.rs
  • tests/python/test_native_sdk.py
  • crates/fabric-python/src/lib.rs
  • python/src/nemo_fabric/client.py
  • tests/python/test_runtime.py
  • python/src/nemo_fabric/runtime.py
  • crates/fabric-core/src/runtime.rs
**/*.{toml,rs,py}

📄 CodeRabbit inference engine (.agents/skills/update-project-version/SKILL.md)

Avoid blind repository-wide replacement of version-like strings; distinguish package-version references from examples and unrelated dependency versions.

Files:

  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • crates/fabric-core/src/error.rs
  • tests/python/test_native_sdk.py
  • crates/fabric-python/src/lib.rs
  • python/src/nemo_fabric/client.py
  • tests/python/test_runtime.py
  • python/src/nemo_fabric/runtime.py
  • crates/fabric-core/src/runtime.rs
**/*.py

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use type annotations for public Python APIs.

Files:

  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/python/test_native_sdk.py
  • python/src/nemo_fabric/client.py
  • tests/python/test_runtime.py
  • python/src/nemo_fabric/runtime.py
**/*.{py,rs}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.{py,rs}: Keep native Python binding declarations synchronized with their Rust implementations.
Use snake_case for functions and variables; use PascalCase for Rust types and Python classes.

Files:

  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • crates/fabric-core/src/error.rs
  • tests/python/test_native_sdk.py
  • crates/fabric-python/src/lib.rs
  • python/src/nemo_fabric/client.py
  • tests/python/test_runtime.py
  • python/src/nemo_fabric/runtime.py
  • crates/fabric-core/src/runtime.rs
{tests/**,python/tests/**}

⚙️ CodeRabbit configuration file

{tests/**,python/tests/**}: Tests should cover the behavior promised by the changed API surface, including error paths, lifecycle cleanup, and SDK/native parity where relevant.

Files:

  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/python/test_native_sdk.py
  • tests/python/test_runtime.py
**/*.rs

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

Implement new runtime or binding behavior in the shared Rust core first.

**/*.rs: Format Rust code with cargo fmt --all; Rust formatting checks must pass with cargo fmt --all -- --check.
Rust workspace changes must pass cargo check --workspace --locked.

Files:

  • crates/fabric-core/src/error.rs
  • crates/fabric-python/src/lib.rs
  • crates/fabric-core/src/runtime.rs
**/*.{rs,toml}

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

For any Rust change, run just test-rust and cargo fmt --all -- --check.

For Rust core, CLI, or shared runtime semantic changes, run Rust formatting and tests, and add Python tests when behavior is exposed through the SDK.

Files:

  • crates/fabric-core/src/error.rs
  • crates/fabric-python/src/lib.rs
  • crates/fabric-core/src/runtime.rs
crates/fabric-core/**/*.{rs,py}

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

Changes under crates/fabric-core must run both the Rust and Python test suites.

Files:

  • crates/fabric-core/src/error.rs
  • crates/fabric-core/src/runtime.rs
crates/fabric-core/**/*.rs

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

For Rust API reference changes, update Rust documentation comments under crates/fabric-core/ instead of editing generated reference output.

If crates/fabric-core changes in a way exposed through Python, run both the Rust and Python suites.

Files:

  • crates/fabric-core/src/error.rs
  • crates/fabric-core/src/runtime.rs
**/*.{rs,rmeta}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If Rust code changes, run cargo fmt --all -- --check and just test-rust.

Files:

  • crates/fabric-core/src/error.rs
  • crates/fabric-python/src/lib.rs
  • crates/fabric-core/src/runtime.rs
crates/fabric-core/src/**/*.rs

⚙️ CodeRabbit configuration file

crates/fabric-core/src/**/*.rs: Review the Rust core for runtime lifecycle correctness, handle validation, capability routing accuracy, schema stability, and error semantics.
Public API changes should match committed schemas, tests, and documentation.

Files:

  • crates/fabric-core/src/error.rs
  • crates/fabric-core/src/runtime.rs
skills/**

📄 CodeRabbit inference engine (AGENTS.md)

skills/**: Keep consumer skills under skills/ self-contained and dependent only on supported public Python SDK contracts and published documentation; do not add repository-internal contribution guidance.
Keep consumer skills in parity with the public SDK guide, model, and type details when the Python/Rust binding contract changes.

Files:

  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
**/SKILL.md

📄 CodeRabbit inference engine (.agents/skills/README.md)

**/SKILL.md: Maintainer skills must begin with YAML frontmatter containing at least name and description.
Maintainer skills may reference repository internals, build and test commands, and contribution workflows, but external usage guidance must remain in the top-level skills/ directory.

Files:

  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md

⚙️ CodeRabbit configuration file

**/SKILL.md: Do not flag SKILL.md files for missing SPDX headers. Skill entrypoints intentionally start with YAML frontmatter instead.
Verify that every SKILL.md keeps valid YAML frontmatter with at least name and description fields before the Markdown body.

Files:

  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
crates/fabric-python/**/*.{rs,toml}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If the PyO3 bridge or package metadata changes, run just build-python and cargo check -p fabric-python --locked.

Files:

  • crates/fabric-python/src/lib.rs
crates/fabric-python/**/*

⚙️ CodeRabbit configuration file

crates/fabric-python/**/*: Treat native binding changes as public API changes. Check JSON/type conversion, error propagation, GIL/thread behavior, and parity with the Python SDK.

Files:

  • crates/fabric-python/src/lib.rs
**/*.mdx

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

In MDX files, use JSX comment delimiters ({/* and */}) for top-of-file comments, including SPDX headers; do not use HTML comments.

Use {/* ... */} delimiters for top-of-file MDX SPDX comments, not HTML comment delimiters.

Files:

  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • docs/sdk/python.mdx
python/src/nemo_fabric/**

📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)

Ensure the editable maturin build continues to produce the native extension at nemo_fabric._native, with generated artifacts placed where downstream consumers expect.

Files:

  • python/src/nemo_fabric/client.py
  • python/src/nemo_fabric/runtime.py
python/src/nemo_fabric/**/*.py

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

For Python API reference changes, update source docstrings under python/src/nemo_fabric/ instead of editing generated reference output.

Files:

  • python/src/nemo_fabric/client.py
  • python/src/nemo_fabric/runtime.py
python/src/nemo_fabric/**/*

⚙️ CodeRabbit configuration file

python/src/nemo_fabric/**/*: Review Python SDK changes for typed API consistency, import-time dependency neutrality, async/session behavior, and parity with the native extension.
Stubs and runtime implementations should stay aligned.

Files:

  • python/src/nemo_fabric/client.py
  • python/src/nemo_fabric/runtime.py
docs/sdk/python.mdx

📄 CodeRabbit inference engine (AGENTS.md)

Keep docs/sdk/python.mdx current when the public Python API changes.

Files:

  • docs/sdk/python.mdx
🧠 Learnings (2)
📚 Learning: 2026-07-24T16:07:22.255Z
Learnt from: AjayThorve
Repo: NVIDIA/NeMo-Fabric PR: 118
File: docs/reference/api/rust-library-reference/nemo-fabric-core/config/struct-adapterdescriptor.mdx:5-5
Timestamp: 2026-07-24T16:07:22.255Z
Learning: In this repo, files generated under `docs/reference/api/**` are NVIDIA NeMo Fabric API reference output. When reviewing changes to these generated pages, do not treat sidebar `position`/ordering updates as direct manual edits—these can be regenerated by running `just docs` after adding public types. Only flag substantive content changes that are not explained by generation.

Applied to files:

  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
📚 Learning: 2026-06-28T04:03:32.877Z
Learnt from: AjayThorve
Repo: NVIDIA/NeMo-Fabric PR: 26
File: python/tests/smoke_typed_config.py:163-177
Timestamp: 2026-06-28T04:03:32.877Z
Learning: In NVIDIA NeMo Fabric Python SDK serialization of `RuntimeCapabilities` (to satisfy the “parity contract” with Rust core and the CLI), do not emit metadata keys when the corresponding metadata is absent. Instead, omit those fields entirely so the produced JSON matches the Rust/CLI output (e.g., avoid `null`, empty objects, or placeholder metadata). During review, verify the serializer/builders follow this omission rule and that Python outputs/parity tests reflect the same shape.

Applied to files:

  • python/src/nemo_fabric/client.py
  • python/src/nemo_fabric/runtime.py
🪛 ast-grep (0.45.0)
tests/python/test_runtime.py

[info] 94-102: use jsonify instead of json.dumps for JSON output
Context: json.dumps( # type: ignore[attr-defined]
{
"stage": stage,
"code": code,
"message": message,
"retryable": retryable,
"details": details,
}
)
Note: [CWE-116] Improper Encoding or Escaping of Output.

(use-jsonify)


[info] 602-602: use jsonify instead of json.dumps for JSON output
Context: json.dumps(result)
Note: [CWE-116] Improper Encoding or Escaping of Output.

(use-jsonify)

🪛 Ruff (0.16.0)
tests/python/test_runtime.py

[warning] 600-600: Dynamically typed expressions (typing.Any) are disallowed in *args

(ANN401)

🔇 Additional comments (16)
crates/fabric-core/src/error.rs (1)

105-108: LGTM!

crates/fabric-core/src/runtime.rs (3)

464-467: LGTM!


1509-1517: LGTM!

Also applies to: 1522-1538, 1540-1558, 1560-1583, 1612-1619


2507-2516: LGTM! Test coverage for retryable/metadata preservation and cleanup-error recording matches the new runtime behavior.

Also applies to: 2569-2575, 2943-2964, 3020-3027

docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx (1)

12-12: LGTM! Generated content correctly mirrors the new retryable/metadata fields and doc comments in error.rs.

Also applies to: 176-183

docs/reference/api/python-library-reference/nemo_fabric.client.md (1)

134-134: LGTM!

docs/sdk/python.mdx (1)

514-518: LGTM!

Also applies to: 603-613

skills/integrations/consumer/nemo-fabric-integrate/SKILL.md (1)

254-260: LGTM!

Also applies to: 293-293

skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md (1)

46-51: LGTM!

Also applies to: 52-59, 60-69

python/src/nemo_fabric/client.py (1)

27-27: LGTM!

Also applies to: 167-169, 286-286

python/src/nemo_fabric/runtime.py (1)

216-216: LGTM!

Also applies to: 331-331, 470-539

tests/python/test_runtime.py (1)

86-106: LGTM!

Also applies to: 203-226, 308-330, 598-633

tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py (1)

9-9: LGTM!

Also applies to: 42-48

tests/python/test_native_sdk.py (1)

43-62: LGTM! Setting FABRIC_TEST_SHIM_STOP_FAILURE via os.environ without manual cleanup correctly relies on the autouse restore_environ_fixture.

Based on learnings/path instructions: "Use the autouse restore_environ_fixture from tests/conftest.py to restore environment variables; modify variables with os.environ and do not use monkeypatch.setenv."

Source: Path instructions

crates/fabric-python/src/lib.rs (2)

185-217: 🎯 Functional Correctness

No schema/model gap here. retryable and metadata are already represented in crates/fabric-core, python/src/nemo_fabric/types.py, and schemas/error-info.schema.json.

			> Likely an incorrect or invalid review comment.

208-217: 🎯 Functional Correctness

No change needed here. The workspace is on Rust 2024, and pyo3 = 0.28.2 already provides Python::attach, so this code is supported as written.

			> Likely an incorrect or invalid review comment.

Comment thread crates/fabric-core/src/runtime.rs
Comment thread python/src/nemo_fabric/runtime.py
@bbednarski9
bbednarski9 changed the base branch from main to release/0.1 July 28, 2026 19:54
@bbednarski9 bbednarski9 added the bug Something isn't working label Jul 28, 2026
@bbednarski9
bbednarski9 force-pushed the fix/preserve-runtime-result-on-stop-failure branch from 3256974 to 2d6ecbb Compare July 28, 2026 21:33
@bbednarski9
bbednarski9 changed the base branch from release/0.1 to main July 28, 2026 21:33

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
python/src/nemo_fabric/runtime.py (1)

453-461: 🩺 Stability & Availability | 🟡 Minor

Secondary stop failure still silently discarded when invoke already failed.

When invoke_error is not None and stop_runtime also raises, the stop exception is neither re-raised nor recorded (falls straight to stop_events = []). This was already flagged in a previous review round on this same code path.

🤖 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 `@python/src/nemo_fabric/runtime.py` around lines 453 - 461, Update the
stop_runtime exception handling in the finally block so a stop failure is
preserved or reported even when invoke_error is already set; do not silently
replace stop_events with an empty list in that case. Reuse the existing
_preserve_stop_failure behavior and maintain the current re-raise behavior when
no result is available.
🤖 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 `@tests/python/test_runtime.py`:
- Around line 86-105: Convert _structured_native_error into a pytest fixture
factory named structured_native_error, returning the existing error-construction
callable. Update all tests that directly call _structured_native_error to
request and use the fixture instead, preserving its parameters and generated
error metadata.
- Line 600: Update the completed_invoke function’s variadic parameter annotation
from Any to str, matching the three string arguments forwarded to
native.invoke_runtime and satisfying Ruff ANN401.

---

Duplicate comments:
In `@python/src/nemo_fabric/runtime.py`:
- Around line 453-461: Update the stop_runtime exception handling in the finally
block so a stop failure is preserved or reported even when invoke_error is
already set; do not silently replace stop_events with an empty list in that
case. Reuse the existing _preserve_stop_failure behavior and maintain the
current re-raise behavior when no result is available.
🪄 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: ASSERTIVE

Plan: Enterprise

Run ID: f83c0bab-b8ad-495d-8bef-302942d65432

📥 Commits

Reviewing files that changed from the base of the PR and between 3256974 and 2d6ecbb.

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (14)
  • crates/fabric-core/src/error.rs
  • crates/fabric-core/src/runtime.rs
  • crates/fabric-python/src/lib.rs
  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • docs/sdk/python.mdx
  • pyproject.toml
  • python/src/nemo_fabric/client.py
  • python/src/nemo_fabric/runtime.py
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/python/test_native_sdk.py
  • tests/python/test_runtime.py
📜 Review details
🧰 Additional context used
📓 Path-based instructions (50)
**/*.{md,rst}

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

Update documentation and examples in the same branch as the public API change.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
{README.md,docs/**/*.{md,mdx,yml},examples/**/*.{md,mdx,yml}}

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

Keep package names, repository references, and build commands current in documentation and examples.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • docs/sdk/python.mdx
{docs/**/*.{md,mdx,yml},examples/**/*.{md,mdx,yml}}

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

Update relevant getting-started, reference, adapter, and example documentation when the corresponding examples or adapters change.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • docs/sdk/python.mdx
docs/**/*.{md,mdx,yml}

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

Run just docs when the documentation site changes.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • docs/sdk/python.mdx
**/*

📄 CodeRabbit inference engine (.agents/skills/karpathy-guidelines/SKILL.md)

**/*: Before implementing, explicitly state assumptions, surface ambiguity and tradeoffs, present multiple interpretations when relevant, and ask for clarification rather than silently deciding or proceeding when requirements are unclear.
Prefer the minimum code needed to solve the requested problem: avoid speculative features, unnecessary abstractions, unrequested flexibility, and handling of impossible scenarios; simplify overcomplicated solutions.
When editing existing code, make surgical changes only: do not modify unrelated code, comments, formatting, or pre-existing dead code; match the existing style, and remove only unused imports, variables, or functions introduced by your changes.
Define verifiable success criteria for each task, such as writing regression tests for bugs and invalid-input tests for validation, then verify the implementation against those criteria. For multi-step work, state a brief plan with a verification check for each step.

**/*: Always spell NVIDIA in all caps; do not use Nvidia, nvidia, nVidia, nVIDIA, or NV.
Use an NVIDIA before a noun, because the name begins with an “en” sound.
Do not add a registered trademark symbol after NVIDIA when referring to the company; use trademark symbols with product names only when required by the document type or legal guidance.
Verify official capitalization, spacing, hyphenation, and spelling for NVIDIA and third-party product names; do not rewrite official product names for grammar or title-case rules.
Precede NVIDIA product names with NVIDIA on first mention when natural and accurate, and link the first mention when the destination helps the reader.
On first use, include the company name and full model qualifier when it helps identify the model; preserve official capitalization and punctuation, and use shorter family names only after establishing the full name.
For learning-oriented and developer content, do not force trademark symbols unless explicitly required; for press, ...

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • tests/python/test_native_sdk.py
  • crates/fabric-core/src/error.rs
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • crates/fabric-python/src/lib.rs
  • docs/sdk/python.mdx
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • pyproject.toml
  • python/src/nemo_fabric/runtime.py
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
  • python/src/nemo_fabric/client.py
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
  • tests/python/test_runtime.py
  • crates/fabric-core/src/runtime.rs
**/*.{md,mdx,rst}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)

**/*.{md,mdx,rst}: For NeMo Fabric documentation, verify technical claims against the current repository, public API, or documented command before reviewing style.
Always spell NVIDIA in all caps; do not use Nvidia, nvidia, or NV.
Format commands, code elements, expressions, package names, file names, and paths as inline code.
Use descriptive link text; avoid raw URLs and weak anchors such as here or read more.
Use title case consistently for technical documentation headings.
Introduce code blocks, lists, tables, and images with complete sentences.
Write procedures as imperative, parallel steps; split long procedures into smaller tasks.
Prefer active voice, present tense, short sentences, contractions, and plain English while preserving necessary technical precision.
Use can for possibility and reserve may for permission.
Use after for temporal relationships instead of once, and prefer refer to over see when directing readers to another resource.
Avoid culture-specific idioms, unnecessary Latinisms, jokes, and marketing exaggeration in technical documentation.
Spell out months in body text, avoid ordinal dates, and use clear time zones.
Spell out whole numbers from zero through nine unless they are technical values, parameters, versions, or UI values; use numerals for 10 or greater and commas in thousands.
Do not add trademark symbols to learning-oriented documentation unless the source, platform, or legal guidance explicitly requires them.
Do not replace precise technical terms with simpler words when doing so would lose precision.
Do not flag passive voice when the actor is unknown or the action is the important part.
Do not rewrite API names, package names, command flags, or code literals for style.

**/*.{md,mdx,rst}: Use consistent title case for technical-document headings and table headers; avoid quotation marks, ampersands, and exclamation marks in headings, while preserving official product, event, research, and whitepaper title ...

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • docs/sdk/python.mdx
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
**/*.{md,rst,txt,adoc}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-language-mechanics.md)

**/*.{md,rst,txt,adoc}: For technical documentation, use professional, active, conversational, engaging, precise, and plain-English prose. Prefer active voice, present tense, short sentences, and scannable paragraphs. Avoid casual or imprecise language, swearing, threats, insults, jokes, puns, culture-specific idioms, marketing exaggeration, and unsupported third-party comparisons.
Use can for possibility and reserve may for permission; use after for temporal order; use refer to for cross-references; prefer short direct sentences and specific verbs; avoid unnecessary please in technical documentation.
Prefer active voice when the actor matters. Passive voice is acceptable when the actor is unknown or irrelevant, when the action or result is the focus, or in programmer documentation.
Use natural contractions in conversational technical prose, but do not force them in formal legal copy, API references, or generated text.
Prefer simpler English over Latinisms: use for example or such as instead of e.g., and so on instead of etc., that is instead of i.e., compared to instead of vs., and by, through, or using instead of via. Use industry-standard terms such as in silico, in vitro, and in vivo when appropriate, and italicize them in running text.
Use that without commas for essential clauses, and which with commas for nonessential clauses.
Format dates and times clearly: spell out months in body text; use forms such as June 12, 2025; avoid numeric or ordinal dates; capitalize days; use 12-hour time when appropriate; include a space before a.m. or p.m.; use ET and PT for needed time zones; avoid 24/7; and prefer from 12:30 to 1:00 p.m. for prose ranges.
Format numbers consistently: spell out zero through nine in body text, use numerals for 10 or greater and for technical values, use commas in thousands, do not begin a sentence with a numeral, spell out ordinals, and use numerals consistently within a category wh...

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
docs/**/*

📄 CodeRabbit inference engine (AGENTS.md)

Update Fern documentation under docs/ when public behavior, the nemo-fabric package, examples, or supported bindings change.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • docs/sdk/python.mdx
docs/reference/api/**

📄 CodeRabbit inference engine (AGENTS.md)

Regenerate or update generated API references under docs/reference/api/ when the public API changes.

Treat all files under docs/reference/api/ as generated output and do not modify them directly.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
**/*.{md,mdx}

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

**/*.{md,mdx}: Use the full product name NVIDIA NeMo Fabric on its first usage, typically in the title or H1; use NeMo Fabric thereafter.
Use fabric by itself only when referring to the CLI tool, and surround those references with backticks.
Capitalize NVIDIA correctly in public documentation.
Format commands, code elements, expressions, file names, paths, and filenames as inline code where needed.
Use title case consistently for headings in technical documentation.
Introduce code blocks, tables, and lists with complete lead-in sentences.
Use descriptive anchor text instead of raw URLs or generic link text such as here.
Prefer active voice, present tense, short sentences, and plain English.
Use consistent terminology for the same concept throughout a document.
Write procedures as imperative, parallel, easy-to-scan steps, and split long sequences into smaller tasks.
Use after instead of once when expressing temporal sequence.
Use can instead of may when the intended meaning is possibility rather than permission.
Avoid ambiguous numeric dates and ordinal dates in body text.
For learning-oriented documentation, do not force trademark symbols unless the source document explicitly requires them.
Introduce examples' code blocks with full sentences and ensure examples match current APIs and build commands.

For docs site changes, run just docs to regenerate Python and Rust API references and validate the Fern configuration.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • docs/sdk/python.mdx
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
**/*.{rs,py,html,md,mdx,toml,yml,yaml,sh,bash}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

All Rust, Python, HTML, Markdown, MDX, TOML, YAML, and shell source files must include the project SPDX copyright and Apache-2.0 license headers using the comment syntax appropriate to each file type.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • tests/python/test_native_sdk.py
  • crates/fabric-core/src/error.rs
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • crates/fabric-python/src/lib.rs
  • docs/sdk/python.mdx
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • pyproject.toml
  • python/src/nemo_fabric/runtime.py
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
  • python/src/nemo_fabric/client.py
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
  • tests/python/test_runtime.py
  • crates/fabric-core/src/runtime.rs
**/{README.md,*.md,*.mdx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Update relevant documentation when changes affect public behavior, adapters, examples, or workspace structure.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • docs/sdk/python.mdx
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
**/*.md

📄 CodeRabbit inference engine (.agents/skills/README.md)

Documentation and examples must be updated consistently with changes to public behavior and reviewed for NVIDIA technical-writing style.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
{docs/**,README.md,AGENTS.md}

⚙️ CodeRabbit configuration file

{docs/**,README.md,AGENTS.md}: Review documentation for technical accuracy against the current API, command correctness, and consistency with generated schemas.
For links between files under docs/, require paths relative to the source file with the target file's .mdx extension so they work in both Fern builds and repository browsers. Flag Fern site-root links such as NeMo Fabric overview; use the repository-relative equivalent, such as NeMo Fabric overview.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • docs/sdk/python.mdx
{*.md,**/*.md,**/*.mdx,**/*.ipynb}

⚙️ CodeRabbit configuration file

{*.md,**/*.md,**/*.mdx,**/*.ipynb}: Enforce the product name in user-facing prose: use "NVIDIA NeMo Fabric" on first use and "NeMo Fabric" thereafter. Flag standalone capitalized "Fabric" when it refers to the product. Do not flag the lowercase fabric CLI command, package/import/crate names, code identifiers, API symbols, configuration keys, file paths, or unrelated generic uses of the word.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • docs/sdk/python.mdx
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
**/*.{rs,py,pyi,json,yaml,yml}

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

Determine and update every affected public surface, including the CLI, PyO3 bindings, Python SDK, type stubs, schemas, and adapter contract, so they remain in parity.

Files:

  • tests/python/test_native_sdk.py
  • crates/fabric-core/src/error.rs
  • crates/fabric-python/src/lib.rs
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • python/src/nemo_fabric/runtime.py
  • python/src/nemo_fabric/client.py
  • tests/python/test_runtime.py
  • crates/fabric-core/src/runtime.rs
**/*.{rs,py}

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

For native binding changes, run cargo check -p fabric-python --locked.

**/*.{rs,py}: When changing the Rust core or public schemas, run both the Rust and Python test suites.
When adding functionality, include tests in the corresponding Rust crate or the relevant area under tests/.

Files:

  • tests/python/test_native_sdk.py
  • crates/fabric-core/src/error.rs
  • crates/fabric-python/src/lib.rs
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • python/src/nemo_fabric/runtime.py
  • python/src/nemo_fabric/client.py
  • tests/python/test_runtime.py
  • crates/fabric-core/src/runtime.rs
**/*.{py,pyi}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If Python code or a Python-facing adapter changes, run just test-python.

Files:

  • tests/python/test_native_sdk.py
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • python/src/nemo_fabric/runtime.py
  • python/src/nemo_fabric/client.py
  • tests/python/test_runtime.py
**/*.{rs,py,pyi}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

**/*.{rs,py,pyi}: If public configuration types change, confirm schema snapshot tests in just test-rust pass and review generated schema diffs.
For schema or public contract changes, run both language suites and review changes under schemas/ and generated API references.

Files:

  • tests/python/test_native_sdk.py
  • crates/fabric-core/src/error.rs
  • crates/fabric-python/src/lib.rs
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • python/src/nemo_fabric/runtime.py
  • python/src/nemo_fabric/client.py
  • tests/python/test_runtime.py
  • crates/fabric-core/src/runtime.rs
**/*.{py,pyi,rs}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

For Python SDK or PyO3 binding changes, use python-tests, run focused pytest tests first, then just test-python; rebuild with just build-python when native code or packaging changes.

Files:

  • tests/python/test_native_sdk.py
  • crates/fabric-core/src/error.rs
  • crates/fabric-python/src/lib.rs
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • python/src/nemo_fabric/runtime.py
  • python/src/nemo_fabric/client.py
  • tests/python/test_runtime.py
  • crates/fabric-core/src/runtime.rs
tests/**/*.py

📄 CodeRabbit inference engine (.agents/skills/python-tests/SKILL.md)

tests/**/*.py: Use Pytest to run Python tests.
Do not add @pytest.mark.asyncio to tests; async tests are automatically detected and run by the async runner.
Do not add -> None return type annotations to test functions.
When mocking a class, use unittest.mock.MagicMock or unittest.mock.AsyncMock, using the spec argument when necessary, rather than defining a new class.
Prefix mocked class names with mock, not fake.
Prefer pytest fixtures over helper methods.
Do not repeat fixtures; place fixtures needed by multiple test files in conftest.py.
Define fixtures using @pytest.fixture(name="<fixture_name>"[, scope="<scope>"]) and a function named <fixture_name>_fixture; specify scope only when it is not function.
Prefer pytest.mark.parametrize over separate tests for different input types.
Use @pytest.mark.usefixtures when a fixture is needed but its return value is unused or it does not return a value.
Use the autouse restore_environ_fixture from tests/conftest.py to restore environment variables; modify variables with os.environ and do not use monkeypatch.setenv.
Avoid defensive programming in tests; access expected data directly so missing data raises a clear failure, such as using results["data"] instead of results.get("data").

Files:

  • tests/python/test_native_sdk.py
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/python/test_runtime.py
**/*.{rs,py,toml}

📄 CodeRabbit inference engine (.agents/skills/update-project-version/SKILL.md)

When editing version helpers, verify every nemo-fabric-* workspace package through Cargo metadata and reject a static version in python/pyproject.toml.

Files:

  • tests/python/test_native_sdk.py
  • crates/fabric-core/src/error.rs
  • crates/fabric-python/src/lib.rs
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • pyproject.toml
  • python/src/nemo_fabric/runtime.py
  • python/src/nemo_fabric/client.py
  • tests/python/test_runtime.py
  • crates/fabric-core/src/runtime.rs
**/*.{toml,rs,py}

📄 CodeRabbit inference engine (.agents/skills/update-project-version/SKILL.md)

Avoid blind repository-wide replacement of version-like strings; distinguish package-version references from examples and unrelated dependency versions.

Files:

  • tests/python/test_native_sdk.py
  • crates/fabric-core/src/error.rs
  • crates/fabric-python/src/lib.rs
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • pyproject.toml
  • python/src/nemo_fabric/runtime.py
  • python/src/nemo_fabric/client.py
  • tests/python/test_runtime.py
  • crates/fabric-core/src/runtime.rs
**/*.py

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use type annotations for public Python APIs.

Files:

  • tests/python/test_native_sdk.py
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • python/src/nemo_fabric/runtime.py
  • python/src/nemo_fabric/client.py
  • tests/python/test_runtime.py
**/*.{py,rs}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.{py,rs}: Keep native Python binding declarations synchronized with their Rust implementations.
Use snake_case for functions and variables; use PascalCase for Rust types and Python classes.

Files:

  • tests/python/test_native_sdk.py
  • crates/fabric-core/src/error.rs
  • crates/fabric-python/src/lib.rs
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • python/src/nemo_fabric/runtime.py
  • python/src/nemo_fabric/client.py
  • tests/python/test_runtime.py
  • crates/fabric-core/src/runtime.rs
{tests/**,python/tests/**}

⚙️ CodeRabbit configuration file

{tests/**,python/tests/**}: Tests should cover the behavior promised by the changed API surface, including error paths, lifecycle cleanup, and SDK/native parity where relevant.

Files:

  • tests/python/test_native_sdk.py
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/python/test_runtime.py
**/*.rs

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

Implement new runtime or binding behavior in the shared Rust core first.

**/*.rs: Format Rust code with cargo fmt --all; Rust formatting checks must pass with cargo fmt --all -- --check.
Rust workspace changes must pass cargo check --workspace --locked.

Files:

  • crates/fabric-core/src/error.rs
  • crates/fabric-python/src/lib.rs
  • crates/fabric-core/src/runtime.rs
**/*.{rs,toml}

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

For any Rust change, run just test-rust and cargo fmt --all -- --check.

For Rust core, CLI, or shared runtime semantic changes, run Rust formatting and tests, and add Python tests when behavior is exposed through the SDK.

Files:

  • crates/fabric-core/src/error.rs
  • crates/fabric-python/src/lib.rs
  • pyproject.toml
  • crates/fabric-core/src/runtime.rs
crates/fabric-core/**/*.{rs,py}

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

Changes under crates/fabric-core must run both the Rust and Python test suites.

Files:

  • crates/fabric-core/src/error.rs
  • crates/fabric-core/src/runtime.rs
crates/fabric-core/**/*.rs

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

For Rust API reference changes, update Rust documentation comments under crates/fabric-core/ instead of editing generated reference output.

If crates/fabric-core changes in a way exposed through Python, run both the Rust and Python suites.

Files:

  • crates/fabric-core/src/error.rs
  • crates/fabric-core/src/runtime.rs
**/*.{rs,rmeta}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If Rust code changes, run cargo fmt --all -- --check and just test-rust.

Files:

  • crates/fabric-core/src/error.rs
  • crates/fabric-python/src/lib.rs
  • crates/fabric-core/src/runtime.rs
crates/fabric-core/src/**/*.rs

⚙️ CodeRabbit configuration file

crates/fabric-core/src/**/*.rs: Review the Rust core for runtime lifecycle correctness, handle validation, capability routing accuracy, schema stability, and error semantics.
Public API changes should match committed schemas, tests, and documentation.

Files:

  • crates/fabric-core/src/error.rs
  • crates/fabric-core/src/runtime.rs
**/*.mdx

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

In MDX files, use JSX comment delimiters ({/* and */}) for top-of-file comments, including SPDX headers; do not use HTML comments.

Use {/* ... */} delimiters for top-of-file MDX SPDX comments, not HTML comment delimiters.

Files:

  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • docs/sdk/python.mdx
crates/fabric-python/**/*.{rs,toml}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If the PyO3 bridge or package metadata changes, run just build-python and cargo check -p fabric-python --locked.

Files:

  • crates/fabric-python/src/lib.rs
crates/fabric-python/**/*

⚙️ CodeRabbit configuration file

crates/fabric-python/**/*: Treat native binding changes as public API changes. Check JSON/type conversion, error propagation, GIL/thread behavior, and parity with the Python SDK.

Files:

  • crates/fabric-python/src/lib.rs
docs/sdk/python.mdx

📄 CodeRabbit inference engine (AGENTS.md)

Keep docs/sdk/python.mdx current when the public Python API changes.

Files:

  • docs/sdk/python.mdx
{Cargo.toml,python/pyproject.toml,pyproject.toml}

📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)

Keep Rust workspace/package metadata and Python/maturin package metadata internally consistent, including package names, versions, import paths, and module names.

Files:

  • pyproject.toml
{Cargo.toml,Cargo.lock,pyproject.toml,uv.lock,python/pyproject.toml}

📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)

{Cargo.toml,Cargo.lock,pyproject.toml,uv.lock,python/pyproject.toml}: Keep workspace, Python, and lockfile dependency versions aligned where required, and review both direct and transitive dependency changes from resolved lockfiles.
Inspect resolved transitive licenses, explicitly surface UNKNOWN, non-SPDX/custom, proprietary, source-available, copyleft, or network-copyleft terms, and route unresolved licensing questions to dependency approvers with distribution and linkage context.
Document the functional need, alternatives considered, rationale for the selected dependency, and any unresolved licensing question when introducing dependencies.

Files:

  • pyproject.toml
{Cargo.toml,pyproject.toml,python/pyproject.toml}

📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)

Before adding a dependency, prefer the standard library, an existing dependency, or a small local implementation when appropriate; otherwise select a maintained, narrow-fit dependency with clear SPDX metadata and a permissive license where possible.

Files:

  • pyproject.toml
{Cargo.toml,Cargo.lock,pyproject.toml,uv.lock}

📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)

After updating manifests or lockfiles, run uv run --no-project python scripts/licensing/license_diff.py --base-ref origin/main and review added packages and license changes.

Files:

  • pyproject.toml
{pyproject.toml,python/pyproject.toml,Cargo.toml,docs/package.json,.github/workflows/*.yml,justfile}

📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)

Reflect public packaging changes in release-facing documentation and ensure CI references the same package names and commands used by local workflows.

Files:

  • pyproject.toml
**/{Cargo.toml,Cargo.lock,pyproject.toml,package.json}

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

For new or updated dependencies, document the functional need, alternatives considered, and why the selected dependency is the narrowest fit.

Files:

  • pyproject.toml
**/*.{toml,lock}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If a manifest or lockfile changes, run the license-diff script against origin/main, review transitive license changes, and run the attributions-rust and attributions-python pre-commit hooks.

Files:

  • pyproject.toml
**/*.{yml,yaml,toml,lock}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

For CI or packaging changes, use maintain-ci or maintain-packaging, then run recipes and checks whose behavior changed.

Files:

  • pyproject.toml
{pyproject.toml,adapters/**/pyproject.toml}

📄 CodeRabbit inference engine (.agents/skills/update-project-version/SKILL.md)

{pyproject.toml,adapters/**/pyproject.toml}: Update the literal project.version in the root setuptools project and every adapter pyproject.toml.
Keep internal exact-version requirements aligned: root nemo-fabric-* == <version> optional dependencies and each adapter's nemo-fabric-adapters-common == <version> dependency.

Files:

  • pyproject.toml
python/src/nemo_fabric/**

📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)

Ensure the editable maturin build continues to produce the native extension at nemo_fabric._native, with generated artifacts placed where downstream consumers expect.

Files:

  • python/src/nemo_fabric/runtime.py
  • python/src/nemo_fabric/client.py
python/src/nemo_fabric/**/*.py

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

For Python API reference changes, update source docstrings under python/src/nemo_fabric/ instead of editing generated reference output.

Files:

  • python/src/nemo_fabric/runtime.py
  • python/src/nemo_fabric/client.py
python/src/nemo_fabric/**/*

⚙️ CodeRabbit configuration file

python/src/nemo_fabric/**/*: Review Python SDK changes for typed API consistency, import-time dependency neutrality, async/session behavior, and parity with the native extension.
Stubs and runtime implementations should stay aligned.

Files:

  • python/src/nemo_fabric/runtime.py
  • python/src/nemo_fabric/client.py
skills/**

📄 CodeRabbit inference engine (AGENTS.md)

skills/**: Keep consumer skills under skills/ self-contained and dependent only on supported public Python SDK contracts and published documentation; do not add repository-internal contribution guidance.
Keep consumer skills in parity with the public SDK guide, model, and type details when the Python/Rust binding contract changes.

Files:

  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
**/SKILL.md

📄 CodeRabbit inference engine (.agents/skills/README.md)

**/SKILL.md: Maintainer skills must begin with YAML frontmatter containing at least name and description.
Maintainer skills may reference repository internals, build and test commands, and contribution workflows, but external usage guidance must remain in the top-level skills/ directory.

Files:

  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md

⚙️ CodeRabbit configuration file

**/SKILL.md: Do not flag SKILL.md files for missing SPDX headers. Skill entrypoints intentionally start with YAML frontmatter instead.
Verify that every SKILL.md keeps valid YAML frontmatter with at least name and description fields before the Markdown body.

Files:

  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
🧠 Learnings (2)
📚 Learning: 2026-07-24T16:07:22.255Z
Learnt from: AjayThorve
Repo: NVIDIA/NeMo-Fabric PR: 118
File: docs/reference/api/rust-library-reference/nemo-fabric-core/config/struct-adapterdescriptor.mdx:5-5
Timestamp: 2026-07-24T16:07:22.255Z
Learning: In this repo, files generated under `docs/reference/api/**` are NVIDIA NeMo Fabric API reference output. When reviewing changes to these generated pages, do not treat sidebar `position`/ordering updates as direct manual edits—these can be regenerated by running `just docs` after adding public types. Only flag substantive content changes that are not explained by generation.

Applied to files:

  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
📚 Learning: 2026-06-28T04:03:32.877Z
Learnt from: AjayThorve
Repo: NVIDIA/NeMo-Fabric PR: 26
File: python/tests/smoke_typed_config.py:163-177
Timestamp: 2026-06-28T04:03:32.877Z
Learning: In NVIDIA NeMo Fabric Python SDK serialization of `RuntimeCapabilities` (to satisfy the “parity contract” with Rust core and the CLI), do not emit metadata keys when the corresponding metadata is absent. Instead, omit those fields entirely so the produced JSON matches the Rust/CLI output (e.g., avoid `null`, empty objects, or placeholder metadata). During review, verify the serializer/builders follow this omission rule and that Python outputs/parity tests reflect the same shape.

Applied to files:

  • python/src/nemo_fabric/runtime.py
  • python/src/nemo_fabric/client.py
🪛 ast-grep (0.45.0)
tests/python/test_runtime.py

[info] 94-102: use jsonify instead of json.dumps for JSON output
Context: json.dumps( # type: ignore[attr-defined]
{
"stage": stage,
"code": code,
"message": message,
"retryable": retryable,
"details": details,
}
)
Note: [CWE-116] Improper Encoding or Escaping of Output.

(use-jsonify)


[info] 602-602: use jsonify instead of json.dumps for JSON output
Context: json.dumps(result)
Note: [CWE-116] Improper Encoding or Escaping of Output.

(use-jsonify)

🪛 Clippy (1.97.1)
crates/fabric-core/src/runtime.rs

[warning] 573-573: the Err-variant returned from this function is very large

(warning)

🪛 Ruff (0.16.0)
tests/python/test_runtime.py

[warning] 600-600: Dynamically typed expressions (typing.Any) are disallowed in *args

(ANN401)

🔇 Additional comments (17)
crates/fabric-core/src/runtime.rs (2)

1630-1656: Existing metadata-collision finding still applies.


23-24: LGTM!

Also applies to: 245-247, 467-470, 484-495, 511-511, 536-536, 545-545, 562-562, 573-592, 670-670, 682-682, 919-934, 977-986, 1385-1386, 1409-1410, 1554-1628, 2552-2561, 2600-2600, 2615-2621, 2646-2649, 2683-2698, 2858-2902, 3047-3068, 3124-3131

crates/fabric-core/src/error.rs (1)

67-84: LGTM!

Also applies to: 123-126

docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx (1)

5-12: LGTM!

Also applies to: 36-36, 116-150, 212-218, 386-418

docs/sdk/python.mdx (1)

578-582: LGTM!

Also applies to: 680-690

skills/integrations/consumer/nemo-fabric-integrate/SKILL.md (1)

284-290: LGTM!

Also applies to: 323-323

skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md (1)

46-69: LGTM!

pyproject.toml (1)

12-12: LGTM!

Also applies to: 28-28, 41-62, 72-72

crates/fabric-python/src/lib.rs (2)

14-14: 🎯 Functional Correctness

Confirm doctor_config's plan-resolution switch is in scope for this PR.

doctor_config now calls resolve_diagnostic_plan_from_config_with_adapter_directories (mode false) instead of resolve_run_plan_from_config_with_adapter_directories. This changes doctor()'s resolution behavior but isn't mentioned in the PR objectives or this file's stated cohort (lifecycle error propagation & cleanup preservation). Please confirm this is intentional and not accidental scope creep from elsewhere in the PR stack.

Also applies to: 61-78


185-219: LGTM!

python/src/nemo_fabric/client.py (1)

27-27: LGTM!

Also applies to: 167-169, 283-293

python/src/nemo_fabric/runtime.py (2)

216-216: LGTM!

Also applies to: 331-331


465-541: LGTM!

tests/python/test_runtime.py (1)

203-226: LGTM!

Also applies to: 308-330, 594-634

tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py (1)

9-9: LGTM!

Also applies to: 42-48

tests/python/test_native_sdk.py (1)

43-63: LGTM!

docs/reference/api/python-library-reference/nemo_fabric.client.md (1)

134-134: LGTM!

Comment thread tests/python/test_runtime.py
Comment thread tests/python/test_runtime.py Outdated
Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
@bbednarski9
bbednarski9 force-pushed the fix/preserve-runtime-result-on-stop-failure branch from 2d6ecbb to 24bfad6 Compare July 29, 2026 21:11
Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
@bbednarski9

Copy link
Copy Markdown
Contributor Author

Review follow-up for the CodeRabbit outside-diff finding: addressed in 4ae519f. Adapter metadata is no longer serialized into the human-readable diagnostics string because it is already preserved structurally on ErrorInfo.metadata. The explicit stop-failure regression verifies the display text no longer contains the redundant adapter metadata: payload; the Rust core suite passes (38 tests).

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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 `@crates/fabric-core/src/runtime.rs`:
- Around line 1620-1656: Update the non-AdapterLifecycleOperation fallback in
runtime_error_info to derive ErrorInfo.code from the provided ErrorStage instead
of always using "runtime_stop_failed". Preserve the existing stop code for
ErrorStage::Stop and return the corresponding stage-specific codes for other
stages such as Start and Invoke.

In `@tests/python/test_runtime.py`:
- Around line 571-572: Combine the nested context managers around the
FabricRuntimeError assertion in the affected test, keeping caplog.at_level and
pytest.raises in a single with statement while preserving the existing DEBUG
logger configuration and error-match behavior.
🪄 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: ASSERTIVE

Plan: Enterprise

Run ID: c7bc19a2-f583-4448-a801-a0b692e58501

📥 Commits

Reviewing files that changed from the base of the PR and between 2d6ecbb and a28362e.

📒 Files selected for processing (13)
  • crates/fabric-core/src/error.rs
  • crates/fabric-core/src/runtime.rs
  • crates/fabric-python/src/lib.rs
  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • docs/sdk/python.mdx
  • python/src/nemo_fabric/client.py
  • python/src/nemo_fabric/runtime.py
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/python/test_native_sdk.py
  • tests/python/test_runtime.py
📜 Review details
🧰 Additional context used
📓 Path-based instructions (41)
**/*.{md,rst}

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

Update documentation and examples in the same branch as the public API change.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
{README.md,docs/**/*.{md,mdx,yml},examples/**/*.{md,mdx,yml}}

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

Keep package names, repository references, and build commands current in documentation and examples.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • docs/sdk/python.mdx
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
{docs/**/*.{md,mdx,yml},examples/**/*.{md,mdx,yml}}

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

Update relevant getting-started, reference, adapter, and example documentation when the corresponding examples or adapters change.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • docs/sdk/python.mdx
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
docs/**/*.{md,mdx,yml}

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

Run just docs when the documentation site changes.

Update user-facing Fern documentation, including docs/index.yml, when public behavior, the package, examples, or supported bindings change.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • docs/sdk/python.mdx
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
**/*

📄 CodeRabbit inference engine (.agents/skills/karpathy-guidelines/SKILL.md)

**/*: Before implementing, explicitly state assumptions, surface ambiguity and tradeoffs, present multiple interpretations when relevant, and ask for clarification rather than silently deciding or proceeding when requirements are unclear.
Prefer the minimum code needed to solve the requested problem: avoid speculative features, unnecessary abstractions, unrequested flexibility, and handling of impossible scenarios; simplify overcomplicated solutions.
When editing existing code, make surgical changes only: do not modify unrelated code, comments, formatting, or pre-existing dead code; match the existing style, and remove only unused imports, variables, or functions introduced by your changes.
Define verifiable success criteria for each task, such as writing regression tests for bugs and invalid-input tests for validation, then verify the implementation against those criteria. For multi-step work, state a brief plan with a verification check for each step.

**/*: Always spell NVIDIA in all caps; do not use Nvidia, nvidia, nVidia, nVIDIA, or NV.
Use an NVIDIA before a noun, because the name begins with an “en” sound.
Do not add a registered trademark symbol after NVIDIA when referring to the company; use trademark symbols with product names only when required by the document type or legal guidance.
Verify official capitalization, spacing, hyphenation, and spelling for NVIDIA and third-party product names; do not rewrite official product names for grammar or title-case rules.
Precede NVIDIA product names with NVIDIA on first mention when natural and accurate, and link the first mention when the destination helps the reader.
On first use, include the company name and full model qualifier when it helps identify the model; preserve official capitalization and punctuation, and use shorter family names only after establishing the full name.
For learning-oriented and developer content, do not force trademark symbols unless explicitly required; for press, ...

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
  • docs/sdk/python.mdx
  • python/src/nemo_fabric/client.py
  • tests/python/test_native_sdk.py
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • crates/fabric-python/src/lib.rs
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/python/test_runtime.py
  • crates/fabric-core/src/error.rs
  • python/src/nemo_fabric/runtime.py
  • crates/fabric-core/src/runtime.rs
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
**/*.{md,mdx,rst}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)

**/*.{md,mdx,rst}: For NeMo Fabric documentation, verify technical claims against the current repository, public API, or documented command before reviewing style.
Always spell NVIDIA in all caps; do not use Nvidia, nvidia, or NV.
Format commands, code elements, expressions, package names, file names, and paths as inline code.
Use descriptive link text; avoid raw URLs and weak anchors such as here or read more.
Use title case consistently for technical documentation headings.
Introduce code blocks, lists, tables, and images with complete sentences.
Write procedures as imperative, parallel steps; split long procedures into smaller tasks.
Prefer active voice, present tense, short sentences, contractions, and plain English while preserving necessary technical precision.
Use can for possibility and reserve may for permission.
Use after for temporal relationships instead of once, and prefer refer to over see when directing readers to another resource.
Avoid culture-specific idioms, unnecessary Latinisms, jokes, and marketing exaggeration in technical documentation.
Spell out months in body text, avoid ordinal dates, and use clear time zones.
Spell out whole numbers from zero through nine unless they are technical values, parameters, versions, or UI values; use numerals for 10 or greater and commas in thousands.
Do not add trademark symbols to learning-oriented documentation unless the source, platform, or legal guidance explicitly requires them.
Do not replace precise technical terms with simpler words when doing so would lose precision.
Do not flag passive voice when the actor is unknown or the action is the important part.
Do not rewrite API names, package names, command flags, or code literals for style.

**/*.{md,mdx,rst}: Use consistent title case for technical-document headings and table headers; avoid quotation marks, ampersands, and exclamation marks in headings, while preserving official product, event, research, and whitepaper title ...

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
  • docs/sdk/python.mdx
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
**/*.{md,rst,txt,adoc}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-language-mechanics.md)

**/*.{md,rst,txt,adoc}: For technical documentation, use professional, active, conversational, engaging, precise, and plain-English prose. Prefer active voice, present tense, short sentences, and scannable paragraphs. Avoid casual or imprecise language, swearing, threats, insults, jokes, puns, culture-specific idioms, marketing exaggeration, and unsupported third-party comparisons.
Use can for possibility and reserve may for permission; use after for temporal order; use refer to for cross-references; prefer short direct sentences and specific verbs; avoid unnecessary please in technical documentation.
Prefer active voice when the actor matters. Passive voice is acceptable when the actor is unknown or irrelevant, when the action or result is the focus, or in programmer documentation.
Use natural contractions in conversational technical prose, but do not force them in formal legal copy, API references, or generated text.
Prefer simpler English over Latinisms: use for example or such as instead of e.g., and so on instead of etc., that is instead of i.e., compared to instead of vs., and by, through, or using instead of via. Use industry-standard terms such as in silico, in vitro, and in vivo when appropriate, and italicize them in running text.
Use that without commas for essential clauses, and which with commas for nonessential clauses.
Format dates and times clearly: spell out months in body text; use forms such as June 12, 2025; avoid numeric or ordinal dates; capitalize days; use 12-hour time when appropriate; include a space before a.m. or p.m.; use ET and PT for needed time zones; avoid 24/7; and prefer from 12:30 to 1:00 p.m. for prose ranges.
Format numbers consistently: spell out zero through nine in body text, use numerals for 10 or greater and for technical values, use commas in thousands, do not begin a sentence with a numeral, spell out ordinals, and use numerals consistently within a category wh...

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
docs/reference/api/**/*

📄 CodeRabbit inference engine (AGENTS.md)

Regenerate or update generated API references when the public API changes.

Treat all files under docs/reference/api/ as generated output and do not modify them directly.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
**/*.{md,mdx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

When public behavior, adapters, examples, or workspace structure changes, update the corresponding documentation, including relevant README files and SDK or API references.

**/*.{md,mdx}: Use the full product name NVIDIA NeMo Fabric on first use, typically in the title and H1; use NeMo Fabric thereafter. Use fabric alone only for the CLI tool and surround it with backticks.
Treat incorrect or stale commands, package names, paths, APIs, support claims, procedures, examples, terminology, or public behavior documentation as blocking issues.
Capitalize NVIDIA correctly and format code, commands, paths, and filenames as inline code where needed.
Use title case for technical-documentation headings.
Introduce code blocks, tables, and lists with complete lead-in sentences; ensure examples match current APIs and build commands.
Use descriptive anchor text, avoid raw URLs and generic labels such as here, and use repository-relative .mdx paths for links within docs/.
Prefer active voice, present tense, short sentences, plain English, consistent terminology, and imperative, parallel, scannable procedures.
Use after instead of once when expressing temporal sequence, and use can rather than may when describing possibility rather than permission.
Avoid ambiguous numeric dates and ordinal dates in body text.
For learning-oriented documentation, do not force trademark symbols unless the source document explicitly requires them.
When reporting documentation-review findings, lead with Must fix, Should fix, and Nice to have categories; include file path, line reference, current problem, rationale, and a concrete rewrite or direction.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
  • docs/sdk/python.mdx
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
**/*.{rs,py,html,md,mdx,toml,yaml,yml,sh,bash}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

All source files must include the specified SPDX copyright and Apache-2.0 license headers using the comment syntax appropriate to the file type.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
  • docs/sdk/python.mdx
  • python/src/nemo_fabric/client.py
  • tests/python/test_native_sdk.py
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • crates/fabric-python/src/lib.rs
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/python/test_runtime.py
  • crates/fabric-core/src/error.rs
  • python/src/nemo_fabric/runtime.py
  • crates/fabric-core/src/runtime.rs
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
**/*.{md,mdx,yml,py,rs,sh}

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

Keep documentation aligned with current NeMo Fabric behavior, repository layout, entry points, commands, package names, APIs, bindings, and support claims.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
  • docs/sdk/python.mdx
  • python/src/nemo_fabric/client.py
  • tests/python/test_native_sdk.py
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • crates/fabric-python/src/lib.rs
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/python/test_runtime.py
  • crates/fabric-core/src/error.rs
  • python/src/nemo_fabric/runtime.py
  • crates/fabric-core/src/runtime.rs
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
{docs/**,README.md,AGENTS.md}

⚙️ CodeRabbit configuration file

{docs/**,README.md,AGENTS.md}: Review documentation for technical accuracy against the current API, command correctness, and consistency with generated schemas.
For links between files under docs/, require paths relative to the source file with the target file's .mdx extension so they work in both Fern builds and repository browsers. Flag Fern site-root links such as NeMo Fabric overview; use the repository-relative equivalent, such as NeMo Fabric overview.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • docs/sdk/python.mdx
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
{*.md,**/*.md,**/*.mdx,**/*.ipynb}

⚙️ CodeRabbit configuration file

{*.md,**/*.md,**/*.mdx,**/*.ipynb}: Enforce the product name in user-facing prose: use "NVIDIA NeMo Fabric" on first use and "NeMo Fabric" thereafter. Flag standalone capitalized "Fabric" when it refers to the product. Do not flag the lowercase fabric CLI command, package/import/crate names, code identifiers, API symbols, configuration keys, file paths, or unrelated generic uses of the word.

Files:

  • docs/reference/api/python-library-reference/nemo_fabric.client.md
  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
  • docs/sdk/python.mdx
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
skills/**/*.md

📄 CodeRabbit inference engine (AGENTS.md)

skills/**/*.md: Consumer skills must depend only on supported public Python SDK contracts and published documentation, and should link to public GitHub documentation and example URLs rather than a docs-site domain so they remain portable when exported.
Keep consumer skills in parity with the SDK guide, model, and type details when the public API changes.

Files:

  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
skills/integrations/consumer/nemo-fabric-integrate/**

📄 CodeRabbit inference engine (AGENTS.md)

The supported consumer integration surface is skills/integrations/consumer/nemo-fabric-integrate, which provides typed Python SDK integration guidance.

Files:

  • skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md
  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
**/*.mdx

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

In MDX files, use JSX comment delimiters ({/* and */}) for top-of-file comments, including SPDX headers; do not use HTML comments.

Files:

  • docs/sdk/python.mdx
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
docs/sdk/python.mdx

📄 CodeRabbit inference engine (AGENTS.md)

Keep the Python/Rust binding contract current when the public API changes.

Files:

  • docs/sdk/python.mdx
docs/**/*.mdx

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

docs/**/*.mdx: Use source-relative links with the target .mdx extension for links between files under docs/; do not use Fern site-root paths.
Use {/* ... */} delimiters for top-of-file MDX SPDX comments, not HTML comment delimiters.

Files:

  • docs/sdk/python.mdx
  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
**/*.{rs,py,pyi,json,yaml,yml}

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

Determine and update every affected public surface, including the CLI, PyO3 bindings, Python SDK, type stubs, schemas, and adapter contract, so they remain in parity.

Files:

  • python/src/nemo_fabric/client.py
  • tests/python/test_native_sdk.py
  • crates/fabric-python/src/lib.rs
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/python/test_runtime.py
  • crates/fabric-core/src/error.rs
  • python/src/nemo_fabric/runtime.py
  • crates/fabric-core/src/runtime.rs
python/src/nemo_fabric/**

📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)

Ensure the editable maturin build continues to produce the native extension at nemo_fabric._native, with generated artifacts placed where downstream consumers expect.

Files:

  • python/src/nemo_fabric/client.py
  • python/src/nemo_fabric/runtime.py
**/*.{rs,py}

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

For native binding changes, run cargo check -p fabric-python --locked.

**/*.{rs,py}: Use snake_case for functions and variables; use PascalCase for Rust types and Python classes.
Run the relevant Rust and Python test suites for every affected language surface; changes to the Rust core or public schemas require both suites.

Files:

  • python/src/nemo_fabric/client.py
  • tests/python/test_native_sdk.py
  • crates/fabric-python/src/lib.rs
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/python/test_runtime.py
  • crates/fabric-core/src/error.rs
  • python/src/nemo_fabric/runtime.py
  • crates/fabric-core/src/runtime.rs
**/*.{py,pyi}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If Python code or a Python-facing adapter changes, run just test-python.

Files:

  • python/src/nemo_fabric/client.py
  • tests/python/test_native_sdk.py
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/python/test_runtime.py
  • python/src/nemo_fabric/runtime.py
**/*.{rs,py,pyi}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

**/*.{rs,py,pyi}: If public configuration types change, confirm schema snapshot tests in just test-rust pass and review generated schema diffs.
For schema or public contract changes, run both language suites and review changes under schemas/ and generated API references.

Files:

  • python/src/nemo_fabric/client.py
  • tests/python/test_native_sdk.py
  • crates/fabric-python/src/lib.rs
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/python/test_runtime.py
  • crates/fabric-core/src/error.rs
  • python/src/nemo_fabric/runtime.py
  • crates/fabric-core/src/runtime.rs
**/*.{py,pyi,rs}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

For Python SDK or PyO3 binding changes, use python-tests, run focused pytest tests first, then just test-python; rebuild with just build-python when native code or packaging changes.

Files:

  • python/src/nemo_fabric/client.py
  • tests/python/test_native_sdk.py
  • crates/fabric-python/src/lib.rs
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/python/test_runtime.py
  • crates/fabric-core/src/error.rs
  • python/src/nemo_fabric/runtime.py
  • crates/fabric-core/src/runtime.rs
**/*.{rs,py,toml}

📄 CodeRabbit inference engine (.agents/skills/update-project-version/SKILL.md)

When editing version helpers, verify every nemo-fabric-* workspace package through Cargo metadata and reject a static version in python/pyproject.toml.

Files:

  • python/src/nemo_fabric/client.py
  • tests/python/test_native_sdk.py
  • crates/fabric-python/src/lib.rs
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/python/test_runtime.py
  • crates/fabric-core/src/error.rs
  • python/src/nemo_fabric/runtime.py
  • crates/fabric-core/src/runtime.rs
**/*.{toml,rs,py}

📄 CodeRabbit inference engine (.agents/skills/update-project-version/SKILL.md)

Avoid blind repository-wide replacement of version-like strings; distinguish package-version references from examples and unrelated dependency versions.

Files:

  • python/src/nemo_fabric/client.py
  • tests/python/test_native_sdk.py
  • crates/fabric-python/src/lib.rs
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/python/test_runtime.py
  • crates/fabric-core/src/error.rs
  • python/src/nemo_fabric/runtime.py
  • crates/fabric-core/src/runtime.rs
**/*.py

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use type annotations for public Python APIs and keep native binding declarations synchronized with their Rust implementations.

Files:

  • python/src/nemo_fabric/client.py
  • tests/python/test_native_sdk.py
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/python/test_runtime.py
  • python/src/nemo_fabric/runtime.py
**/*.{rs,py,json}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

When adding functionality, include tests in the corresponding Rust crate or relevant tests/ area; public contract changes must keep checked-in JSON Schema snapshots and native Python binding declarations synchronized.

Files:

  • python/src/nemo_fabric/client.py
  • tests/python/test_native_sdk.py
  • crates/fabric-python/src/lib.rs
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/python/test_runtime.py
  • crates/fabric-core/src/error.rs
  • python/src/nemo_fabric/runtime.py
  • crates/fabric-core/src/runtime.rs
python/src/nemo_fabric/**/*.py

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

For Python API reference changes, update source docstrings under python/src/nemo_fabric/ instead of generated API reference files.

Files:

  • python/src/nemo_fabric/client.py
  • python/src/nemo_fabric/runtime.py
python/src/nemo_fabric/**/*

⚙️ CodeRabbit configuration file

python/src/nemo_fabric/**/*: Review Python SDK changes for typed API consistency, import-time dependency neutrality, async/session behavior, and parity with the native extension.
Stubs and runtime implementations should stay aligned.

Files:

  • python/src/nemo_fabric/client.py
  • python/src/nemo_fabric/runtime.py
tests/**/*.py

📄 CodeRabbit inference engine (.agents/skills/python-tests/SKILL.md)

tests/**/*.py: Use Pytest to run Python tests.
Do not add @pytest.mark.asyncio to tests; async tests are automatically detected and run by the async runner.
Do not add -> None return type annotations to test functions.
When mocking a class, use unittest.mock.MagicMock or unittest.mock.AsyncMock, using the spec argument when necessary, rather than defining a new class.
Prefix mocked class names with mock, not fake.
Prefer pytest fixtures over helper methods.
Do not repeat fixtures; place fixtures needed by multiple test files in conftest.py.
Define fixtures using @pytest.fixture(name="<fixture_name>"[, scope="<scope>"]) and a function named <fixture_name>_fixture; specify scope only when it is not function.
Prefer pytest.mark.parametrize over separate tests for different input types.
Use @pytest.mark.usefixtures when a fixture is needed but its return value is unused or it does not return a value.
Use the autouse restore_environ_fixture from tests/conftest.py to restore environment variables; modify variables with os.environ and do not use monkeypatch.setenv.
Avoid defensive programming in tests; access expected data directly so missing data raises a clear failure, such as using results["data"] instead of results.get("data").

Files:

  • tests/python/test_native_sdk.py
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/python/test_runtime.py
{tests/**,python/tests/**}

⚙️ CodeRabbit configuration file

{tests/**,python/tests/**}: Tests should cover the behavior promised by the changed API surface, including error paths, lifecycle cleanup, and SDK/native parity where relevant.

Files:

  • tests/python/test_native_sdk.py
  • tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py
  • tests/python/test_runtime.py
**/*.rs

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

Implement new runtime or binding behavior in the shared Rust core first.

**/*.rs: Format Rust code with cargo fmt --all and ensure cargo fmt --all -- --check passes.
Run cargo check --workspace --locked when changing the Rust core, CLI, or native Python extension.

Files:

  • crates/fabric-python/src/lib.rs
  • crates/fabric-core/src/error.rs
  • crates/fabric-core/src/runtime.rs
**/*.{rs,toml}

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

For any Rust change, run just test-rust and cargo fmt --all -- --check.

For Rust core, CLI, or shared runtime semantic changes, run Rust formatting and tests, and add Python tests when behavior is exposed through the SDK.

Files:

  • crates/fabric-python/src/lib.rs
  • crates/fabric-core/src/error.rs
  • crates/fabric-core/src/runtime.rs
**/*.{rs,rmeta}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If Rust code changes, run cargo fmt --all -- --check and just test-rust.

Files:

  • crates/fabric-python/src/lib.rs
  • crates/fabric-core/src/error.rs
  • crates/fabric-core/src/runtime.rs
crates/fabric-python/**/*.{rs,toml}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If the PyO3 bridge or package metadata changes, run just build-python and cargo check -p fabric-python --locked.

Files:

  • crates/fabric-python/src/lib.rs
crates/fabric-python/**/*

⚙️ CodeRabbit configuration file

crates/fabric-python/**/*: Treat native binding changes as public API changes. Check JSON/type conversion, error propagation, GIL/thread behavior, and parity with the Python SDK.

Files:

  • crates/fabric-python/src/lib.rs
crates/fabric-core/**/*.{rs,py}

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

Changes under crates/fabric-core must run both the Rust and Python test suites.

Files:

  • crates/fabric-core/src/error.rs
  • crates/fabric-core/src/runtime.rs
crates/fabric-core/**/*.rs

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If crates/fabric-core changes in a way exposed through Python, run both the Rust and Python suites.

For Rust API reference changes, update Rust documentation comments under crates/fabric-core/ instead of generated API reference files.

Files:

  • crates/fabric-core/src/error.rs
  • crates/fabric-core/src/runtime.rs
crates/fabric-core/src/**/*.rs

⚙️ CodeRabbit configuration file

crates/fabric-core/src/**/*.rs: Review the Rust core for runtime lifecycle correctness, handle validation, capability routing accuracy, schema stability, and error semantics.
Public API changes should match committed schemas, tests, and documentation.

Files:

  • crates/fabric-core/src/error.rs
  • crates/fabric-core/src/runtime.rs
**/SKILL.md

📄 CodeRabbit inference engine (.agents/skills/README.md)

Each maintainer skill file must begin with YAML frontmatter containing at least name and description.

Files:

  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md

⚙️ CodeRabbit configuration file

**/SKILL.md: Do not flag SKILL.md files for missing SPDX headers. Skill entrypoints intentionally start with YAML frontmatter instead.
Verify that every SKILL.md keeps valid YAML frontmatter with at least name and description fields before the Markdown body.

Files:

  • skills/integrations/consumer/nemo-fabric-integrate/SKILL.md
🧠 Learnings (2)
📚 Learning: 2026-06-28T04:03:32.877Z
Learnt from: AjayThorve
Repo: NVIDIA/NeMo-Fabric PR: 26
File: python/tests/smoke_typed_config.py:163-177
Timestamp: 2026-06-28T04:03:32.877Z
Learning: In NVIDIA NeMo Fabric Python SDK serialization of `RuntimeCapabilities` (to satisfy the “parity contract” with Rust core and the CLI), do not emit metadata keys when the corresponding metadata is absent. Instead, omit those fields entirely so the produced JSON matches the Rust/CLI output (e.g., avoid `null`, empty objects, or placeholder metadata). During review, verify the serializer/builders follow this omission rule and that Python outputs/parity tests reflect the same shape.

Applied to files:

  • python/src/nemo_fabric/client.py
  • python/src/nemo_fabric/runtime.py
📚 Learning: 2026-07-24T16:07:22.255Z
Learnt from: AjayThorve
Repo: NVIDIA/NeMo-Fabric PR: 118
File: docs/reference/api/rust-library-reference/nemo-fabric-core/config/struct-adapterdescriptor.mdx:5-5
Timestamp: 2026-07-24T16:07:22.255Z
Learning: In this repo, files generated under `docs/reference/api/**` are NVIDIA NeMo Fabric API reference output. When reviewing changes to these generated pages, do not treat sidebar `position`/ordering updates as direct manual edits—these can be regenerated by running `just docs` after adding public types. Only flag substantive content changes that are not explained by generation.

Applied to files:

  • docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx
🪛 ast-grep (0.45.0)
tests/python/test_runtime.py

[info] 94-102: use jsonify instead of json.dumps for JSON output
Context: json.dumps( # type: ignore[attr-defined]
{
"stage": stage,
"code": code,
"message": message,
"retryable": retryable,
"details": details,
}
)
Note: [CWE-116] Improper Encoding or Escaping of Output.

(use-jsonify)


[info] 607-607: use jsonify instead of json.dumps for JSON output
Context: json.dumps(result)
Note: [CWE-116] Improper Encoding or Escaping of Output.

(use-jsonify)

🪛 Ruff (0.16.0)
tests/python/test_runtime.py

[warning] 571-572: Use a single with statement with multiple contexts instead of nested with statements

(SIM117)

🔇 Additional comments (14)
crates/fabric-core/src/error.rs (1)

104-110: LGTM!

Also applies to: 130-133

crates/fabric-core/src/runtime.rs (1)

458-472: LGTM!

Also applies to: 1544-1551, 1563-1593, 1595-1618, 2543-2552, 2606-2612, 2799-2825, 3065-3086, 3142-3150

crates/fabric-python/src/lib.rs (1)

186-218: LGTM!

docs/reference/api/rust-library-reference/nemo-fabric-core/error/enum-fabricerror.mdx (1)

12-12: LGTM!

Also applies to: 190-196, 219-226

docs/sdk/python.mdx (1)

578-582: LGTM!

Also applies to: 680-691

skills/integrations/consumer/nemo-fabric-integrate/SKILL.md (1)

302-308: LGTM!

Also applies to: 341-341

skills/integrations/consumer/nemo-fabric-integrate/references/results-and-errors.md (1)

46-59: LGTM!

Also applies to: 60-69

python/src/nemo_fabric/client.py (1)

27-27: LGTM!

Also applies to: 167-169, 286-286

python/src/nemo_fabric/runtime.py (2)

10-10: LGTM!

Also applies to: 29-30, 219-219, 334-334, 459-469


520-547: 🎯 Functional Correctness

No change needed here. Stop failures only promote status/error when invoke succeeded; otherwise they stay in metadata.cleanup_errors, matching the Rust contract.

			> Likely an incorrect or invalid review comment.
tests/fixtures/hermes-shim-agent/adapters/hermes-shim/src/nemo_fabric_test_adapters/hermes_shim/adapter.py (1)

9-9: LGTM!

Also applies to: 42-48

tests/python/test_runtime.py (1)

86-106: LGTM!

Also applies to: 203-226, 308-330, 563-576, 603-638

tests/python/test_native_sdk.py (1)

43-63: LGTM!

docs/reference/api/python-library-reference/nemo_fabric.client.md (1)

134-134: LGTM!

Comment on lines +1620 to 1656
fn runtime_error_info(error: &FabricError, stage: ErrorStage) -> ErrorInfo {
match error {
FabricError::AdapterLifecycleOperation {
runtime_id,
code,
message,
diagnostics,
retryable,
metadata,
..
} => {
let mut metadata = metadata.clone();
metadata
.entry("runtime_id".to_string())
.or_insert_with(|| Value::String(runtime_id.clone()));
if !diagnostics.is_empty() {
metadata
.entry("diagnostics".to_string())
.or_insert_with(|| Value::String(diagnostics.clone()));
}
ErrorInfo {
stage,
code: code.clone(),
message: message.clone(),
retryable: *retryable,
metadata,
}
}
_ => ErrorInfo {
stage,
code: "runtime_stop_failed".to_string(),
message: error.to_string(),
retryable: false,
metadata: BTreeMap::new(),
},
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Stage-agnostic fallback hardcodes a stop-specific error code.

runtime_error_info accepts a generic stage: ErrorStage, but the non-AdapterLifecycleOperation fallback arm always returns code: "runtime_stop_failed" regardless of stage. It happens to be correct today because the only call site passes ErrorStage::Stop, but the generic signature invites a future caller to pass Start/Invoke and get a mislabeled ErrorInfo.code.

♻️ Suggested fix: derive the fallback code from `stage`
         _ => ErrorInfo {
             stage,
-            code: "runtime_stop_failed".to_string(),
+            code: match stage {
+                ErrorStage::Start => "runtime_start_failed".to_string(),
+                ErrorStage::Invoke => "runtime_invoke_failed".to_string(),
+                ErrorStage::Stop => "runtime_stop_failed".to_string(),
+            },
             message: error.to_string(),
             retryable: false,
             metadata: BTreeMap::new(),
         },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
fn runtime_error_info(error: &FabricError, stage: ErrorStage) -> ErrorInfo {
match error {
FabricError::AdapterLifecycleOperation {
runtime_id,
code,
message,
diagnostics,
retryable,
metadata,
..
} => {
let mut metadata = metadata.clone();
metadata
.entry("runtime_id".to_string())
.or_insert_with(|| Value::String(runtime_id.clone()));
if !diagnostics.is_empty() {
metadata
.entry("diagnostics".to_string())
.or_insert_with(|| Value::String(diagnostics.clone()));
}
ErrorInfo {
stage,
code: code.clone(),
message: message.clone(),
retryable: *retryable,
metadata,
}
}
_ => ErrorInfo {
stage,
code: "runtime_stop_failed".to_string(),
message: error.to_string(),
retryable: false,
metadata: BTreeMap::new(),
},
}
}
fn runtime_error_info(error: &FabricError, stage: ErrorStage) -> ErrorInfo {
match error {
FabricError::AdapterLifecycleOperation {
runtime_id,
code,
message,
diagnostics,
retryable,
metadata,
..
} => {
let mut metadata = metadata.clone();
metadata
.entry("runtime_id".to_string())
.or_insert_with(|| Value::String(runtime_id.clone()));
if !diagnostics.is_empty() {
metadata
.entry("diagnostics".to_string())
.or_insert_with(|| Value::String(diagnostics.clone()));
}
ErrorInfo {
stage,
code: code.clone(),
message: message.clone(),
retryable: *retryable,
metadata,
}
}
_ => ErrorInfo {
stage,
code: match stage {
ErrorStage::Start => "runtime_start_failed".to_string(),
ErrorStage::Invoke => "runtime_invoke_failed".to_string(),
ErrorStage::Stop => "runtime_stop_failed".to_string(),
},
message: error.to_string(),
retryable: false,
metadata: BTreeMap::new(),
},
}
}
🤖 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 `@crates/fabric-core/src/runtime.rs` around lines 1620 - 1656, Update the
non-AdapterLifecycleOperation fallback in runtime_error_info to derive
ErrorInfo.code from the provided ErrorStage instead of always using
"runtime_stop_failed". Preserve the existing stop code for ErrorStage::Stop and
return the corresponding stage-specific codes for other stages such as Start and
Invoke.

Comment on lines +571 to +572
with caplog.at_level("DEBUG", logger="nemo_fabric.runtime"):
with pytest.raises(FabricRuntimeError, match="invoke failed"):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Combine nested with statements (Ruff SIM117).

♻️ Suggested fix
-    with caplog.at_level("DEBUG", logger="nemo_fabric.runtime"):
-        with pytest.raises(FabricRuntimeError, match="invoke failed"):
-            await native_client.run(_config(), input="hello")
+    with (
+        caplog.at_level("DEBUG", logger="nemo_fabric.runtime"),
+        pytest.raises(FabricRuntimeError, match="invoke failed"),
+    ):
+        await native_client.run(_config(), input="hello")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
with caplog.at_level("DEBUG", logger="nemo_fabric.runtime"):
with pytest.raises(FabricRuntimeError, match="invoke failed"):
with (
caplog.at_level("DEBUG", logger="nemo_fabric.runtime"),
pytest.raises(FabricRuntimeError, match="invoke failed"),
):
await native_client.run(_config(), input="hello")
🧰 Tools
🪛 Ruff (0.16.0)

[warning] 571-572: Use a single with statement with multiple contexts instead of nested with statements

(SIM117)

🤖 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/python/test_runtime.py` around lines 571 - 572, Combine the nested
context managers around the FabricRuntimeError assertion in the affected test,
keeping caplog.at_level and pytest.raises in a single with statement while
preserving the existing DEBUG logger configuration and error-match behavior.

Source: Linters/SAST tools

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant