feat: add dependency-free adapter contract dataclasses - #190
feat: add dependency-free adapter contract dataclasses#190AnuradhaKaruppiah wants to merge 3 commits into
Conversation
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
WalkthroughThe adapter contract now uses dependency-free dataclasses with shared validation and serialization codecs. Pydantic support is optional. Lifecycle hosts now pass configuration through ChangesContract and lifecycle migration
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Host
participant serve
participant _dispatch
participant _handle_start
participant AgentConfig_from_mapping
Host->>serve: config_loader=AgentConfig.from_mapping
serve->>_dispatch: lifecycle request and config_loader
_dispatch->>_handle_start: raw start configuration and loader
_handle_start->>AgentConfig_from_mapping: load configuration mapping
AgentConfig_from_mapping-->>_handle_start: validated AgentConfig
_handle_start-->>serve: lifecycle payload with loaded configuration
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Fern docs preview: https://nvidia-preview-pull-request-190.docs.buildwithfern.com/nemo/fabric |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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 `@adapter-contract/pypi.md`:
- Line 39: Rewrite the lead-in before the optional Pydantic interoperability
installation command as a complete standalone sentence, removing the trailing
“with:” construction. Match the complete-sentence pattern already used in the
nearby documentation and preserve the existing command block.
In `@adapter-contract/src/nemo_fabric_adapter_contract/codec.py`:
- Around line 159-160: Update the metadata handling in the codec function
containing the field check so fields marked with JSON metadata use
json_mapping(value, path=path) instead of json_value, enforcing the declared
dict/object container while preserving existing handling for other fields.
Remove the # pragma: no cover annotation from the guard at line 82 now that it
is reachable, and add regression coverage confirming non-object settings and
extensions values are rejected.
- Around line 123-135: Update validate_dataclass to cache
get_type_hints(type(instance)) results keyed by the dataclass class, reusing the
cached mapping for subsequent validations while preserving the existing field
decoding and normalization behavior.
In `@tests/adapter_contract/test_agent_execution.py`:
- Around line 137-148: Extend
test_agent_execution_dataclasses_track_rust_schema_block_fields to compare
requiredness as well as field names: collect dataclass fields whose default is
dataclasses.MISSING and assert their names match the schema required list.
Import MISSING from dataclasses and use it to identify fields without defaults,
preserving the existing property-name parity assertion.
🪄 Autofix
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: 5c275e8b-e9f5-41e0-b55e-eff34af8a947
⛔ Files ignored due to path filters (2)
adapter-contract/uv.lockis excluded by!**/*.lockuv.lockis excluded by!**/*.lock
📒 Files selected for processing (18)
adapter-contract/pypi.mdadapter-contract/pyproject.tomladapter-contract/src/nemo_fabric_adapter_contract/codec.pyadapter-contract/src/nemo_fabric_adapter_contract/models.pyadapter-contract/src/nemo_fabric_adapter_contract/pydantic_support.pyadapters/common/README.mdadapters/common/src/nemo_fabric_adapters/common/lifecycle.pydocs/adapter-contract/execution.mddocs/adapter-contract/normalized-configuration.mdexternal/nat/README.mdexternal/nat/src/nemo_fabric_adapters/nat/adapter.pyskills/nemo-fabric-build-adapter/SKILL.mdtests/adapter_contract/test_agent_config.pytests/adapter_contract/test_agent_execution.pytests/adapter_contract/test_dependency_boundary.pytests/adapters/test_adapter_package_metadata.pytests/adapters/test_adapters_common_lifecycle.pytests/adapters/test_external_nat_adapter.py
📜 Review details
⏰ Context from checks skipped due to timeout. (16)
- GitHub Check: Preview docs
- GitHub Check: Test (Python 3.11, windows-amd64)
- GitHub Check: Test (Python 3.13, macos-arm64)
- GitHub Check: Test (Python 3.14, macos-arm64)
- GitHub Check: Test (Python 3.12, linux-arm64)
- GitHub Check: Test (Python 3.12, linux-amd64)
- GitHub Check: Test (Python 3.12, windows-amd64)
- GitHub Check: Test (Python 3.13, linux-amd64)
- GitHub Check: Test (Python 3.11, macos-arm64)
- GitHub Check: Test (Python 3.14, windows-amd64)
- GitHub Check: Test (Python 3.11, linux-arm64)
- GitHub Check: Test (Python 3.11, linux-amd64)
- GitHub Check: Test (Python 3.12, macos-arm64)
- GitHub Check: Test (Python 3.13, windows-amd64)
- GitHub Check: Test (Python 3.13, linux-arm64)
- GitHub Check: Pre-commit
🧰 Additional context used
📓 Path-based instructions (38)
**/*
📄 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 spellNVIDIAin all caps; do not useNvidia,nvidia,nVidia,nVIDIA, orNV.
Usean NVIDIAbefore a noun, because the name begins with an “en” sound.
Do not add a registered trademark symbol afterNVIDIAwhen 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 withNVIDIAon 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:
adapter-contract/pyproject.tomlexternal/nat/src/nemo_fabric_adapters/nat/adapter.pyexternal/nat/README.mddocs/adapter-contract/normalized-configuration.mdadapters/common/README.mdskills/nemo-fabric-build-adapter/SKILL.mdtests/adapter_contract/test_dependency_boundary.pydocs/adapter-contract/execution.mdadapter-contract/pypi.mdtests/adapters/test_adapter_package_metadata.pytests/adapter_contract/test_agent_execution.pyadapter-contract/src/nemo_fabric_adapter_contract/pydantic_support.pytests/adapters/test_external_nat_adapter.pytests/adapter_contract/test_agent_config.pyadapter-contract/src/nemo_fabric_adapter_contract/codec.pyadapters/common/src/nemo_fabric_adapters/common/lifecycle.pyadapter-contract/src/nemo_fabric_adapter_contract/models.pytests/adapters/test_adapters_common_lifecycle.py
**/*.{rs,toml}
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
For any Rust change, run
just test-rustandcargo 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.
Use Rust stable tooling; format Rust code with
cargo fmt --all, verify formatting withcargo fmt --all -- --check, and compile withcargo check --workspace --locked.
Files:
adapter-contract/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:
adapter-contract/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 theattributions-rustandattributions-pythonpre-commit hooks.
Files:
adapter-contract/pyproject.toml
**/*.{yml,yaml,toml,lock}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
For CI or packaging changes, use
maintain-ciormaintain-packaging, then run recipes and checks whose behavior changed.
Files:
adapter-contract/pyproject.toml
**/*.{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 inpython/pyproject.toml.
Files:
adapter-contract/pyproject.tomlexternal/nat/src/nemo_fabric_adapters/nat/adapter.pytests/adapter_contract/test_dependency_boundary.pytests/adapters/test_adapter_package_metadata.pytests/adapter_contract/test_agent_execution.pyadapter-contract/src/nemo_fabric_adapter_contract/pydantic_support.pytests/adapters/test_external_nat_adapter.pytests/adapter_contract/test_agent_config.pyadapter-contract/src/nemo_fabric_adapter_contract/codec.pyadapters/common/src/nemo_fabric_adapters/common/lifecycle.pyadapter-contract/src/nemo_fabric_adapter_contract/models.pytests/adapters/test_adapters_common_lifecycle.py
**/*.{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:
adapter-contract/pyproject.tomlexternal/nat/src/nemo_fabric_adapters/nat/adapter.pytests/adapter_contract/test_dependency_boundary.pytests/adapters/test_adapter_package_metadata.pytests/adapter_contract/test_agent_execution.pyadapter-contract/src/nemo_fabric_adapter_contract/pydantic_support.pytests/adapters/test_external_nat_adapter.pytests/adapter_contract/test_agent_config.pyadapter-contract/src/nemo_fabric_adapter_contract/codec.pyadapters/common/src/nemo_fabric_adapters/common/lifecycle.pyadapter-contract/src/nemo_fabric_adapter_contract/models.pytests/adapters/test_adapters_common_lifecycle.py
**/*.{toml,yaml,yml,sh,bash}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
TOML, YAML, and shell files must use the specified
#SPDX copyright and Apache-2.0 license headers.
Files:
adapter-contract/pyproject.toml
**/{Cargo.toml,pyproject.toml}
📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)
**/{Cargo.toml,pyproject.toml}: Keep package names, dependency declarations, import paths, module names, and workspace or Python package metadata internally consistent.
Prefer the standard library, an existing dependency, or a small local implementation before adding a new direct dependency.
When multiple dependencies satisfy the requirement, prefer a maintained OSS option with clear SPDX metadata, a smaller transitive graph, and permissive licensing such as Apache-2.0, MIT, BSD, or ISC.
Files:
adapter-contract/pyproject.toml
**/{Cargo.toml,pyproject.toml,Cargo.lock,uv.lock}
📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)
**/{Cargo.toml,pyproject.toml,Cargo.lock,uv.lock}: For new dependencies, record the functional need, viable alternatives considered, why the selected dependency is the narrowest fit, and any unresolved licensing question.
After updating manifests or lockfiles, runuv run --no-project python scripts/licensing/license_diff.py --base-ref origin/mainand review added packages and license changes.
Keep workspace, Python package, and lockfile versions aligned wherever the packaging contract requires alignment.
Files:
adapter-contract/pyproject.toml
**/*.{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:
external/nat/src/nemo_fabric_adapters/nat/adapter.pytests/adapter_contract/test_dependency_boundary.pytests/adapters/test_adapter_package_metadata.pytests/adapter_contract/test_agent_execution.pyadapter-contract/src/nemo_fabric_adapter_contract/pydantic_support.pytests/adapters/test_external_nat_adapter.pytests/adapter_contract/test_agent_config.pyadapter-contract/src/nemo_fabric_adapter_contract/codec.pyadapters/common/src/nemo_fabric_adapters/common/lifecycle.pyadapter-contract/src/nemo_fabric_adapter_contract/models.pytests/adapters/test_adapters_common_lifecycle.py
**/*.{rs,py}
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
For native binding changes, run
cargo check -p fabric-python --locked.Use
snake_casefor functions and variables; usePascalCasefor Rust types and Python classes.
Files:
external/nat/src/nemo_fabric_adapters/nat/adapter.pytests/adapter_contract/test_dependency_boundary.pytests/adapters/test_adapter_package_metadata.pytests/adapter_contract/test_agent_execution.pyadapter-contract/src/nemo_fabric_adapter_contract/pydantic_support.pytests/adapters/test_external_nat_adapter.pytests/adapter_contract/test_agent_config.pyadapter-contract/src/nemo_fabric_adapter_contract/codec.pyadapters/common/src/nemo_fabric_adapters/common/lifecycle.pyadapter-contract/src/nemo_fabric_adapter_contract/models.pytests/adapters/test_adapters_common_lifecycle.py
**/*.{py,pyi}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If Python code or a Python-facing adapter changes, run
just test-python.In Python SDK, adapters, examples, and tests, follow the existing style, use type annotations for public APIs, and keep native binding declarations synchronized with their Rust implementations.
Files:
external/nat/src/nemo_fabric_adapters/nat/adapter.pytests/adapter_contract/test_dependency_boundary.pytests/adapters/test_adapter_package_metadata.pytests/adapter_contract/test_agent_execution.pyadapter-contract/src/nemo_fabric_adapter_contract/pydantic_support.pytests/adapters/test_external_nat_adapter.pytests/adapter_contract/test_agent_config.pyadapter-contract/src/nemo_fabric_adapter_contract/codec.pyadapters/common/src/nemo_fabric_adapters/common/lifecycle.pyadapter-contract/src/nemo_fabric_adapter_contract/models.pytests/adapters/test_adapters_common_lifecycle.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 injust test-rustpass and review generated schema diffs.
For schema or public contract changes, run both language suites and review changes underschemas/and generated API references.
Files:
external/nat/src/nemo_fabric_adapters/nat/adapter.pytests/adapter_contract/test_dependency_boundary.pytests/adapters/test_adapter_package_metadata.pytests/adapter_contract/test_agent_execution.pyadapter-contract/src/nemo_fabric_adapter_contract/pydantic_support.pytests/adapters/test_external_nat_adapter.pytests/adapter_contract/test_agent_config.pyadapter-contract/src/nemo_fabric_adapter_contract/codec.pyadapters/common/src/nemo_fabric_adapters/common/lifecycle.pyadapter-contract/src/nemo_fabric_adapter_contract/models.pytests/adapters/test_adapters_common_lifecycle.py
**/*.{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, thenjust test-python; rebuild withjust build-pythonwhen native code or packaging changes.Public contract changes must keep native Python binding declarations synchronized with their Rust implementations.
Files:
external/nat/src/nemo_fabric_adapters/nat/adapter.pytests/adapter_contract/test_dependency_boundary.pytests/adapters/test_adapter_package_metadata.pytests/adapter_contract/test_agent_execution.pyadapter-contract/src/nemo_fabric_adapter_contract/pydantic_support.pytests/adapters/test_external_nat_adapter.pytests/adapter_contract/test_agent_config.pyadapter-contract/src/nemo_fabric_adapter_contract/codec.pyadapters/common/src/nemo_fabric_adapters/common/lifecycle.pyadapter-contract/src/nemo_fabric_adapter_contract/models.pytests/adapters/test_adapters_common_lifecycle.py
**/*.{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:
external/nat/src/nemo_fabric_adapters/nat/adapter.pyexternal/nat/README.mddocs/adapter-contract/normalized-configuration.mdadapters/common/README.mdskills/nemo-fabric-build-adapter/SKILL.mdtests/adapter_contract/test_dependency_boundary.pydocs/adapter-contract/execution.mdadapter-contract/pypi.mdtests/adapters/test_adapter_package_metadata.pytests/adapter_contract/test_agent_execution.pyadapter-contract/src/nemo_fabric_adapter_contract/pydantic_support.pytests/adapters/test_external_nat_adapter.pytests/adapter_contract/test_agent_config.pyadapter-contract/src/nemo_fabric_adapter_contract/codec.pyadapters/common/src/nemo_fabric_adapters/common/lifecycle.pyadapter-contract/src/nemo_fabric_adapter_contract/models.pytests/adapters/test_adapters_common_lifecycle.py
**/*.{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:
external/nat/README.mddocs/adapter-contract/normalized-configuration.mdadapters/common/README.mdskills/nemo-fabric-build-adapter/SKILL.mddocs/adapter-contract/execution.mdadapter-contract/pypi.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 spellNVIDIAin all caps; do not useNvidia,nvidia, orNV.
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 ashereorread 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.
Usecanfor possibility and reservemayfor permission.
Useafterfor temporal relationships instead ofonce, and preferrefer tooverseewhen 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:
external/nat/README.mddocs/adapter-contract/normalized-configuration.mdadapters/common/README.mdskills/nemo-fabric-build-adapter/SKILL.mddocs/adapter-contract/execution.mdadapter-contract/pypi.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.
Usecanfor possibility and reservemayfor permission; useafterfor temporal order; userefer tofor cross-references; prefer short direct sentences and specific verbs; avoid unnecessarypleasein 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: usefor exampleorsuch asinstead ofe.g.,and so oninstead ofetc.,that isinstead ofi.e.,compared toinstead ofvs., andby,through, orusinginstead ofvia. Use industry-standard terms such as in silico, in vitro, and in vivo when appropriate, and italicize them in running text.
Usethatwithout commas for essential clauses, andwhichwith commas for nonessential clauses.
Format dates and times clearly: spell out months in body text; use forms such asJune 12, 2025; avoid numeric or ordinal dates; capitalize days; use 12-hour time when appropriate; include a space beforea.m.orp.m.; useETandPTfor needed time zones; avoid24/7; and preferfrom 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:
external/nat/README.mddocs/adapter-contract/normalized-configuration.mdadapters/common/README.mdskills/nemo-fabric-build-adapter/SKILL.mddocs/adapter-contract/execution.mdadapter-contract/pypi.md
**/*.{md,mdx}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)
**/*.{md,mdx}: Use the full product nameNVIDIA NeMo Fabricon first use, typically in the title and H1; useNeMo Fabricthereafter. Usefabricalone 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.
CapitalizeNVIDIAcorrectly 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 ashere, and use repository-relative.mdxpaths for links withindocs/.
Prefer active voice, present tense, short sentences, plain English, consistent terminology, and imperative, parallel, scannable procedures.
Useafterinstead ofoncewhen expressing temporal sequence, and usecanrather thanmaywhen 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 withMust fix,Should fix, andNice to havecategories; include file path, line reference, current problem, rationale, and a concrete rewrite or direction.
Files:
external/nat/README.mddocs/adapter-contract/normalized-configuration.mdadapters/common/README.mdskills/nemo-fabric-build-adapter/SKILL.mddocs/adapter-contract/execution.mdadapter-contract/pypi.md
**/*.md
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Update relevant SDK, API reference, adapter, example, integration, and support documentation when the corresponding public surface changes.
Files:
external/nat/README.mddocs/adapter-contract/normalized-configuration.mdadapters/common/README.mdskills/nemo-fabric-build-adapter/SKILL.mddocs/adapter-contract/execution.mdadapter-contract/pypi.md
**/*.{html,md}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
HTML and Markdown files must use the specified SPDX HTML-comment header.
Files:
external/nat/README.mddocs/adapter-contract/normalized-configuration.mdadapters/common/README.mdskills/nemo-fabric-build-adapter/SKILL.mddocs/adapter-contract/execution.mdadapter-contract/pypi.md
{*.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 lowercasefabricCLI command, package/import/crate names, code identifiers, API symbols, configuration keys, file paths, or unrelated generic uses of the word.
Files:
external/nat/README.mddocs/adapter-contract/normalized-configuration.mdadapters/common/README.mdskills/nemo-fabric-build-adapter/SKILL.mddocs/adapter-contract/execution.mdadapter-contract/pypi.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/adapter-contract/normalized-configuration.mddocs/adapter-contract/execution.md
{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/adapter-contract/normalized-configuration.mddocs/adapter-contract/execution.md
docs/**/*.{md,mdx,yml}
📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)
Run
just docswhen the documentation site changes.
Files:
docs/adapter-contract/normalized-configuration.mddocs/adapter-contract/execution.md
docs/**
📄 CodeRabbit inference engine (AGENTS.md)
Run just docs after changing the documentation site.
Files:
docs/adapter-contract/normalized-configuration.mddocs/adapter-contract/execution.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/adapter-contract/normalized-configuration.mddocs/adapter-contract/execution.md
adapters/*/{README.md,fabric-adapter.json}
📄 CodeRabbit inference engine (.agents/skills/contribute-adapter/SKILL.md)
Document installation, supported configuration, harness-only settings, credentials, lifecycle, telemetry, artifacts, limitations, and focused test commands; keep documentation consistent with descriptor claims.
Files:
adapters/common/README.md
adapters/*/README.md
📄 CodeRabbit inference engine (.agents/skills/contribute-adapter/SKILL.md)
Provide a credential-free fixture covering
plan,doctor, andrun, plus a canonical typed SDK example and, when required, a canonical harness-native YAML fixture.
Files:
adapters/common/README.md
{adapters/**,examples/**}
⚙️ CodeRabbit configuration file
{adapters/**,examples/**}: Review adapter and example changes for command correctness, config/schema consistency, artifact handling, and compatibility with the public NeMo Fabric contracts.
Files:
adapters/common/README.mdadapters/common/src/nemo_fabric_adapters/common/lifecycle.py
**/SKILL.md
📄 CodeRabbit inference engine (.agents/skills/README.md)
Each maintainer skill file must begin with YAML frontmatter containing at least
nameanddescription.
Files:
skills/nemo-fabric-build-adapter/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/nemo-fabric-build-adapter/SKILL.md
skills/**
📄 CodeRabbit inference engine (AGENTS.md)
skills/**: Keep consumer skills self-contained and dependent only on supported public Python SDK contracts and published documentation; do not include repository internals.
Do not add repository-internal contribution guidance to consumer skills.
Consumer skills must link to public GitHub documentation and example URLs rather than a docs-site domain so they remain portable when exported.
Files:
skills/nemo-fabric-build-adapter/SKILL.md
tests/**/*.{rs,py}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
When adding functionality, include tests in the corresponding Rust crate or the relevant area under
tests/.
Files:
tests/adapter_contract/test_dependency_boundary.pytests/adapters/test_adapter_package_metadata.pytests/adapter_contract/test_agent_execution.pytests/adapters/test_external_nat_adapter.pytests/adapter_contract/test_agent_config.pytests/adapters/test_adapters_common_lifecycle.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.asyncioto tests; async tests are automatically detected by the async runner.
Do not add-> Nonereturn type annotations to test functions.
When mocking a class, useunittest.mock.MagicMockorAsyncMock, using thespecargument when necessary, rather than defining a new class.
Prefix mocked class names withmock, notfake.
Prefer pytest fixtures over helper methods.
If a fixture is needed in multiple test files, define it once inconftest.pyrather than repeating it.
Define fixtures using@pytest.fixture(name="<fixture_name>"[, scope="<scope>"])and a<fixture_name>_fixturefunction; specifyscopeonly when it is notfunction.
Preferpytest.mark.parametrizeover separate tests for different input types.
Use@pytest.mark.usefixtureswhen a fixture is needed but its returned value is unused or it returns no value.
Avoid defensive programming in tests; access expected values directly so missing data raises a clear failure, such as usingresults["data"]instead ofresults.get("data").
When adapter installation metadata changes, packaging metadata tests must directly assert that the root project depends unconditionally on the exact-versionnemo-fabric-runtimedistribution.
Packaging metadata tests must verify that each root harness extra delegates to the matching version of the leaf adapter'sharnessextra.
Packaging metadata tests must verify that bare leaf dependencies remain adapter-owned and that the rootadapter-testsdependency group installs each leaf through itsharnessextra.
Packaging metadata tests must verify that every leaf providesfull; only adapters importing NeMo Relay Python APIs providerelay, while adapters using an external Relay executable havefullequal toharness.
Files:
tests/adapter_contract/test_dependency_boundary.pytests/adapters/test_adapter_package_metadata.pytests/adapter_contract/test_agent_execution.pytests/adapters/test_external_nat_adapter.pytests/adapter_contract/test_agent_config.pytests/adapters/test_adapters_common_lifecycle.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/adapter_contract/test_dependency_boundary.pytests/adapters/test_adapter_package_metadata.pytests/adapter_contract/test_agent_execution.pytests/adapters/test_external_nat_adapter.pytests/adapter_contract/test_agent_config.pytests/adapters/test_adapters_common_lifecycle.py
tests/adapters/**/*.py
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
tests/adapters/**/*.py: If an adapter or integration changes, run its focused tests.
For adapter behavior changes, run focused adapter tests undertests/adapters, then runjust test-python.
Files:
tests/adapters/test_adapter_package_metadata.pytests/adapters/test_external_nat_adapter.pytests/adapters/test_adapters_common_lifecycle.py
adapters/*/src/**/*.py
📄 CodeRabbit inference engine (.agents/skills/contribute-adapter/SKILL.md)
adapters/*/src/**/*.py: Implement adapters using the existing Fabricpythonorprocessrunner and normalized request/result contracts; do not add a runner or one-off abstraction for a single adapter.
Treat normalizedconfig, Fabric-resolved plans, andruntime_contextas authoritative; reserveharness.settingsfor adapter-wide behavior and apply precedence in the order: normalized config, plans/context, harness settings, descriptor/default values.
Reject conflicting duplicate declarations and unsupported behavior with actionable errors naming the field and supported alternatives; never silently drop configuration.
Validate dependency versions, hooks, and credentials before harness invocation, and never expose credential values in outputs, errors, events, logs, or fixtures.
Forward only required system, selected credential, telemetry, and documented harness-specific environment variables; never forward or log unrelated environment values.
Maintain one local adapter host per Fabric runtime across orderedstart→invoke*→stopoperations. Emit one JSON lifecycle response per request on stdout and diagnostics on stderr.
Return harness-level invocation failures as successful lifecycle responses containingresponse: null,failed: true, and structurederrorfields (code,message,retryable, and optionalmetadata).
Do not emit NeMo Relay stream records on adapter stdout; return exactly one terminal lifecycle response while streaming occurs through the SDK-owned out-of-band endpoint.
Scope workspace, generated configuration, state, sessions, and artifacts to the resolved runtime context, and isolate stateful adapter instances by Fabric runtime ID.
Usestartto initialize adapter-owned harness state, retain it for continuation across repeatedinvokecalls on the same runtime, and release it instop.
Files:
adapters/common/src/nemo_fabric_adapters/common/lifecycle.py
🧠 Learnings (2)
📚 Learning: 2026-08-07T07:15:59.993Z
Learnt from: AnuradhaKaruppiah
Repo: NVIDIA/NeMo-Fabric PR: 186
File: docs/adapter-contract/registration-and-discovery.md:103-104
Timestamp: 2026-08-07T07:15:59.993Z
Learning: Keep documentation files under docs/adapter-contract/ in portable Markdown (.md), not MDX. GitHub and the public authoring skill consume these files directly, and the NVIDIA NeMo Fabric documentation pipeline accepts them without conversion; do not flag the lack of MDX conversion for these files.
Applied to files:
docs/adapter-contract/normalized-configuration.mddocs/adapter-contract/execution.md
📚 Learning: 2026-08-07T16:20:01.603Z
Learnt from: AnuradhaKaruppiah
Repo: NVIDIA/NeMo-Fabric PR: 186
File: docs/adapter-contract/README.md:1-4
Timestamp: 2026-08-07T16:20:01.603Z
Learning: For maintained Markdown files under docs/adapter-contract/, Fern parses content as MDX. Write SPDX license headers as JSX comments (`{/* ... */}`), not HTML comments, because HTML comments cause Fern parsing failures. This JSX form is accepted by the repository copyright checker and validated by Docs Preview.
Applied to files:
docs/adapter-contract/normalized-configuration.mddocs/adapter-contract/execution.md
🪛 ast-grep (0.45.0)
tests/adapter_contract/test_dependency_boundary.py
[error] 43-43: Command coming from incoming request
Context: subprocess.run([sys.executable, "-c", script], check=True, env=env)
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
(subprocess-from-request)
🪛 Ruff (0.16.1)
tests/adapter_contract/test_dependency_boundary.py
[error] 44-44: subprocess call: check for execution of untrusted input
(S603)
adapter-contract/src/nemo_fabric_adapter_contract/pydantic_support.py
[warning] 40-40: Avoid specifying long messages outside the exception class
(TRY003)
adapter-contract/src/nemo_fabric_adapter_contract/codec.py
[warning] 42-42: Remove quotes from type annotation
Remove quotes
(UP037)
[warning] 48-48: Dynamically typed expressions (typing.Any) are disallowed in value
(ANN401)
[warning] 57-57: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 68-70: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 73-73: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 83-83: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 87-87: Dynamically typed expressions (typing.Any) are disallowed in value
(ANN401)
[warning] 93-93: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 95-95: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 100-103: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 112-115: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 123-123: Dynamically typed expressions (typing.Any) are disallowed in instance
(ANN401)
[warning] 138-138: Dynamically typed expressions (typing.Any) are disallowed in instance
(ANN401)
[warning] 152-152: Too many return statements (17 > 6)
(PLR0911)
[warning] 152-152: Too many branches (32 > 12)
(PLR0912)
[warning] 152-152: Too many statements (57 > 50)
(PLR0915)
[warning] 153-153: Dynamically typed expressions (typing.Any) are disallowed in annotation
(ANN401)
[warning] 154-154: Dynamically typed expressions (typing.Any) are disallowed in value
(ANN401)
[warning] 158-158: Dynamically typed expressions (typing.Any) are disallowed in _decode_value
(ANN401)
[warning] 177-179: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 186-186: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 191-191: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 199-199: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 215-215: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 223-226: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 231-231: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 235-235: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 239-239: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 243-243: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 246-246: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 250-250: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 254-254: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 257-257: Dynamically typed expressions (typing.Any) are disallowed in value
(ANN401)
[warning] 257-257: Dynamically typed expressions (typing.Any) are disallowed in _encode_value
(ANN401)
adapter-contract/src/nemo_fabric_adapter_contract/models.py
[warning] 27-27: Missing return type annotation for private function _optional
(ANN202)
[warning] 27-27: Dynamically typed expressions (typing.Any) are disallowed in default
(ANN401)
[warning] 31-31: Missing return type annotation for private function _empty_dict
(ANN202)
[warning] 35-35: Missing return type annotation for private function _json_dict
(ANN202)
[warning] 39-39: Missing return type annotation for private function _empty_list
(ANN202)
[warning] 43-43: Missing return type annotation for private function _json_value_field
(ANN202)
[warning] 43-43: Dynamically typed expressions (typing.Any) are disallowed in default
(ANN401)
[warning] 54-54: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 59-62: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 84-84: Dynamically typed expressions (typing.Any) are disallowed in value
(ANN401)
[warning] 99-99: Do not perform function call _json_dict in dataclass defaults
(RUF009)
[warning] 105-105: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 117-117: Do not perform function call _json_dict in dataclass defaults
(RUF009)
[warning] 129-129: Do not perform function call _json_dict in dataclass defaults
(RUF009)
[warning] 137-140: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 163-163: Do not perform function call _optional in dataclass defaults
(RUF009)
[warning] 174-177: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 184-184: Do not perform function call _empty_list in dataclass defaults
(RUF009)
[warning] 189-192: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 201-201: Do not perform function call _empty_list in dataclass defaults
(RUF009)
[warning] 202-202: Do not perform function call _empty_dict in dataclass defaults
(RUF009)
[warning] 203-203: Do not perform function call _optional in dataclass defaults
(RUF009)
[warning] 204-204: Do not perform function call _empty_list in dataclass defaults
(RUF009)
[warning] 215-217: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 224-224: Do not perform function call _empty_dict in dataclass defaults
(RUF009)
[warning] 233-233: Do not perform function call _json_dict in dataclass defaults
(RUF009)
[warning] 244-244: Do not perform function call _empty_dict in dataclass defaults
(RUF009)
[warning] 245-245: Do not perform function call _optional in dataclass defaults
(RUF009)
[warning] 246-246: Do not perform function call _empty_list in dataclass defaults
(RUF009)
[warning] 255-257: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 277-277: Do not perform function call _json_dict in dataclass defaults
(RUF009)
[warning] 284-284: Do not perform function call _optional in dataclass defaults
(RUF009)
[warning] 285-285: Do not perform function call _empty_dict in dataclass defaults
(RUF009)
[warning] 286-286: Do not perform function call _optional in dataclass defaults
(RUF009)
[warning] 287-287: Do not perform function call _optional in dataclass defaults
(RUF009)
[warning] 288-288: Do not perform function call _optional in dataclass defaults
(RUF009)
[warning] 289-289: Do not perform function call _optional in dataclass defaults
(RUF009)
[warning] 290-290: Do not perform function call _optional in dataclass defaults
(RUF009)
[warning] 291-291: Do not perform function call _optional in dataclass defaults
(RUF009)
[warning] 298-298: Do not perform function call _json_value_field in dataclass defaults
(RUF009)
[warning] 299-299: Do not perform function call _json_dict in dataclass defaults
(RUF009)
[warning] 335-338: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 372-374: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 382-382: Do not perform function call _json_value_field in dataclass defaults
(RUF009)
[warning] 383-383: Do not perform function call _optional in dataclass defaults
(RUF009)
[warning] 384-384: Do not perform function call _optional in dataclass defaults
(RUF009)
[warning] 385-385: Do not perform function call _empty_list in dataclass defaults
(RUF009)
[warning] 389-389: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 391-391: Avoid specifying long messages outside the exception class
(TRY003)
[warning] 415-415: Do not perform function call _optional in dataclass defaults
(RUF009)
[warning] 416-416: Do not perform function call _optional in dataclass defaults
(RUF009)
[warning] 417-417: Do not perform function call _empty_dict in dataclass defaults
(RUF009)
[warning] 419-419: Do not perform function call _json_dict in dataclass defaults
(RUF009)
[warning] 420-420: Do not perform function call _json_dict in dataclass defaults
(RUF009)
[warning] 435-435: Do not perform function call _json_dict in dataclass defaults
(RUF009)
[warning] 448-448: Do not perform function call _optional in dataclass defaults
(RUF009)
[warning] 449-449: Do not perform function call _empty_list in dataclass defaults
(RUF009)
[warning] 457-457: Do not perform function call _optional in dataclass defaults
(RUF009)
[warning] 458-458: Do not perform function call _empty_dict in dataclass defaults
(RUF009)
[warning] 459-459: Do not perform function call _json_dict in dataclass defaults
(RUF009)
[warning] 471-471: Do not perform function call _optional in dataclass defaults
(RUF009)
🔇 Additional comments (25)
adapters/common/src/nemo_fabric_adapters/common/lifecycle.py (2)
39-39: LGTM!Also applies to: 224-233, 285-293, 328-328, 356-356, 410-410
393-400: 🗄️ Data Integrity & IntegrationNo stale
config_modelcallers remain. Alllifecycle.servecall sites use the current API.> Likely an incorrect or invalid review comment.adapters/common/README.md (1)
53-57: LGTM!docs/adapter-contract/execution.md (1)
97-97: LGTM!tests/adapters/test_adapters_common_lifecycle.py (1)
165-165: LGTM!Also applies to: 205-205
external/nat/src/nemo_fabric_adapters/nat/adapter.py (1)
59-59: LGTM!tests/adapters/test_external_nat_adapter.py (1)
44-44: LGTM!Also applies to: 95-95, 274-277, 431-431, 1084-1088, 1098-1099
external/nat/README.md (1)
13-14: LGTM!skills/nemo-fabric-build-adapter/SKILL.md (2)
134-134: LGTM!
74-75: 📐 Maintainability & Code QualityNo changes needed.
SKILL.mdcontains valid YAML frontmatter with non-emptynameanddescriptionfields.adapter-contract/src/nemo_fabric_adapter_contract/codec.py (4)
33-84: LGTM!
87-120: LGTM!
138-149: LGTM!
257-273: LGTM!adapter-contract/src/nemo_fabric_adapter_contract/models.py (2)
65-299: LGTM!Also applies to: 310-391, 408-476
27-49: 📐 Maintainability & Code QualityDo not flag RUF009. Ruff selects only
B019;RUF009is not enabled, so these helpers do not causejust lintto fail.> Likely an incorrect or invalid review comment.tests/adapter_contract/test_agent_execution.py (1)
9-9: LGTM!Also applies to: 19-25, 41-45, 90-97, 112-116, 151-154, 172-172
docs/adapter-contract/normalized-configuration.md (1)
48-49: LGTM!Also applies to: 83-84
adapter-contract/pyproject.toml (1)
27-32: LGTM!adapter-contract/pypi.md (1)
18-29: LGTM!Also applies to: 41-43
adapter-contract/src/nemo_fabric_adapter_contract/pydantic_support.py (2)
21-42: LGTM!
10-15: 🔒 Security & PrivacyNo package-level Pydantic import exists.
__init__.pyis empty, so importingnemo_fabric_adapter_contractdoes not loadpydantic_support.> Likely an incorrect or invalid review comment.tests/adapter_contract/test_agent_config.py (1)
9-10: LGTM!Also applies to: 29-32, 80-80, 95-110, 120-144, 147-175
tests/adapter_contract/test_dependency_boundary.py (1)
17-44: LGTM!tests/adapters/test_adapter_package_metadata.py (1)
53-53: LGTM!Also applies to: 62-62, 99-102
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
…ataclass Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com> # Conflicts: # tests/adapters/test_adapter_package_metadata.py
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
external/nat/README.md (1)
14-14: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winFormat the
Pydanticpackage name as code.Line 14 uses
Pydanticas plain prose. Write it asPydantic.As per coding guidelines: "Format commands, code elements, expressions, package names, file names, and paths as inline code."
Proposed documentation fix
-... depend on Pydantic for its contract boundary. +... depend on `Pydantic` for its contract boundary.🤖 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 `@external/nat/README.md` at line 14, Update the documentation sentence near “FabricConfig” to format the package name `Pydantic` as inline code, preserving the surrounding wording.Source: Coding guidelines
adapters/hermes/src/nemo_fabric_adapters/hermes/adapter.py (1)
512-514: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy liftDrain the MCP shutdown worker before continuing cleanup.
If
stop()is cancelled duringasyncio.to_thread(shutdown_mcp_servers), the worker continues after the await is cancelled. The current handler then closes the agent, session database, and Relay context before MCP shutdown completes. Store and shield the shutdown task, drain it on cancellation, and add a cancellation test.🤖 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 `@adapters/hermes/src/nemo_fabric_adapters/hermes/adapter.py` around lines 512 - 514, Update stop() around shutdown_mcp_servers so the asyncio.to_thread operation is stored as a task and shielded from cancellation; if stop() is cancelled, await the task to completion before continuing cleanup, then propagate cancellation. Add a cancellation test verifying the MCP shutdown worker completes before the agent, session database, and Relay context are closed.
🤖 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.
Outside diff comments:
In `@adapters/hermes/src/nemo_fabric_adapters/hermes/adapter.py`:
- Around line 512-514: Update stop() around shutdown_mcp_servers so the
asyncio.to_thread operation is stored as a task and shielded from cancellation;
if stop() is cancelled, await the task to completion before continuing cleanup,
then propagate cancellation. Add a cancellation test verifying the MCP shutdown
worker completes before the agent, session database, and Relay context are
closed.
In `@external/nat/README.md`:
- Line 14: Update the documentation sentence near “FabricConfig” to format the
package name `Pydantic` as inline code, preserving the surrounding wording.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: f95df6fd-fbf1-4609-96d5-a7ab9d4eb18d
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (5)
adapters/hermes/src/nemo_fabric_adapters/hermes/adapter.pyexternal/nat/README.mdexternal/nat/src/nemo_fabric_adapters/nat/adapter.pytests/adapters/test_adapter_package_metadata.pytests/adapters/test_external_nat_adapter.py
📜 Review details
⏰ Context from checks skipped due to timeout. (16)
- GitHub Check: Preview docs
- GitHub Check: Test (Python 3.14, linux-amd64)
- GitHub Check: Test (Python 3.12, linux-amd64)
- GitHub Check: Test (Python 3.12, linux-arm64)
- GitHub Check: Test (Python 3.12, macos-arm64)
- GitHub Check: Test (Python 3.11, windows-amd64)
- GitHub Check: Test (Python 3.11, linux-amd64)
- GitHub Check: Test (Python 3.13, linux-arm64)
- GitHub Check: Test (Python 3.11, linux-arm64)
- GitHub Check: Test (Python 3.14, windows-amd64)
- GitHub Check: Test (Python 3.13, linux-amd64)
- GitHub Check: Test (Python 3.12, windows-amd64)
- GitHub Check: Test (Python 3.14, linux-arm64)
- GitHub Check: Test (Python 3.13, windows-amd64)
- GitHub Check: Test (Python 3.13, macos-arm64)
- GitHub Check: Pre-commit
🧰 Additional context used
📓 Path-based instructions (22)
**/*.{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:
adapters/hermes/src/nemo_fabric_adapters/hermes/adapter.pyexternal/nat/src/nemo_fabric_adapters/nat/adapter.pytests/adapters/test_external_nat_adapter.pytests/adapters/test_adapter_package_metadata.py
**/*
📄 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 spellNVIDIAin all caps; do not useNvidia,nvidia,nVidia,nVIDIA, orNV.
Usean NVIDIAbefore a noun, because the name begins with an “en” sound.
Do not add a registered trademark symbol afterNVIDIAwhen 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 withNVIDIAon 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:
adapters/hermes/src/nemo_fabric_adapters/hermes/adapter.pyexternal/nat/README.mdexternal/nat/src/nemo_fabric_adapters/nat/adapter.pytests/adapters/test_external_nat_adapter.pytests/adapters/test_adapter_package_metadata.py
**/*.{rs,py}
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
For native binding changes, run
cargo check -p fabric-python --locked.Use
snake_casefor functions and variables; usePascalCasefor Rust types and Python classes.
Files:
adapters/hermes/src/nemo_fabric_adapters/hermes/adapter.pyexternal/nat/src/nemo_fabric_adapters/nat/adapter.pytests/adapters/test_external_nat_adapter.pytests/adapters/test_adapter_package_metadata.py
**/*.{py,pyi}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If Python code or a Python-facing adapter changes, run
just test-python.In Python SDK, adapters, examples, and tests, follow the existing style, use type annotations for public APIs, and keep native binding declarations synchronized with their Rust implementations.
Files:
adapters/hermes/src/nemo_fabric_adapters/hermes/adapter.pyexternal/nat/src/nemo_fabric_adapters/nat/adapter.pytests/adapters/test_external_nat_adapter.pytests/adapters/test_adapter_package_metadata.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 injust test-rustpass and review generated schema diffs.
For schema or public contract changes, run both language suites and review changes underschemas/and generated API references.
Files:
adapters/hermes/src/nemo_fabric_adapters/hermes/adapter.pyexternal/nat/src/nemo_fabric_adapters/nat/adapter.pytests/adapters/test_external_nat_adapter.pytests/adapters/test_adapter_package_metadata.py
**/*.{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, thenjust test-python; rebuild withjust build-pythonwhen native code or packaging changes.Public contract changes must keep native Python binding declarations synchronized with their Rust implementations.
Files:
adapters/hermes/src/nemo_fabric_adapters/hermes/adapter.pyexternal/nat/src/nemo_fabric_adapters/nat/adapter.pytests/adapters/test_external_nat_adapter.pytests/adapters/test_adapter_package_metadata.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 inpython/pyproject.toml.
Files:
adapters/hermes/src/nemo_fabric_adapters/hermes/adapter.pyexternal/nat/src/nemo_fabric_adapters/nat/adapter.pytests/adapters/test_external_nat_adapter.pytests/adapters/test_adapter_package_metadata.py
**/*.{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:
adapters/hermes/src/nemo_fabric_adapters/hermes/adapter.pyexternal/nat/src/nemo_fabric_adapters/nat/adapter.pytests/adapters/test_external_nat_adapter.pytests/adapters/test_adapter_package_metadata.py
**/*.{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:
adapters/hermes/src/nemo_fabric_adapters/hermes/adapter.pyexternal/nat/README.mdexternal/nat/src/nemo_fabric_adapters/nat/adapter.pytests/adapters/test_external_nat_adapter.pytests/adapters/test_adapter_package_metadata.py
adapters/*/src/**/*.py
📄 CodeRabbit inference engine (.agents/skills/contribute-adapter/SKILL.md)
adapters/*/src/**/*.py: Implement adapters using the existing Fabricpythonorprocessrunner and normalized request/result contracts; do not add a runner or one-off abstraction for a single adapter.
Treat normalizedconfig, Fabric-resolved plans, andruntime_contextas authoritative; reserveharness.settingsfor adapter-wide behavior and apply precedence in the order: normalized config, plans/context, harness settings, descriptor/default values.
Reject conflicting duplicate declarations and unsupported behavior with actionable errors naming the field and supported alternatives; never silently drop configuration.
Validate dependency versions, hooks, and credentials before harness invocation, and never expose credential values in outputs, errors, events, logs, or fixtures.
Forward only required system, selected credential, telemetry, and documented harness-specific environment variables; never forward or log unrelated environment values.
Maintain one local adapter host per Fabric runtime across orderedstart→invoke*→stopoperations. Emit one JSON lifecycle response per request on stdout and diagnostics on stderr.
Return harness-level invocation failures as successful lifecycle responses containingresponse: null,failed: true, and structurederrorfields (code,message,retryable, and optionalmetadata).
Do not emit NeMo Relay stream records on adapter stdout; return exactly one terminal lifecycle response while streaming occurs through the SDK-owned out-of-band endpoint.
Scope workspace, generated configuration, state, sessions, and artifacts to the resolved runtime context, and isolate stateful adapter instances by Fabric runtime ID.
Usestartto initialize adapter-owned harness state, retain it for continuation across repeatedinvokecalls on the same runtime, and release it instop.
Files:
adapters/hermes/src/nemo_fabric_adapters/hermes/adapter.py
{adapters/**,examples/**}
⚙️ CodeRabbit configuration file
{adapters/**,examples/**}: Review adapter and example changes for command correctness, config/schema consistency, artifact handling, and compatibility with the public NeMo Fabric contracts.
Files:
adapters/hermes/src/nemo_fabric_adapters/hermes/adapter.py
**/*.{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:
external/nat/README.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 spellNVIDIAin all caps; do not useNvidia,nvidia, orNV.
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 ashereorread 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.
Usecanfor possibility and reservemayfor permission.
Useafterfor temporal relationships instead ofonce, and preferrefer tooverseewhen 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:
external/nat/README.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.
Usecanfor possibility and reservemayfor permission; useafterfor temporal order; userefer tofor cross-references; prefer short direct sentences and specific verbs; avoid unnecessarypleasein 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: usefor exampleorsuch asinstead ofe.g.,and so oninstead ofetc.,that isinstead ofi.e.,compared toinstead ofvs., andby,through, orusinginstead ofvia. Use industry-standard terms such as in silico, in vitro, and in vivo when appropriate, and italicize them in running text.
Usethatwithout commas for essential clauses, andwhichwith commas for nonessential clauses.
Format dates and times clearly: spell out months in body text; use forms such asJune 12, 2025; avoid numeric or ordinal dates; capitalize days; use 12-hour time when appropriate; include a space beforea.m.orp.m.; useETandPTfor needed time zones; avoid24/7; and preferfrom 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:
external/nat/README.md
**/*.{md,mdx}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)
**/*.{md,mdx}: Use the full product nameNVIDIA NeMo Fabricon first use, typically in the title and H1; useNeMo Fabricthereafter. Usefabricalone 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.
CapitalizeNVIDIAcorrectly 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 ashere, and use repository-relative.mdxpaths for links withindocs/.
Prefer active voice, present tense, short sentences, plain English, consistent terminology, and imperative, parallel, scannable procedures.
Useafterinstead ofoncewhen expressing temporal sequence, and usecanrather thanmaywhen 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 withMust fix,Should fix, andNice to havecategories; include file path, line reference, current problem, rationale, and a concrete rewrite or direction.
Files:
external/nat/README.md
**/*.md
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Update relevant SDK, API reference, adapter, example, integration, and support documentation when the corresponding public surface changes.
Files:
external/nat/README.md
**/*.{html,md}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
HTML and Markdown files must use the specified SPDX HTML-comment header.
Files:
external/nat/README.md
{*.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 lowercasefabricCLI command, package/import/crate names, code identifiers, API symbols, configuration keys, file paths, or unrelated generic uses of the word.
Files:
external/nat/README.md
tests/adapters/**/*.py
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
tests/adapters/**/*.py: If an adapter or integration changes, run its focused tests.
For adapter behavior changes, run focused adapter tests undertests/adapters, then runjust test-python.
Files:
tests/adapters/test_external_nat_adapter.pytests/adapters/test_adapter_package_metadata.py
tests/**/*.{rs,py}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
When adding functionality, include tests in the corresponding Rust crate or the relevant area under
tests/.
Files:
tests/adapters/test_external_nat_adapter.pytests/adapters/test_adapter_package_metadata.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.asyncioto tests; async tests are automatically detected by the async runner.
Do not add-> Nonereturn type annotations to test functions.
When mocking a class, useunittest.mock.MagicMockorAsyncMock, using thespecargument when necessary, rather than defining a new class.
Prefix mocked class names withmock, notfake.
Prefer pytest fixtures over helper methods.
If a fixture is needed in multiple test files, define it once inconftest.pyrather than repeating it.
Define fixtures using@pytest.fixture(name="<fixture_name>"[, scope="<scope>"])and a<fixture_name>_fixturefunction; specifyscopeonly when it is notfunction.
Preferpytest.mark.parametrizeover separate tests for different input types.
Use@pytest.mark.usefixtureswhen a fixture is needed but its returned value is unused or it returns no value.
Avoid defensive programming in tests; access expected values directly so missing data raises a clear failure, such as usingresults["data"]instead ofresults.get("data").
When adapter installation metadata changes, packaging metadata tests must directly assert that the root project depends unconditionally on the exact-versionnemo-fabric-runtimedistribution.
Packaging metadata tests must verify that each root harness extra delegates to the matching version of the leaf adapter'sharnessextra.
Packaging metadata tests must verify that bare leaf dependencies remain adapter-owned and that the rootadapter-testsdependency group installs each leaf through itsharnessextra.
Packaging metadata tests must verify that every leaf providesfull; only adapters importing NeMo Relay Python APIs providerelay, while adapters using an external Relay executable havefullequal toharness.
Files:
tests/adapters/test_external_nat_adapter.pytests/adapters/test_adapter_package_metadata.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/adapters/test_external_nat_adapter.pytests/adapters/test_adapter_package_metadata.py
🧠 Learnings (1)
📚 Learning: 2026-07-09T22:28:51.689Z
Learnt from: AjayThorve
Repo: NVIDIA/NeMo-Fabric PR: 43
File: adapters/claude-sdk/src/nemo_fabric_adapters/claude_sdk/adapter.py:164-168
Timestamp: 2026-07-09T22:28:51.689Z
Learning: In the NeMo-Fabric adapters, treat path values used in Fabric adapter configuration (including logic like `_resolve_path` in adapter.py) as config-root-relative. Do not apply `Path.expanduser()` (or otherwise apply `~`/home or shell-style expansion), because it will make the resolved paths normalize inconsistently across adapters. Also, do not rely on or add any resolution behavior that uses `harness.settings.cwd` as an override point for these adapter paths—`harness.settings.cwd` is explicitly unsupported in this adapter context.
Applied to files:
adapters/hermes/src/nemo_fabric_adapters/hermes/adapter.py
🔇 Additional comments (5)
tests/adapters/test_adapter_package_metadata.py (1)
53-55: LGTM!Also applies to: 64-64, 101-106
tests/adapters/test_external_nat_adapter.py (1)
44-44: LGTM!Also applies to: 95-95, 274-277, 431-431, 451-454, 1052-1060, 1080-1090, 1093-1097, 1107-1108
external/nat/src/nemo_fabric_adapters/nat/adapter.py (1)
58-58: LGTM!Also applies to: 279-283
external/nat/README.md (1)
12-13: LGTM!Also applies to: 53-56
adapters/hermes/src/nemo_fabric_adapters/hermes/adapter.py (1)
306-307: LGTM!
Overview
This change makes standard-library dataclasses the canonical Python representation of the southbound adapter contract. It removes Pydantic as an unconditional dependency of
nemo-fabric-adapter-contractwhile retaining optional Pydantic interoperability through thepydanticextra.The wire contract and published JSON Schemas do not change, so the adapter contract version remains unchanged. The dependency choice intentionally prefers the standard library for the base contract; a second Pydantic model hierarchy was rejected because duplicate field definitions could drift.
Breaking Python API changes:
model_validate(...)becomesfrom_mapping(...).model_dump(mode="json")becomesto_mapping().Contract JSON Schema consumers use the published schemas or the optional Pydantic support module.
The common lifecycle host replaces
config_modelwith the framework-neutralconfig_loadercallable.I confirm this contribution is my own work, or I have the right to submit it under this project's license.
I searched existing issues and open pull requests, and this does not duplicate existing work.
Details
AgentConfig,AgentRunRequest,AgentRunResult,RuntimeContext, and their nested blocks to keyword-only, slotted dataclasses.TypeAdapterand typed-extension helpers without duplicating contract classes.AgentConfig.from_mapping.ArtifactRefwith the published runtime-context schema by including its existingmetadatafield.Validation
just --set no_uv true test-python— 713 passed, 15 skipped.--no-depsin a clean Python 3.11 environment;AgentConfiground-tripped without importing Pydantic.uv lock --checkpassed.git diff --checkpassed.Where should the reviewer start?
Start with
adapter-contract/src/nemo_fabric_adapter_contract/models.pyandcodec.py. The central design decision is that the dataclasses are the only contract hierarchy, whilepydantic_support.pyadapts those same types when a consumer opts into Pydantic.Then review
adapters/common/src/nemo_fabric_adapters/common/lifecycle.pyand the NAT adapter migration to confirm the framework-neutralconfig_loaderboundary.Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
Summary by CodeRabbit
New Features
Breaking Changes
config_loaderinstead ofconfig_model.Documentation