Skip to content

feat(inference): add protected llama.cpp Spark qualification - #8266

Merged
ericksoa merged 4 commits into
mainfrom
feat/llamacpp-dgx-spark-qualification-8260
Aug 5, 2026
Merged

feat(inference): add protected llama.cpp Spark qualification#8266
ericksoa merged 4 commits into
mainfrom
feat/llamacpp-dgx-spark-qualification-8260

Conversation

@ericksoa

@ericksoa ericksoa commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a dormant, protected qualification lane that can prove an exact NemoClaw-built llama.cpp ARM64 image candidate on one NVIDIA DGX Spark. The lane remains disabled until a follow-up YAML-only activation supplies the protected runner, approval environment, and verified local model path.

Related Issue

Part of #8260

Changes

  • Compile the candidate image manifest and Spark serving recipe into a strict, hashed execution plan using trusted main code. A direct dynamic workflow binding is insufficient because candidate-controlled runner, environment, model-path, and command data must be rejected before protected work is scheduled; contract and plan-export tests cover the boundary.
  • Add a trusted qualification runner that builds the exact candidate plan from the trusted main Dockerfile and context in an isolated localhost registry. The candidate Dockerfile must byte-match trusted main, Buildx cannot use host networking, and the runner verifies the pinned Nemotron GGUF, non-root one-GPU execution without egress, authenticated Chat Completions, full GPU-layer offload on NVIDIA GB10, and sanitized cleanup evidence.
  • Add an explicit-only trusted plan job and protected DGX Spark job to E2E, with activation-only risk selection and workflow-boundary tests. The current manifest keeps execution disabled and publication false, so this PR does not schedule the protected job or change a supported serving default.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification: The protected lane is dormant; publication remains false, execution remains disabled, protected infrastructure remains unset, and supported onboarding, serving defaults, aliases, and operator procedures do not change.
  • Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging)
  • Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: Maintainer-approved scope is recorded in [Managed inference] Qualify owned llama.cpp image on DGX Spark #8260. The lane is fail-closed and protected by strict plan, runner, workflow, and hostile-input contract tests.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Documentation Writer Review

  • Documentation writer subagent reviewed the completed changes
  • Result: no-docs-needed
  • Evidence: Adds a dormant internal CI qualification lane. Execution and publication remain disabled, protected infrastructure inputs remain unset, and no supported recipe, default, CLI, configuration, or onboarding behavior changes.
  • Agent: Codex Desktop

DGX Station Hardware Evidence

  • Tested on DGX Station
  • Tested commit:
  • Station profile/scenario:
  • Result:
  • Supporting evidence:

Verification

  • PR description includes a Signed-off-by: line and every commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run validate:pr passed after refreshing origin/main when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result or justification: The 15-file focused Vitest run passed 352 tests. The final hardening suite passed 88/88, including the exact previously failing shard-5 compatibility test. Build, strict typecheck, npm run validate:pr, semantic E2E phases, test-title style, and test-size checks pass.
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — command/result:
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • npm run docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: Aaron Erickson aerickson@nvidia.com

Summary by CodeRabbit

  • New Features

    • Added an optional, protected llama.cpp qualification workflow for NVIDIA DGX Spark.
    • Validates ARM64 execution, GPU offload, model serving, health checks, authenticated completions, and cleanup.
    • Publishes qualification plans, integrity checks, execution evidence, and downloadable artifacts.
    • Added llama.cpp recipe and qualification settings for DGX Spark.
  • Bug Fixes

    • Improved validation of qualification configuration, recipe references, serving policies, and publication readiness.
  • Tests

    • Added comprehensive workflow, configuration, execution, evidence, and failure-path coverage.

Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
@ericksoa ericksoa self-assigned this Aug 4, 2026
@ericksoa ericksoa added area: inference Inference routing, serving, model selection, or outputs area: local-models Local model providers, downloads, launch, or connectivity feature PR adds or expands user-visible functionality platform: dgx-spark Affects DGX Spark hardware or workflows v0.0.102 labels Aug 4, 2026
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds a protected llama.cpp DGX Spark qualification flow. It validates recipe data, compiles a digest-bound plan, runs trusted ARM64 qualification, verifies evidence and cleanup, and integrates workflow and risk-plan checks.

Changes

DGX Spark qualification

Layer / File(s) Summary
Qualification contracts and evidence schemas
scripts/checks/llama-cpp-dgx-spark-qualification-contract.mts, test/llama-cpp-dgx-spark-qualification-contract.test.ts
Defines strict activation, execution-plan, evidence, receipt, digest, hardware, probe, and cleanup contracts with validation tests.
Recipe validation and plan export
scripts/checks/export-llama-cpp-image-config.mts, scripts/checks/export-llama-cpp-dgx-spark-qualification-plan.mts, managed-inference/images/llama-cpp/image.yaml, .github/workflows/llama-cpp-image.yaml, test/llama-cpp-image.test.ts, test/llama-cpp-dgx-spark-qualification-plan.test.ts
Validates the recipe and manifest, constructs a SHA-256-bound qualification plan, and exports protected plan fields.
Pinned DGX Spark execution runner
scripts/checks/run-llama-cpp-dgx-spark-qualification.mts, test/llama-cpp-dgx-spark-qualification-runner.test.ts
Builds and runs the pinned ARM64 image, validates GPU and API evidence, writes receipts, and performs ownership-aware cleanup.
Trusted planning and qualification workflow
.github/workflows/e2e.yaml, tools/e2e/*, test/e2e/support/*, test/helpers/vitest-watch-triggers.ts, test/vitest-watch-triggers.test.ts
Adds trusted planning and protected qualification jobs with checkout, ordering, cleanup, evidence-upload, and workflow-boundary validation.
Evidence loading and risk-plan integration
test/e2e/live/*, test/e2e/mock-parity.json, tools/advisors/risk-plan.mts, test/pr-risk-plan.test.ts, test/e2e/support/e2e-cross-runtime-compatibility.test.ts
Adds protected artifact loading, live receipt checks, mock parity mapping, digest updates, and activation-specific risk rules.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related issues

Possibly related PRs

  • NVIDIA/NemoClaw#8226 — Adds a similar protected, explicit-only E2E qualification pattern with workflow boundaries, evidence validation, cleanup, and risk-plan integration.

Suggested labels: area: ci, area: e2e, area: packaging, area: security

Suggested reviewers: brandonpelfrey, aasthajh

Sequence Diagram(s)

sequenceDiagram
  participant Controller
  participant PlanJob
  participant CandidateRepository
  participant QualificationJob
  participant DGXSpark
  participant Evidence
  Controller->>PlanJob: dispatch protected plan compilation
  PlanJob->>CandidateRepository: checkout exact candidate configuration
  PlanJob->>QualificationJob: publish digest-bound plan
  QualificationJob->>DGXSpark: build and run pinned ARM64 candidate
  DGXSpark->>Evidence: produce qualification receipt
  QualificationJob->>Evidence: validate and upload artifacts
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding a protected llama.cpp Spark qualification lane.
✨ 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 feat/llamacpp-dgx-spark-qualification-8260

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

@github-code-quality

github-code-quality Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in commit b470a75 in the feat/llamacpp-dgx-sp... branch remains at 96%, unchanged from commit e7f58e9 in the main branch.

TypeScript / code-coverage/cli

The overall coverage in commit b470a75 in the feat/llamacpp-dgx-sp... branch remains at 81%, unchanged from commit 87fcfe4 in the main branch.

Show a code coverage summary of the most impacted files.
File main 87fcfe4 feat/llamacpp-dgx-sp... b470a75 +/-
src/lib/sandbox...rce-identity.ts 87% 87% 0%
src/lib/shields/index.ts 70% 71% +1%
src/lib/credentials/store.ts 55% 56% +1%
src/lib/private-networks.ts 90% 93% +3%
src/lib/policy/...ne-exclusion.ts 92% 96% +4%
src/lib/domain/.../connect-env.ts 89% 97% +8%

Updated August 04, 2026 23:25 UTC

Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
@github-actions github-actions Bot added v0.0.103 Release target and removed v0.0.102 labels Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — No blocking findings reported

Advisor assessment: No blocking advisor findings reported
Next action: No advisor follow-up needed.
Findings: 0 blockers · 0 warnings · 0 suggestions

Model lanes

  • GPT-5.6 Terra (primary): Completed · medium confidence · 0 blockers · 0 warnings · 0 suggestions
  • Nemotron 3 Ultra (second opinion): Failed after a partial review · low confidence · 0 blockers · 0 warnings · 0 suggestions

Second-opinion terminology and E2E selections are advisory. They do not change the primary assessment or E2E / PR Gate.

4 semantic terminology decisions

Terminology decisions are advisory. They affect the assessment only when a separate finding identifies concrete semantic impact.

  • established — dormant at .github/workflows/e2e.yaml:2128: Keep `dormant` for this explicit-only inactive lane.
  • established — protected qualification at scripts/checks/export-llama-cpp-dgx-spark-qualification-plan.mts:25: Keep `protected qualification` for trust-bound qualification operations.
  • justified — trusted plan at .github/workflows/e2e.yaml:2036: Keep `trusted plan`; the modifier distinguishes trusted compilation from candidate-controlled input.
  • established — exact candidate at .github/workflows/e2e.yaml:2038: Keep `exact candidate` where evidence or execution binds to an immutable revision.

E2E guidance

Advisory only. E2E / PR Gate selects and runs jobs independently.

Recommended E2E: cloud-inference, cloud-onboard, managed-image-multiarch-startup, security-posture, inference-routing, network-policy

Workflow run details

This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge.

@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: 6

🧹 Nitpick comments (9)
scripts/checks/run-llama-cpp-dgx-spark-qualification.mts (2)

1067-1074: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider preserving a bounded failure reason.

The top-level catch discards the error and writes one generic line. Every failure mode in this 1000-line runner then produces the same operator-visible message. All thrown messages in this file are static strings that contain no secrets or paths. Writing error.message for Error instances keeps the lane debuggable without leaking run data.

🤖 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 `@scripts/checks/run-llama-cpp-dgx-spark-qualification.mts` around lines 1067 -
1074, Update the top-level catch around main() to retain the caught error and
append its message when it is an Error instance, while preserving the generic
failure text for other thrown values. Keep the existing stderr output and
exitCode behavior unchanged.

205-216: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the tautological registry-owner comparison.

Line 205 assigns registryOwner from expectedRegistryOwner(runId, runAttempt). Line 212 then compares the same value against the same call. That clause can never be false, so it does not verify ownership. Only the registryName clause has effect. Keep the check readable so a future reader does not treat the owner as independently validated.

♻️ Proposed simplification
-  if (
-    registryOwner !== expectedRegistryOwner(runId, runAttempt) ||
-    registryName !== expectedRegistryName(runId, runAttempt)
-  ) {
+  if (registryName !== expectedRegistryName(runId, runAttempt)) {
     throw new Error("registry ownership does not match this workflow run");
   }
🤖 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 `@scripts/checks/run-llama-cpp-dgx-spark-qualification.mts` around lines 205 -
216, Remove the tautological registryOwner comparison from the validation
condition in the workflow check, since it compares expectedRegistryOwner(runId,
runAttempt) with itself. Keep the registryName validation and simplify the
surrounding logic so it clearly validates only the effective registry-name
constraint.
test/llama-cpp-dgx-spark-qualification-runner.test.ts (1)

263-264: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Replace the vacuous secret-leak assertion.

Line 264 asserts that the argv does not contain the literal raw-secret-value. No input to buildServerContainerArgv ever contains that literal, so this assertion cannot fail. It does not prove that the API key stays off argv. Pass a recognizable key material value through a real input and assert its absence, or drop the line and rely on the --api-key-file assertion at line 262.

♻️ Proposed change
     expect(valuesAfter(argv, "--api-key-file")).toEqual(["/run/secrets/llama-cpp-api-key"]);
     expect(argv).not.toContain("--api-key");
-    expect(argv.join(" ")).not.toContain("raw-secret-value");

As per path instructions: "Flag copied production algorithms, broad mocks that bypass the behavior under test, and conditionals that make a test pass without exercising its claim."

🤖 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 `@test/llama-cpp-dgx-spark-qualification-runner.test.ts` around lines 263 -
264, Replace the vacuous raw-secret-value assertion in the test covering
buildServerContainerArgv with a meaningful check: pass recognizable API-key
material through an actual builder input and assert it is absent from argv, or
remove that assertion and rely on the existing --api-key-file check. Keep the
--api-key absence assertion intact.

Source: Path instructions

scripts/checks/export-llama-cpp-image-config.mts (2)

218-244: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Reject YAML warnings in both parsers, as the contract parser does.

parseQualificationRecipe and parseImageManifest check only document.errors. parseActivationYaml in scripts/checks/llama-cpp-dgx-spark-qualification-contract.mts rejects on document.errors or document.warnings. The recipe and the manifest are the two inputs that produce the hashed plan, so they deserve the same strictness. Add the warnings check to both parsers.

♻️ Proposed strictness alignment
   const document = YAML.parseDocument(source, { strict: true, uniqueKeys: true });
-  if (document.errors.length > 0) {
+  if (document.errors.length > 0 || document.warnings.length > 0) {
     throw new Error(`invalid llama.cpp qualification recipe YAML: ${document.errors.join("; ")}`);
   }
   const document = YAML.parseDocument(source, { strict: true, uniqueKeys: true });
-  if (document.errors.length > 0) {
+  if (document.errors.length > 0 || document.warnings.length > 0) {
     throw new Error(`invalid llama.cpp image manifest YAML: ${document.errors.join("; ")}`);
   }
🤖 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 `@scripts/checks/export-llama-cpp-image-config.mts` around lines 218 - 244,
Update parseQualificationRecipe and parseImageManifest to reject YAML documents
when either document.errors or document.warnings is non-empty, matching
parseActivationYaml’s strictness. Preserve the existing parser-specific error
messages while including both diagnostics in the thrown errors.

828-844: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract one bounded regular-file reader. Both files define an identical readBoundedRegularFile that resolves a path against a root, rejects escapes, opens with O_NOFOLLOW, and bounds the size. The bodies differ only in the size limit and the error text. export-llama-cpp-dgx-spark-qualification-plan.mts already imports loadLlamaCppImageConfigFromRoot from the other file, so one shared helper with a maximumBytes parameter and a caller-supplied label removes the copy and keeps the traversal and symlink controls in one place.

  • scripts/checks/export-llama-cpp-image-config.mts#L828-L844: export readBoundedRegularFile and accept the size limit and the error label as parameters.
  • scripts/checks/export-llama-cpp-dgx-spark-qualification-plan.mts#L15-L31: delete the local copy and import the exported helper, passing 4096 and the protected-activation label.
🤖 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 `@scripts/checks/export-llama-cpp-image-config.mts` around lines 828 - 844,
Extract the duplicated bounded-file logic into the exported
readBoundedRegularFile in scripts/checks/export-llama-cpp-image-config.mts:
accept maximumBytes and a caller-supplied error label while preserving path
traversal, O_NOFOLLOW, regular-file, and size checks. In
scripts/checks/export-llama-cpp-dgx-spark-qualification-plan.mts, remove the
local readBoundedRegularFile implementation, import the shared helper, and call
it with 4096 and the protected-activation label.
test/llama-cpp-dgx-spark-qualification-plan.test.ts (1)

100-109: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the exact error for duplicate activation keys.

Line 108 accepts any thrown error. The duplicate profile key makes parseActivationYaml throw "llama.cpp DGX Spark activation YAML is invalid", which is a stable message. Assert it so the test proves duplicate-key rejection rather than any failure in the export path.

♻️ Proposed assertion tightening
       exportLlamaCppDgxSparkQualificationPlan(
         candidateRoot({
           activation: `${activation}profile: dgx-spark-gb10-single\n`,
           enabled: true,
         }),
       ),
-    ).toThrow();
+    ).toThrow("activation YAML is invalid");
🤖 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 `@test/llama-cpp-dgx-spark-qualification-plan.test.ts` around lines 100 - 109,
Update the duplicate-key test around exportLlamaCppDgxSparkQualificationPlan to
assert the exact stable error message “llama.cpp DGX Spark activation YAML is
invalid” rather than accepting any thrown error. Preserve the existing
candidateRoot input and duplicate profile scenario.
test/llama-cpp-dgx-spark-qualification-contract.test.ts (2)

272-276: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the exact error for the YAML alias case.

Line 276 accepts any thrown error. The neighbouring cases assert specific messages. An unrelated regression in parseLlamaCppDgxSparkQualificationActivation would still satisfy this assertion. Assert "activation YAML is invalid" so the test proves alias rejection specifically.

♻️ Proposed assertion tightening
     expect(() =>
       parseLlamaCppDgxSparkQualificationActivation(
         `contractVersion: &version 1\njobId: ${LLAMA_CPP_DGX_SPARK_QUALIFICATION_JOB_ID}\nplatform: linux/arm64\nprofile: *version\n`,
       ),
-    ).toThrow();
+    ).toThrow("activation YAML is invalid");
🤖 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 `@test/llama-cpp-dgx-spark-qualification-contract.test.ts` around lines 272 -
276, Update the alias-rejection test for
parseLlamaCppDgxSparkQualificationActivation to assert the exact error message
"activation YAML is invalid" instead of accepting any thrown error, while
preserving the existing YAML alias input and neighboring test structure.

373-384: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extend the canonicalization test to nested key order.

This test reorders only the three top-level keys. The producer in scripts/checks/export-llama-cpp-image-config.mts copies recipe.serve, recipe.policy, recipe.readiness, recipe.surfaces, and recipe.model.file verbatim from the recipe YAML, so their key order comes from the YAML author. A nested reordering case would prove that llamaCppDgxSparkExecutionPlanSha256 is stable against that input and would catch the producer-side digest coupling flagged on scripts/checks/export-llama-cpp-image-config.mts.

♻️ Proposed additional nested-order case
   it("canonicalizes execution plan field order before digest verification (`#8260`)", () => {
     const value = executionPlan();
     const reordered = {
       recipe: value.recipe,
       imageBuild: value.imageBuild,
       contractVersion: value.contractVersion,
     };
 
     expect(llamaCppDgxSparkExecutionPlanSha256(reordered)).toBe(
       llamaCppDgxSparkExecutionPlanSha256(value),
     );
+
+    const nestedReordered = {
+      ...value,
+      recipe: {
+        ...value.recipe,
+        model: {
+          ...value.recipe.model,
+          file: {
+            license: value.recipe.model.file.license,
+            quantization: value.recipe.model.file.quantization,
+            format: value.recipe.model.file.format,
+            sizeBytes: value.recipe.model.file.sizeBytes,
+            digest: value.recipe.model.file.digest,
+            path: value.recipe.model.file.path,
+          },
+        },
+      },
+    };
+
+    expect(llamaCppDgxSparkExecutionPlanSha256(nestedReordered)).toBe(
+      llamaCppDgxSparkExecutionPlanSha256(value),
+    );
   });
🤖 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 `@test/llama-cpp-dgx-spark-qualification-contract.test.ts` around lines 373 -
384, Extend the test “canonicalizes execution plan field order before digest
verification (`#8260`)” to reorder keys within nested execution-plan objects,
including recipe.serve, recipe.policy, recipe.readiness, recipe.surfaces, and
recipe.model.file. Assert that hashing the nested-reordered plan matches hashing
the original, while preserving the existing top-level key-order coverage.
test/llama-cpp-image.test.ts (1)

351-356: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the exact error for GPU-offload drift.

Line 356 accepts any thrown error. loadLlamaCppImageConfig throws from many sites, so a stale search string in the replace call would still satisfy this assertion through an unrelated error. Assert the recipe-contract message so the test proves that the offload drift is what fails.

♻️ Proposed assertion tightening
     expect(() =>
       loadLlamaCppImageConfig(
         manifestSource,
         recipeSource.replace("offload: full", "offload: partial"),
       ),
-    ).toThrow();
+    ).toThrow("invalid llama.cpp DGX Spark qualification recipe contract");
🤖 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 `@test/llama-cpp-image.test.ts` around lines 351 - 356, Update the
loadLlamaCppImageConfig assertion in the GPU-offload drift test to verify the
specific recipe-contract error message, rather than accepting any thrown error.
Keep the partial-offload mutation and ensure the assertion would fail if the
replacement no longer changes the recipe as intended.
🤖 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 @.github/workflows/e2e.yaml:
- Line 2151: Update the job-level NEMOCLAW_LLAMA_CPP_QUALIFICATION_PLAN
definition to use a path under github.workspace instead of runner.temp, matching
the managed-image-multiarch-startup pattern. In the “Materialize trusted
llama.cpp qualification plan” step, create the plan’s parent directory before
writing it; keep the plan path separate from the receipt output path.

In `@scripts/checks/export-llama-cpp-image-config.mts`:
- Around line 668-691: Update the qualification plan digest generation in
exportLlamaCppDgxSparkQualificationPlan to use the canonical parse helper
parseLlamaCppDgxSparkExecutionPlan, hashing its reconstructed plan instead of
JSON.stringify on YAML-derived pass-through objects. Derive both exported plan
values from that canonical parse so producer and verifier agree regardless of
recipe key order, and remove the createHash import if no other code uses it.

In `@scripts/checks/run-llama-cpp-dgx-spark-qualification.mts`:
- Line 708: Update cleanupOwnedRuntime’s registryListenerClosed checks to
inspect port 5000 only when the qualification-owned registry container was
active and has been removed; do not treat an unrelated listener as cleanup
failure, including in the --cleanup-only path. Preserve the existing assertion
for listeners belonging to the owned registry runtime.

In `@test/e2e/support/llama-cpp-dgx-spark-qualification-workflow.test.ts`:
- Line 35: Update the suite title in describe("llama.cpp DGX Spark qualification
workflow boundary") to include the local issue reference as a final "(`#8260`)"
suffix, without adding the reference to child it titles.

In `@test/llama-cpp-dgx-spark-qualification-plan.test.ts`:
- Around line 70-71: Update the describe title for “llama.cpp DGX Spark
qualification plan export” to include the local issue reference as a final
“(`#8260`)” suffix; the child it titles are covered by this reference, so do not
add separate suffixes to them.

In `@tools/e2e/llama-cpp-dgx-spark-qualification-workflow-boundary.mts`:
- Around line 148-167: Add exact `uses === CHECKOUT` assertions for
`candidatePlanCheckout`, `trustedCheckout`, and `candidateCheckout`, matching
the existing `trustedPlanCheckout` check. Place each assertion after its
corresponding `requireStep` lookup so all remaining checkout steps reject
different full-SHA actions.

---

Nitpick comments:
In `@scripts/checks/export-llama-cpp-image-config.mts`:
- Around line 218-244: Update parseQualificationRecipe and parseImageManifest to
reject YAML documents when either document.errors or document.warnings is
non-empty, matching parseActivationYaml’s strictness. Preserve the existing
parser-specific error messages while including both diagnostics in the thrown
errors.
- Around line 828-844: Extract the duplicated bounded-file logic into the
exported readBoundedRegularFile in
scripts/checks/export-llama-cpp-image-config.mts: accept maximumBytes and a
caller-supplied error label while preserving path traversal, O_NOFOLLOW,
regular-file, and size checks. In
scripts/checks/export-llama-cpp-dgx-spark-qualification-plan.mts, remove the
local readBoundedRegularFile implementation, import the shared helper, and call
it with 4096 and the protected-activation label.

In `@scripts/checks/run-llama-cpp-dgx-spark-qualification.mts`:
- Around line 1067-1074: Update the top-level catch around main() to retain the
caught error and append its message when it is an Error instance, while
preserving the generic failure text for other thrown values. Keep the existing
stderr output and exitCode behavior unchanged.
- Around line 205-216: Remove the tautological registryOwner comparison from the
validation condition in the workflow check, since it compares
expectedRegistryOwner(runId, runAttempt) with itself. Keep the registryName
validation and simplify the surrounding logic so it clearly validates only the
effective registry-name constraint.

In `@test/llama-cpp-dgx-spark-qualification-contract.test.ts`:
- Around line 272-276: Update the alias-rejection test for
parseLlamaCppDgxSparkQualificationActivation to assert the exact error message
"activation YAML is invalid" instead of accepting any thrown error, while
preserving the existing YAML alias input and neighboring test structure.
- Around line 373-384: Extend the test “canonicalizes execution plan field order
before digest verification (`#8260`)” to reorder keys within nested execution-plan
objects, including recipe.serve, recipe.policy, recipe.readiness,
recipe.surfaces, and recipe.model.file. Assert that hashing the nested-reordered
plan matches hashing the original, while preserving the existing top-level
key-order coverage.

In `@test/llama-cpp-dgx-spark-qualification-plan.test.ts`:
- Around line 100-109: Update the duplicate-key test around
exportLlamaCppDgxSparkQualificationPlan to assert the exact stable error message
“llama.cpp DGX Spark activation YAML is invalid” rather than accepting any
thrown error. Preserve the existing candidateRoot input and duplicate profile
scenario.

In `@test/llama-cpp-dgx-spark-qualification-runner.test.ts`:
- Around line 263-264: Replace the vacuous raw-secret-value assertion in the
test covering buildServerContainerArgv with a meaningful check: pass
recognizable API-key material through an actual builder input and assert it is
absent from argv, or remove that assertion and rely on the existing
--api-key-file check. Keep the --api-key absence assertion intact.

In `@test/llama-cpp-image.test.ts`:
- Around line 351-356: Update the loadLlamaCppImageConfig assertion in the
GPU-offload drift test to verify the specific recipe-contract error message,
rather than accepting any thrown error. Keep the partial-offload mutation and
ensure the assertion would fail if the replacement no longer changes the recipe
as intended.
🪄 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: CHILL

Plan: Enterprise

Run ID: 97b04ee1-a78f-4c4a-bce5-fe15fd07bceb

📥 Commits

Reviewing files that changed from the base of the PR and between 0d1cb93 and 9514af8.

📒 Files selected for processing (24)
  • .github/workflows/e2e.yaml
  • .github/workflows/llama-cpp-image.yaml
  • managed-inference/images/llama-cpp/image.yaml
  • scripts/checks/export-llama-cpp-dgx-spark-qualification-plan.mts
  • scripts/checks/export-llama-cpp-image-config.mts
  • scripts/checks/llama-cpp-dgx-spark-qualification-contract.mts
  • scripts/checks/run-llama-cpp-dgx-spark-qualification.mts
  • test/e2e/live/llama-cpp-dgx-spark-qualification-helpers.ts
  • test/e2e/live/llama-cpp-dgx-spark-qualification.test.ts
  • test/e2e/mock-parity.json
  • test/e2e/support/llama-cpp-dgx-spark-qualification-workflow.test.ts
  • test/helpers/vitest-watch-triggers.ts
  • test/llama-cpp-dgx-spark-qualification-contract.test.ts
  • test/llama-cpp-dgx-spark-qualification-plan.test.ts
  • test/llama-cpp-dgx-spark-qualification-runner.test.ts
  • test/llama-cpp-image.test.ts
  • test/pr-risk-plan.test.ts
  • test/vitest-watch-triggers.test.ts
  • tools/advisors/risk-plan.mts
  • tools/e2e/llama-cpp-dgx-spark-qualification-workflow-boundary.mts
  • tools/e2e/operations-workflow-boundary.mts
  • tools/e2e/prepare-e2e-workflow-boundary.mts
  • tools/e2e/upload-e2e-artifacts-workflow-boundary.mts
  • tools/e2e/workflow-boundary.mts

Comment thread .github/workflows/e2e.yaml Outdated
Comment thread scripts/checks/export-llama-cpp-image-config.mts Outdated
Comment thread scripts/checks/run-llama-cpp-dgx-spark-qualification.mts Outdated
Comment thread test/e2e/support/llama-cpp-dgx-spark-qualification-workflow.test.ts Outdated
Comment thread test/llama-cpp-dgx-spark-qualification-plan.test.ts Outdated
Comment thread tools/e2e/llama-cpp-dgx-spark-qualification-workflow-boundary.mts
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>

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

🧹 Nitpick comments (2)
test/e2e/support/llama-cpp-dgx-spark-qualification-workflow.test.ts (2)

86-98: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Test host networking and extra Buildx configuration independently.

buildx.with sets both an invalid driver and network=host. This assertion proves only that the combined object is rejected. It does not prove that the validator rejects an extra Buildx option when the driver remains valid. Use separate fixtures for host networking and unexpected Buildx configuration.

As per path instructions, review tests for behavioral confidence rather than implementation lock-in.

🤖 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 `@test/e2e/support/llama-cpp-dgx-spark-qualification-workflow.test.ts` around
lines 86 - 98, Update the test named “rejects host networking or extra Buildx
configuration” to use separate fixtures: one retaining the valid Docker driver
while setting an unexpected Buildx option, and another covering host networking
rejection. Assert each fixture against the appropriate validator result so both
behaviors are independently verified without coupling the test to implementation
details.

Source: Path instructions


63-84: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cover the Git reference pin separately.

This test changes only namedStep(...).uses to actions/checkout@main. The workflow contract also requires exact with.ref values for each checkout. Add cases that replace each with.ref with a mutable branch and assert rejection. Otherwise, a regression in the source commit pin can pass this test.

As per path instructions, review tests for behavioral confidence rather than implementation lock-in.

🤖 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 `@test/e2e/support/llama-cpp-dgx-spark-qualification-workflow.test.ts` around
lines 63 - 84, Extend the parameterized test around
validateLlamaCppDgxSparkQualificationWorkflow to cover mutable with.ref values
for each checkout step. For every relevant job/name pair, replace
namedStep(...).with.ref with a branch such as main while keeping the checkout
action pinned, then assert the validation error identifies the required
reference; retain the existing uses-pin cases.

Source: Path instructions

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

Nitpick comments:
In `@test/e2e/support/llama-cpp-dgx-spark-qualification-workflow.test.ts`:
- Around line 86-98: Update the test named “rejects host networking or extra
Buildx configuration” to use separate fixtures: one retaining the valid Docker
driver while setting an unexpected Buildx option, and another covering host
networking rejection. Assert each fixture against the appropriate validator
result so both behaviors are independently verified without coupling the test to
implementation details.
- Around line 63-84: Extend the parameterized test around
validateLlamaCppDgxSparkQualificationWorkflow to cover mutable with.ref values
for each checkout step. For every relevant job/name pair, replace
namedStep(...).with.ref with a branch such as main while keeping the checkout
action pinned, then assert the validation error identifies the required
reference; retain the existing uses-pin cases.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 2f56b317-6844-48d2-a959-7e2df194114d

📥 Commits

Reviewing files that changed from the base of the PR and between 9514af8 and b470a75.

📒 Files selected for processing (9)
  • .github/workflows/e2e.yaml
  • scripts/checks/export-llama-cpp-image-config.mts
  • scripts/checks/run-llama-cpp-dgx-spark-qualification.mts
  • test/e2e/support/e2e-cross-runtime-compatibility.test.ts
  • test/e2e/support/llama-cpp-dgx-spark-qualification-workflow.test.ts
  • test/llama-cpp-dgx-spark-qualification-plan.test.ts
  • test/llama-cpp-dgx-spark-qualification-runner.test.ts
  • test/llama-cpp-image.test.ts
  • tools/e2e/llama-cpp-dgx-spark-qualification-workflow-boundary.mts
🚧 Files skipped from review as they are similar to previous changes (4)
  • test/llama-cpp-dgx-spark-qualification-plan.test.ts
  • tools/e2e/llama-cpp-dgx-spark-qualification-workflow-boundary.mts
  • .github/workflows/e2e.yaml
  • scripts/checks/run-llama-cpp-dgx-spark-qualification.mts

@ericksoa
ericksoa merged commit 4e49bf1 into main Aug 5, 2026
113 of 118 checks passed
@ericksoa
ericksoa deleted the feat/llamacpp-dgx-spark-qualification-8260 branch August 5, 2026 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: inference Inference routing, serving, model selection, or outputs area: local-models Local model providers, downloads, launch, or connectivity feature PR adds or expands user-visible functionality platform: dgx-spark Affects DGX Spark hardware or workflows v0.0.103 Release target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant