Skip to content

feat(nemo-agents): stage Fabric agent.yaml artifacts into Docker/K8s deployments - #1007

Open
tylersbray wants to merge 1 commit into
mainfrom
AIRCORE-966-fabric-artifact-staging/tbray
Open

feat(nemo-agents): stage Fabric agent.yaml artifacts into Docker/K8s deployments#1007
tylersbray wants to merge 1 commit into
mainfrom
AIRCORE-966-fabric-artifact-staging/tbray

Conversation

@tylersbray

@tylersbray tylersbray commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Stage the canonical {agent}-spec fileset into multi-file config_files at Fabric Docker/K8s deploy time so relative paths (skills.paths, sibling prompt assets) resolve under /workspace.
  • Extend Docker materialization for multiple staged files via STAGED_CONFIG_FILES_B64_JSON; K8s continues to use ConfigMap multi-file mounts.
  • Fall back to inline-only agent.yaml when the fileset is missing; fail deploy early when referenced skills.paths entries are absent after staging.

Closes AIRCORE-966.

Test plan

  • uv run --frozen pytest plugins/nemo-agents/tests/unit/test_fabric_artifact_staging.py plugins/nemo-agents/tests/unit/test_runner_deployments.py -v (56 passed)
  • uv run ruff check / uv run --frozen ty check on runner package
  • Pre-commit hooks on commit
  • Live Fabric container deploy with skills fileset once AIRCORE-902 ships Fabric in the default image (full matrix: AIRCORE-960)

Summary by CodeRabbit

  • New Features
    • Fabric deployments now support staging multiple configuration and agent artifact files.
    • Docker and Kubernetes deployments can use bundled configuration files.
    • Deployment creation supports creator identity for on-behalf-of authorization.
    • Missing artifact files gracefully fall back to inline configuration when possible.
  • Bug Fixes
    • Invalid or missing skill references are rejected safely.
    • Deployment failures during artifact staging no longer create incomplete deployment records.
  • Tests
    • Added coverage for multi-file deployments, artifact staging, fallback behavior, authorization, and validation.

@tylersbray
tylersbray requested review from a team as code owners July 30, 2026 23:05
@github-actions github-actions Bot added the feat label Jul 30, 2026
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b8a808e9-4ad3-4636-88f0-8882b66af092

📥 Commits

Reviewing files that changed from the base of the PR and between 1d5cdc2 and e982a03.

📒 Files selected for processing (7)
  • plugins/nemo-agents/src/nemo_agents_plugin/runner/backend.py
  • plugins/nemo-agents/src/nemo_agents_plugin/runner/controller.py
  • plugins/nemo-agents/src/nemo_agents_plugin/runner/deployments_backend.py
  • plugins/nemo-agents/src/nemo_agents_plugin/runner/fabric_artifact_staging.py
  • plugins/nemo-agents/src/nemo_agents_plugin/runner/in_memory.py
  • plugins/nemo-agents/tests/unit/test_fabric_artifact_staging.py
  • plugins/nemo-agents/tests/unit/test_runner_deployments.py

📝 Walkthrough

Walkthrough

Fabric deployments now propagate agent and creator identifiers, stage and validate agent filesets, and support multi-file configuration materialization in Docker and Kubernetes. Staging failures return failed deployments without creating deployment entities.

Changes

Fabric deployment artifacts

Layer / File(s) Summary
Deployment agent and creator propagation
plugins/nemo-agents/src/nemo_agents_plugin/runner/backend.py, plugins/nemo-agents/src/nemo_agents_plugin/runner/controller.py, plugins/nemo-agents/src/nemo_agents_plugin/runner/deployments_backend.py, plugins/nemo-agents/src/nemo_agents_plugin/runner/in_memory.py
Runner interfaces accept agent and creator identifiers; the controller forwards the agent, and container deployments pass creator identity to auth-proxy delegation.
Fabric fileset staging
plugins/nemo-agents/src/nemo_agents_plugin/runner/fabric_artifact_staging.py, plugins/nemo-agents/tests/unit/test_fabric_artifact_staging.py
Filesets are downloaded, rewritten agent.yaml content is substituted, sibling artifacts are staged, skill paths and encoding are validated, and unavailable filesets can fall back to inline YAML.
Multi-file deployment materialization
plugins/nemo-agents/src/nemo_agents_plugin/runner/deployments_backend.py, plugins/nemo-agents/tests/unit/test_runner_deployments.py
Docker serializes multiple files as base64 JSON, Kubernetes mounts resolved files, and lifecycle tests cover successful staging, runtime wiring, auth-proxy delegation, and staging failures.

Sequence Diagram(s)

sequenceDiagram
  participant Controller
  participant DeploymentsRunnerBackend
  participant FabricArtifactStaging
  participant DeploymentRuntime
  Controller->>DeploymentsRunnerBackend: Forward agent and creator identifiers
  DeploymentsRunnerBackend->>FabricArtifactStaging: Stage Fabric fileset
  FabricArtifactStaging-->>DeploymentsRunnerBackend: Return resolved ConfigFile list
  DeploymentsRunnerBackend->>DeploymentRuntime: Configure Docker or Kubernetes files
  DeploymentRuntime-->>DeploymentsRunnerBackend: Materialize files and start agent
Loading

Possibly related PRs

Suggested reviewers: stefan-kickoff, mikeknep, mckornfield

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 26.47% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the PR's primary change: staging Fabric agent.yaml artifacts into Docker and Kubernetes deployments.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch AIRCORE-966-fabric-artifact-staging/tbray

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
plugins/nemo-agents/src/nemo_agents_plugin/runner/deployments_backend.py (1)

384-404: 🚀 Performance & Scalability | 🔵 Trivial

Multi-file payload transported entirely via one env var.

All staged file contents are base64-encoded into a single JSON env var. Docker/OS environment-size limits could be hit for filesets with many or large skill/prompt files, causing container start failures that are hard to diagnose from the deployment status alone. Worth a sanity check on typical fileset sizes, or a size guard/clear error before this path is hit at scale.

🤖 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 `@plugins/nemo-agents/src/nemo_agents_plugin/runner/deployments_backend.py`
around lines 384 - 404, The multi-file branch in the Docker backend can exceed
environment-size limits by placing the entire staged fileset in one
`_STAGED_CONFIG_FILES_ENV` variable. Add a preflight size check before appending
that env var, using the serialized base64 payload size and an appropriate
documented limit; raise a clear deployment error when exceeded, while preserving
the existing materialization flow for payloads within the limit.
🤖 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 `@plugins/nemo-agents/src/nemo_agents_plugin/runner/deployments_backend.py`:
- Around line 247-256: Update _materialize_staged_config_files_and_exec to
invoke the staging inline script with python instead of python3, keeping the
existing exec {quoted_argv} behavior unchanged so Fabric Docker deployments
consistently use the available interpreter.

In
`@plugins/nemo-agents/src/nemo_agents_plugin/runner/fabric_artifact_staging.py`:
- Around line 96-102: Guard the file read in the staging loop around
path.read_text within the artifact staging function, handling UnicodeDecodeError
alongside the existing file-related exceptions. Convert it into a clear staging
error that identifies the unreadable file, while preserving the special
rewritten_agent_yaml path and normal UTF-8 content behavior.
- Around line 70-77: Ensure the fileset-missing fallback in the staging flow
still invokes _validate_referenced_skill_paths before returning the inline
agent.yaml configuration, so configured skills.paths entries fail deployment
immediately when unavailable. Add coverage in test_fabric_artifact_staging.py
for a missing fileset with skills.paths configured, asserting validation raises
or otherwise reports the missing skill rather than allowing staging to succeed.

---

Nitpick comments:
In `@plugins/nemo-agents/src/nemo_agents_plugin/runner/deployments_backend.py`:
- Around line 384-404: The multi-file branch in the Docker backend can exceed
environment-size limits by placing the entire staged fileset in one
`_STAGED_CONFIG_FILES_ENV` variable. Add a preflight size check before appending
that env var, using the serialized base64 payload size and an appropriate
documented limit; raise a clear deployment error when exceeded, while preserving
the existing materialization flow for payloads within the limit.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: db4c4926-279e-40cf-9861-3dea1c445f9e

📥 Commits

Reviewing files that changed from the base of the PR and between cac16db and 1d5cdc2.

📒 Files selected for processing (7)
  • plugins/nemo-agents/src/nemo_agents_plugin/runner/backend.py
  • plugins/nemo-agents/src/nemo_agents_plugin/runner/controller.py
  • plugins/nemo-agents/src/nemo_agents_plugin/runner/deployments_backend.py
  • plugins/nemo-agents/src/nemo_agents_plugin/runner/fabric_artifact_staging.py
  • plugins/nemo-agents/src/nemo_agents_plugin/runner/in_memory.py
  • plugins/nemo-agents/tests/unit/test_fabric_artifact_staging.py
  • plugins/nemo-agents/tests/unit/test_runner_deployments.py

Comment thread plugins/nemo-agents/src/nemo_agents_plugin/runner/deployments_backend.py Outdated
Comment thread plugins/nemo-agents/src/nemo_agents_plugin/runner/fabric_artifact_staging.py Outdated
…deployments

Download the agent-spec fileset at deploy time and materialize sibling files
(skills, prompts, etc.) under /workspace so Fabric relative paths resolve in
containers the same way they do locally. Closes AIRCORE-966.

Signed-off-by: Tyler Bray <tbray@nvidia.com>
@tylersbray
tylersbray force-pushed the AIRCORE-966-fabric-artifact-staging/tbray branch from 1d5cdc2 to e982a03 Compare July 31, 2026 00:10
@github-actions

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 29101/37023 78.6% 63.1%
Integration Tests 17211/35741 48.1% 20.7%

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant