refactor(onboard): extract dockerfile patch flow#5154
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThis PR refactors sandbox Dockerfile patching to improve security and reusability. Symlink-safe file operations with ChangesSandbox Dockerfile Patching Refactor
Sequence DiagramsequenceDiagram
participant createSandbox
participant prepareSandboxDockerfilePatch
participant pullAndResolveBaseImageDigest
participant inspectDockerImage
participant enforceDockerGpuPatchPreserveNetwork
participant patchStagedDockerfile
createSandbox->>prepareSandboxDockerfilePatch: call with stagedDockerfile, agent, provider, etc.
alt agent present and custom Dockerfile
prepareSandboxDockerfilePatch->>pullAndResolveBaseImageDigest: resolve base image digest
alt resolution succeeds
pullAndResolveBaseImageDigest-->>prepareSandboxDockerfilePatch: return resolved digest
prepareSandboxDockerfilePatch->>inspectDockerImage: verify image available
else resolution fails
pullAndResolveBaseImageDigest-->>prepareSandboxDockerfilePatch: error
prepareSandboxDockerfilePatch->>inspectDockerImage: check :latest fallback
alt :latest exists
inspectDockerImage-->>prepareSandboxDockerfilePatch: cached
prepareSandboxDockerfilePatch-->>prepareSandboxDockerfilePatch: warn cached fallback
else :latest missing
prepareSandboxDockerfilePatch-->>prepareSandboxDockerfilePatch: warn with docker pull command
end
end
else default Dockerfile or no agent
prepareSandboxDockerfilePatch-->>prepareSandboxDockerfilePatch: skip resolution
end
prepareSandboxDockerfilePatch->>enforceDockerGpuPatchPreserveNetwork: enforce GPU patch
prepareSandboxDockerfilePatch->>patchStagedDockerfile: patch with resolved base ref or null
patchStagedDockerfile-->>prepareSandboxDockerfilePatch: return patched result
prepareSandboxDockerfilePatch-->>createSandbox: return { buildId, resolvedBaseImage }
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested Labels
Suggested Reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
E2E Advisor RecommendationRequired E2E: Dispatch hint: Auto-dispatched E2E: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
Dispatch hint
|
Vitest E2E Scenario RecommendationRequired Vitest E2E scenarios: Dispatch required Vitest E2E scenarios:
Full Vitest E2E advisor summaryVitest E2E Scenario AdvisorBase: Required Vitest E2E scenarios
Optional Vitest E2E scenarios
Relevant changed files
|
PR Review AdvisorFindings: 0 needs attention, 0 worth checking, 0 nice ideas Consider writing more tests for
This is an automated advisory review. A human maintainer must make the final merge decision. |
Selective E2E Results — ❌ Some jobs failedRun: 27289825954
|
# Conflicts: # src/lib/onboard.ts
# Conflicts: # src/lib/onboard.ts
# Conflicts: # src/lib/onboard.ts
# Conflicts: # src/lib/onboard.ts # src/lib/onboard/dockerfile-patch.ts
# Conflicts: # src/lib/onboard.ts
…-flow' into codex/pr-5154-update
Selective E2E Results — ❌ Some jobs failedRun: 27363626432
|
1 similar comment
Selective E2E Results — ❌ Some jobs failedRun: 27363626432
|
Selective E2E Results — ✅ All requested jobs passedRun: 27363626432
|
# Conflicts: # src/lib/onboard.ts
…-flow' into codex/pr-5154-update
Selective E2E Results — ❌ Some jobs failedRun: 27376842024
|
1 similar comment
Selective E2E Results — ❌ Some jobs failedRun: 27376842024
|
Selective E2E Results — ✅ All requested jobs passedRun: 27376842024
|
# Conflicts: # src/lib/onboard.ts
Selective E2E Results — ❌ Some jobs failedRun: 27380825270
|
1 similar comment
Selective E2E Results — ❌ Some jobs failedRun: 27380825270
|
Selective E2E Results — ❌ Some jobs failedRun: 27380825270
|
Selective E2E Results — ✅ All requested jobs passedRun: 27380825270
|
Summary
Extracts the
createSandboxDockerfile patch flow into a focused helper. This keeps base-image resolution, cached-base warnings, Docker-driver GPU network preservation, build id allocation, andpatchStagedDockerfileinvocation together while preserving the existing sandbox create path.Related Issue
Refs #3802
Changes
prepareSandboxDockerfilePatchinsrc/lib/onboard/sandbox-dockerfile-patch-flow.ts.createSandboxwith the new helper.O_NOFOLLOW, validate regular files, and truncate only after descriptor validation.Type of Change
Verification
Local targeted checks run:
npx @biomejs/biome format --write src/lib/onboard.ts src/lib/onboard/sandbox-dockerfile-patch-flow.ts src/lib/onboard/sandbox-dockerfile-patch-flow.test.ts src/lib/onboard/dockerfile-patch.ts src/lib/onboard/dockerfile-patch-security.test.tsnpx @biomejs/biome lint src/lib/onboard.ts src/lib/onboard/sandbox-dockerfile-patch-flow.ts src/lib/onboard/sandbox-dockerfile-patch-flow.test.ts src/lib/onboard/dockerfile-patch.ts src/lib/onboard/dockerfile-patch-security.test.tsnpm run build:clinpm run typecheck:clinpx vitest run src/lib/onboard/sandbox-dockerfile-patch-flow.test.ts src/lib/onboard/dockerfile-patch.test.ts src/lib/onboard/dockerfile-patch-security.test.ts src/lib/onboard/dockerfile-patch-extra-agents.test.ts src/lib/onboard/docker-gpu-local-inference.test.ts test/onboard.test.tsgit diff --checkGitHub PR checks on
b793d635beda48a752c666fab0d7e2a7407e4bf8:27289383817reported no needs-attention / worth-checking / nice-idea findings in the job log. Its PR comment update hit a GitHub REST 401, so the visible advisor comment may be stale.Live validation:
cloud-onboard-e2eandopenclaw-onboard-security-posture-e2epassed in nightly run https://github.com/NVIDIA/NemoClaw/actions/runs/27289825954.ubuntu-repo-cloud-openclawpassed in scenario run https://github.com/NVIDIA/NemoClaw/actions/runs/27289825667.openclaw-plugin-runtime-exdev-e2ewas not a nightly job, so it was dispatched throughregression-e2e.yaml; run https://github.com/NVIDIA/NemoClaw/actions/runs/27289920782 failed after fresh onboard completed with the known OpenClaw plugin runtime-deps EXDEV signature (EXDEV: cross-device link not permitted,/dev/shm/.../node_modules->/sandbox/.openclaw/plugin-runtime-deps/.../node_modules). This is the existing [Ubuntu 22.04][Agent] openclaw CLI fails to start in sandbox — plugin runtime install errors #3513/EXDEV: cross-device link not permitted — plugin installer fails when /tmp is overlay and /sandbox is ext4 #3127 runtime-deps guard failure and is outside this PR's changed files.Local broad-hook note:
Full
npx prek run --all-filesremains blocked locally by the unrelatedtest/release-latest-tag.test.tsfixture commit signing failure (/home/cvillela/.ssh/git-signing-key.pubmissing private key). This PR does not touch that release test file.npx prek run --all-filespassesnpm testpassesTests added or updated for new or changed behavior
No secrets, API keys, or credentials committed
Docs updated for user-facing behavior changes
npm run docsbuilds 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: Carlos Villela cvillela@nvidia.com
Summary by CodeRabbit
Bug Fixes
Tests