Skip to content

feat: standardize NeMo Fabric IDs on adapter Relay root scopes - #381

Open
mnajafian-nv wants to merge 5 commits into
NVIDIA:mainfrom
mnajafian-nv:feat/fabric-ids-on-relay-root-scope
Open

mnajafian-nv wants to merge 5 commits into
NVIDIA:mainfrom
mnajafian-nv:feat/fabric-ids-on-relay-root-scope

Conversation

@mnajafian-nv

@mnajafian-nv mnajafian-nv commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Overview

Standardize Relay root-scope correlation metadata for the first-party in-process SDK adapters. Deep Agents, mini-SWE-agent, and NOOA now use one helper for nemo_fabric_request_id, nemo_fabric_invocation_id, and nemo_fabric_runtime_id.

Deep Agents and mini-SWE-agent gain the runtime ID; existing keys and values remain unchanged. This uses existing Relay scope metadata and does not change a Relay API, public schema, or dependency. Gateway-based adapters and Hermes Agent are outside this change.

Details

  • Add relay_correlation_metadata(context) and shared constants for the three reserved metadata keys.
  • Merge those keys into the metadata from relay_request_context() so the session-root metadata added by fix: group conversation turns under one Relay session #358 is preserved.
  • Update Deep Agents, mini-SWE-agent, NOOA, and the LangGraph custom-agent example to use the helper.
  • Document the keys and OpenTelemetry promotion pattern, and add runtime-ID propagation coverage.

Validation

  • GitHub Python, Rust, TypeScript, adapter, wheel, pre-commit, and docs checks passed at 92975244.
  • Full local Python suite: 1,928 passed, 93 skipped.
  • Full local Rust workspace: 161 passed.
  • Pre-commit, Ruff check and format, and git diff --check passed.

Where should the reviewer start?

Start with relay_correlation_metadata() in adapters/python/common/src/nemo_fabric_adapters/common/utils.py, then the Deep Agents and mini-SWE-agent call sites. The key invariant is merging with relay_request_context() metadata so nemo_fabric_session_root remains present.

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

  • Relates to fix: group conversation turns under one Relay session #358, which adds nemo_fabric_session_root to the metadata preserved by this change.

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

In-process adapters attach NeMo Fabric IDs to their Relay root scope so
telemetry consumers can join Relay events back to a Fabric runtime,
invocation, and request. Each adapter currently spells the metadata
keys inline, and the set of keys differs between adapters.

Define the three reserved key names once in the common adapter package
and add relay_correlation_metadata(), which builds the mapping from the
invocation's RuntimeContext. relay_request_context() now uses the same
request key constant; its behavior is unchanged.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
The OO Agents adapter already tags its per-invocation Relay Agent scope
with the NeMo Fabric runtime, invocation, and request IDs, but the Deep
Agents and mini-SWE-agent adapters omit the runtime ID. Without it, a
telemetry consumer cannot group invocations that ran on the same
retained runtime, and the reserved keys differ by adapter.

Build the root scope metadata with the shared
relay_correlation_metadata() helper so both adapters emit all three
keys. relay_request_context() still owns the UUID propagation root.
The Deep Agents telemetry path now receives the RuntimeContext instead
of separate ID arguments.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
The NOOA adapter spelled the three reserved NeMo Fabric correlation
keys inline. Use relay_correlation_metadata() so every in-process
adapter emits the keys from one definition and cannot drift. The
emitted keys and values are unchanged, and the adapter still does not
seed a Relay propagation root from the request ID.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
Adapter authors had no single description of which Relay metadata keys
carry NeMo Fabric IDs, and consumers could not tell which adapters emit
them or how to export them to OpenTelemetry.

Describe the three reserved keys and the helper pattern in the common
adapter README, state that the CLI gateway adapters and
the Hermes Agent plugin path do not attach them yet, and show the
promote_metadata_prefixes endpoint setting that exports them as span
attributes. Keep the adapter-building skill in parity with the new
helper.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
The LangGraph custom-agent example, which the adapter-building skill
points authors to, still spelled nemo_fabric_runtime_id and
nemo_fabric_invocation_id by hand. Merge relay_correlation_metadata()
into the relay_request_context() metadata instead, so the example and
the first-party adapters build the reserved keys from one definition.
The emitted keys and values are unchanged.

Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/NeMo-Fabric/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Enterprise
  • Run ID: 8d78c20a-fdaa-4804-b8be-e73b4f6cc804



📥 Commits

Reviewing files that changed from the base of the PR and between a17f316 and 9297524.




📒 Files selected for processing (12)
  • adapters/python/common/README.md
  • adapters/python/common/src/nemo_fabric_adapters/common/utils.py
  • adapters/python/deepagents/src/nemo_fabric_adapters/deepagents/adapter.py
  • adapters/python/mini-swe-agent/README.md
  • adapters/python/mini-swe-agent/src/nemo_fabric_adapters/mini_swe_agent/adapter.py
  • adapters/python/nooa/src/nemo_fabric_adapters/nooa/telemetry.py
  • examples/langgraph_custom_agent/adapter/telemetry.py
  • skills/nemo-fabric-build-adapter/SKILL.md
  • tests/adapters/test_adapaters_common_utils.py
  • tests/adapters/test_deepagents.py
  • tests/adapters/test_mini_swe_agent.py
  • tests/integrations/test_relay_scope_leak.py



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




📜 Recent review details
⏰ Context from checks skipped due to timeout. (29)
  • GitHub Check: Preview docs
  • GitHub Check: request / require-nvskills-ci / require-nvskills-ci
  • GitHub Check: Test (x86_64)
  • GitHub Check: Test (Python 3.14, windows-amd64)
  • GitHub Check: Test (Python 3.12, macos-arm64)
  • GitHub Check: Test (Python 3.13, linux-arm64)
  • GitHub Check: Test (Python 3.12, linux-arm64)
  • GitHub Check: Test (Python 3.11, linux-arm64)
  • GitHub Check: Test (arm64)
  • GitHub Check: Test (Python 3.13, linux-amd64)
  • GitHub Check: Test (Python 3.11, windows-amd64)
  • GitHub Check: Test (Python 3.11, macos-arm64)
  • GitHub Check: Test (Python 3.12, windows-amd64)
  • GitHub Check: Test (Python 3.13, macos-arm64)
  • GitHub Check: Test (Python 3.14, linux-arm64)
  • GitHub Check: Pre-commit
  • GitHub Check: Test (Python 3.14, linux-amd64)
  • GitHub Check: Test (Python 3.13, windows-amd64)
  • GitHub Check: Test (Python 3.11, linux-amd64)
  • GitHub Check: Test (Python 3.12, linux-amd64)
  • GitHub Check: Hermes adapter (upstream Relay 0.9, Python 3.14)
  • GitHub Check: OpenCode E2E
  • GitHub Check: Test adapters (Node 22.19.0)
  • GitHub Check: Cline E2E
  • GitHub Check: Test (Python 3.14, macos-arm64)
  • GitHub Check: Test (Node 24)
  • GitHub Check: Test (Node 20.18.3)
  • GitHub Check: Qwen Code E2E
  • GitHub Check: Test adapters (Node 24)



🧰 Additional context used
📚 Code guidelines (3)
.agents/skills/contribute-adapter/SKILL.md — configured
.agents/skills/contribute-docs/SKILL.md — configured
skills/README.md — auto-discovered

📓 Path-based instructions (9)
Enforce the product name in user-facing prose: use "NVIDIA NeMo Fabric" on first use and "NeMo Fabric" thereafter.

⚙️ CodeRabbit configuration file

Files:

  • skills/nemo-fabric-build-adapter/SKILL.md
  • adapters/python/common/README.md
  • adapters/python/mini-swe-agent/README.md

Review adapter and example changes for command correctness, config/schema consistency, artifact handling, and compatibility with the public NeMo Fabric contracts.

⚙️ CodeRabbit configuration file

Files:

  • adapters/python/nooa/src/nemo_fabric_adapters/nooa/telemetry.py
  • adapters/python/mini-swe-agent/src/nemo_fabric_adapters/mini_swe_agent/adapter.py
  • adapters/python/common/README.md
  • examples/langgraph_custom_agent/adapter/telemetry.py
  • adapters/python/mini-swe-agent/README.md
  • adapters/python/common/src/nemo_fabric_adapters/common/utils.py
  • adapters/python/deepagents/src/nemo_fabric_adapters/deepagents/adapter.py

Do not flag SKILL.md files for missing SPDX headers.

⚙️ CodeRabbit configuration file

Files:

  • skills/nemo-fabric-build-adapter/SKILL.md

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

⚙️ CodeRabbit configuration file

Files:

  • tests/adapters/test_mini_swe_agent.py
  • tests/adapters/test_adapaters_common_utils.py
  • tests/adapters/test_deepagents.py
  • tests/integrations/test_relay_scope_leak.py

Source excerpt: Follow these repository-specific requirements after applying the public skill: Place a Python adapter under `adapters/python//` with `LICENSE -> ../../../LICENSE`, `README.md`, `.fabric-adapter.json`, Python pack...

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

Files:

  • adapters/python/nooa/src/nemo_fabric_adapters/nooa/telemetry.py
  • adapters/python/mini-swe-agent/src/nemo_fabric_adapters/mini_swe_agent/adapter.py
  • adapters/python/common/README.md
  • adapters/python/mini-swe-agent/README.md
  • adapters/python/common/src/nemo_fabric_adapters/common/utils.py
  • adapters/python/deepagents/src/nemo_fabric_adapters/deepagents/adapter.py

Source excerpt: [ ] Relevant adapter or example `README.md` files updated when examples or adapters have changed.

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

Files:

  • adapters/python/common/README.md
  • adapters/python/mini-swe-agent/README.md

Source excerpt: Follow these repository-specific requirements after applying the public skill: Give each Python leaf adapter a small base installation, a `harness` extra for package-installable target packages, and a `full` extra for packag...

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

Files:

  • adapters/python/nooa/src/nemo_fabric_adapters/nooa/telemetry.py
  • adapters/python/mini-swe-agent/src/nemo_fabric_adapters/mini_swe_agent/adapter.py
  • adapters/python/common/README.md
  • adapters/python/mini-swe-agent/README.md
  • adapters/python/common/src/nemo_fabric_adapters/common/utils.py
  • adapters/python/deepagents/src/nemo_fabric_adapters/deepagents/adapter.py

Source excerpt: **Frontmatter:** each `SKILL.md` begins with YAML frontmatter containing at least `name` and `description`.

📄 CodeRabbit inference engine (skills/README.md)

Files:

  • skills/nemo-fabric-build-adapter/SKILL.md

Source excerpt: Copy an individual skill directory, such as `nemo-fabric-integrate/` or `nemo-fabric-build-adapter/`, into the place your coding agent discovers skills **in your own project**.

📄 CodeRabbit inference engine (skills/README.md)

Files:

  • skills/nemo-fabric-build-adapter/SKILL.md




🔇 Additional comments (12)
adapters/python/common/src/nemo_fabric_adapters/common/utils.py (1)

26-28: LGTM!

Also applies to: 288-288, 307-314


tests/adapters/test_adapaters_common_utils.py (1)

191-212: LGTM!


adapters/python/common/README.md (1)

152-168: LGTM!

Also applies to: 170-184, 186-201, 203-216


adapters/python/deepagents/src/nemo_fabric_adapters/deepagents/adapter.py (1)

735-735: LGTM!

Also applies to: 807-807, 838-841


adapters/python/mini-swe-agent/src/nemo_fabric_adapters/mini_swe_agent/adapter.py (1)

216-216: LGTM!


adapters/python/nooa/src/nemo_fabric_adapters/nooa/telemetry.py (1)

262-262: LGTM!


examples/langgraph_custom_agent/adapter/telemetry.py (1)

138-138: LGTM!


adapters/python/mini-swe-agent/README.md (1)

156-157: LGTM!

Also applies to: 163-163, 167-167


skills/nemo-fabric-build-adapter/SKILL.md (1)

250-256: LGTM!


tests/adapters/test_deepagents.py (1)

743-743: LGTM!

Also applies to: 762-762, 771-771, 1417-1417, 2223-2223, 2228-2228


tests/adapters/test_mini_swe_agent.py (1)

425-425: LGTM!

Also applies to: 467-467, 507-507


tests/integrations/test_relay_scope_leak.py (1)

46-67: LGTM!

Also applies to: 167-169, 188-188, 199-199, 205-207, 226-226, 229-229






Walkthrough

The change adds shared Relay metadata keys and a helper that maps RuntimeContext IDs to those keys. Python adapters use the helper to attach request, invocation, and runtime IDs to Relay scope metadata. Documentation and tests describe and verify this propagation.

Changes

Relay Correlation Metadata

Layer / File(s) Summary
Shared metadata contract and helper
adapters/python/common/src/nemo_fabric_adapters/common/utils.py, adapters/python/common/README.md, tests/adapters/test_adapaters_common_utils.py
The common utilities define three Relay metadata-key constants and add relay_correlation_metadata(context). The helper returns request, invocation, and runtime IDs from RuntimeContext. Documentation describes the keys, metadata merging, and OpenTelemetry promotion. A unit test checks the returned mapping.
Adapter propagation and validation
adapters/python/deepagents/..., adapters/python/mini-swe-agent/..., adapters/python/nooa/..., examples/langgraph_custom_agent/..., skills/nemo-fabric-build-adapter/SKILL.md, tests/adapters/test_deepagents.py, tests/adapters/test_mini_swe_agent.py, tests/integrations/test_relay_scope_leak.py
DeepAgents, mini-swe-agent, NOOA, and the LangGraph custom agent use the shared helper to add correlation metadata to Relay scopes. Adapter guidance and tests now cover runtime ID propagation. Integration tests pass RuntimeContext to telemetry invocations and check runtime metadata and overlapping-turn behavior.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant RuntimeContext
  participant Adapter
  participant relay_correlation_metadata
  participant RelayAgentScope
  Adapter->>relay_correlation_metadata: Pass RuntimeContext
  relay_correlation_metadata-->>Adapter: Return correlation metadata
  Adapter->>RelayAgentScope: Merge metadata into scope
Loading

Merge Risk: ⚪ Minimal · up to 92975

The PR adds correlation IDs to Relay root scopes and supports exporting matching metadata to spans. Nested events remain linked through the scope hierarchy, so duplicating those IDs on each child is unnecessary. No actionable merge-blocking risk remains.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 34.62% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 26 functions across 9 files. (3 skipped: … 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 format with the allowed lowercase type feat, uses an imperative summary, stays under 72 characters, and has no trailing period. It accurately describes the cha…
Description check Passed The description includes the required overview, reviewer starting point, related issue reference with an allowed action keyword, and both contribution checkboxes. It also provides relevant implementat…

Full details: Docstring Coverage

Explanation

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


  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🧪 Generate unit tests (beta)
  • Create a new PR




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





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

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

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

@mnajafian-nv mnajafian-nv self-assigned this Oct 9, 2026
@mnajafian-nv
mnajafian-nv marked this pull request as ready for review October 10, 2026 17:33
@mnajafian-nv
mnajafian-nv requested a review from a team as a code owner October 10, 2026 17:33
@mnajafian-nv

Copy link
Copy Markdown
Contributor Author

/nvskills-ci

This branch was successfully deployed

1 active deployment
fern — 92975244 Deployed Oct 9, 2026 by copy-pr-bot[bot] via Preview docs #1983
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant