perf(openclaw): collapse final image payload layers - #7486
Conversation
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
📝 WalkthroughWalkthroughThe Dockerfile now uses scratch payload stages and BuildKit tar extraction for OpenClaw artifacts, with directory and file metadata checks. Tests enforce payload-stage structure, ordering, metadata, patch-stage discovery, and remote-dashboard Dockerfile lifecycle rules. ChangesOpenClaw payload materialization
Remote dashboard Dockerfile contract
Estimated code review effort: 4 (Complex) | ~45 minutes Suggested labels: Sequence Diagram(s)sequenceDiagram
participant PayloadStages
participant BuildKit
participant RuntimeImage
PayloadStages->>BuildKit: provide dependency, plugin, patch, and runtime payload files
BuildKit->>RuntimeImage: mount payload filesystem and extract tar archive
RuntimeImage->>RuntimeImage: compare parent-directory ownership and mode
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage in commit 85bef6d in the TypeScript / code-coverage/cliThe overall coverage in commit 85bef6d in the Show a code coverage summary of the most impacted files.
Updated |
PR Review Advisor — InformationalAdvisor assessment: Informational / high confidence Model lanes
Nemotron output stays in workflow artifacts and does not change the assessment above. E2E guidanceAdvisory only. E2E / PR Gate selects and runs jobs independently. Recommended E2E: This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge. |
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 `@Dockerfile`:
- Around line 924-944: The runtime-payload metadata invariant omits pre-existing
directories written by the payload. In Dockerfile lines 924-944, update both
stat invocations in the runtime payload extraction to include /usr/local/share,
/usr/local/share/nemoclaw, and /scripts; update
test/openclaw-final-image-layout.test.ts lines 18-39 so the
openclaw-runtime-payload metadata expectation includes the same paths.
🪄 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: e84b1bc9-6c66-4ee8-b6d6-f1f99a9ead81
📒 Files selected for processing (4)
Dockerfileci/source-shape-test-budget.jsontest/node-tar-dockerfile-contract.test.tstest/openclaw-final-image-layout.test.ts
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
|
Maintainer follow-up: #7497 is now open to make repository-root No branch churn is requested here while that prerequisite is under review. Once #7497 lands, I plan to sync this branch normally to current |
<!-- markdownlint-disable MD041 --> ## Summary Repository-root `Dockerfile` changes now select the cold `full-e2e` path in addition to `cloud-onboard`. This supplies the deterministic validation prerequisite for #7486, whose final-image layer collapse must be exercised through a cold build, onboard, readiness check, and real first turn before it can address the performance failures tracked in #6660. ## Related Issue Related to #6660 ## Changes - add a narrow `openclaw-image` risk family that matches only the repository-root `Dockerfile` and requires `full-e2e` - retain the existing `platform-install` and `cloud-onboard` floor for `Dockerfile.base` without expanding full E2E to that adjacent root image definition - advance the deterministic risk-plan version from 4 to 5 because selector semantics changed - add an exact positive/negative regression and document the contributor-facing selection floor ## 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: independent nine-category review of exact current-main head `0469bf9b5` returned GO with no findings; fork gating, authorization, exact head/base/workflow binding, version/hash reconstruction, job inventory, credential surfaces, and bounded fanout were traced, and risk-plan/controller tests passed 90/90 - [ ] Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: ## Documentation Writer Review - [x] Documentation writer subagent reviewed the completed changes - Result: `docs-updated` - Evidence: `test/e2e/README.md`; exact-head review confirmed the text matches the v5 rule and regression, precisely scopes repository-root `Dockerfile.base`, and requires no additional Fern/user-facing page changes - Agent: Codex Desktop <!-- docs-review-head-sha: 0469bf9 --> <!-- docs-review-agents-blob-sha: 9c9b36d --> ## DGX Station Hardware Evidence - [ ] Tested on DGX Station - Tested commit: - Station profile/scenario: - Result: - Supporting evidence: ## Verification - [x] PR description includes a `Signed-off-by:` line and every commit appears as `Verified` in GitHub - [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or `npm run check:diff` passed when hooks were skipped or unavailable - [x] Targeted behavior tests pass for the current change set, or tests are marked not applicable above — exact current-main `npx vitest run --project integration test/pr-risk-plan.test.ts test/pr-e2e-gate.test.ts` (90/90), `npm run check:diff`, CLI build, and CLI typecheck - [ ] Applicable broad gate passed — fresh pull-request CI is running for exact current-main head `0469bf9b5` - [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) - [ ] Doc pages follow the [style guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md) (doc changes only) - [ ] New doc pages include SPDX header and frontmatter (new pages only) --- Signed-off-by: Aaron Erickson <aerickson@nvidia.com> --------- Signed-off-by: Aaron Erickson <aerickson@nvidia.com> Signed-off-by: Apurv Kumaria <akumaria@nvidia.com> Co-authored-by: Apurv Kumaria <akumaria@nvidia.com>
|
Maintainer validation update for exact head
Ordinary CI has no failure; one CLI coverage shard and the protected E2E coordination check remain in progress. |
|
Exact-head performance evidence is now available from child run 30121533570, Cold-path result:
|
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
|
Current-main integration checkpoint: exact head
Fresh ordinary CI, x86/arm64 image builds, and the protected four-job E2E plan are now running for this exact head/base. No waiver or skipped gate is being requested. |
|
Terminal exact-head receipt for
Current |
ericksoa
left a comment
There was a problem hiding this comment.
Approved at exact head 85bef6d9e33185b808e0e9a73d239a676621645b. The signed current-main merge is exact, the reviewed six-file feature patch is unchanged, local 98/98 plus check:diff passed, independent docs/security reviews are current, x86/arm64 and downstream image checks passed, and protected plan ec315298… passed all four selected jobs with objective cold-path budgets green. The two post-dispatch main commits were separately proven clean and non-interacting with the explicit OpenClaw payload allowlists.
<!-- markdownlint-disable MD041 --> ## Summary Adds the canonical pre-tag `## v0.0.95` release entry to `docs/changelog/2026-07-24.mdx`, before the existing v0.0.94 entry. The entry summarizes approved user-visible changes merged since v0.0.94 and excludes internal-only prerequisites. ## Changes - Adds the v0.0.95 summary and detailed bullets for gateway lifecycle, recovery, state transfer, inference compatibility, sandbox security, Discord policy, and E2E evidence. - Links each user-facing theme to the most specific published documentation. - Records the release entry in the shared native changelog used by the OpenClaw, Hermes, and Deep Agents guides. Source summary: - [#7246](#7246), [#7228](#7228), [#7267](#7267), [#7489](#7489), [#7509](#7509), [#7351](#7351), and [#7290](#7290) -> `docs/changelog/2026-07-24.mdx`: Gateway authority, forward teardown and retry, managed recovery, Hermes restart recovery, scoped uninstall, and orphan-aware backup behavior. - [#7344](#7344) and [#7416](#7416) -> `docs/changelog/2026-07-24.mdx`: Atomic SQLite restore and host download verification. - [#7476](#7476), [#7347](#7347), [#7281](#7281), [#7485](#7485), [#7491](#7491), and [#7422](#7422) -> `docs/changelog/2026-07-24.mdx`: Windows Ollama reuse, CDI fallback, bounded OpenRouter connection setup, Nemotron-3 request compatibility, and managed Deep Agents retry and provider-error behavior. - [#6884](#6884), [#7481](#7481), [#6878](#6878), [#7467](#7467), [#7502](#7502), [#7503](#7503), [#7504](#7504), and [#7486](#7486) -> `docs/changelog/2026-07-24.mdx`: Trusted base-image overrides, local rebuild images, runtime validation, config preservation, reviewed package updates, and fewer final-image payload layers. - [#7303](#7303) -> `docs/changelog/2026-07-24.mdx`: Scoped Discord application-command management. - [#7488](#7488), [#7465](#7465), [#7497](#7497), [#7464](#7464), [#7501](#7501), [#7494](#7494), and [#7493](#7493) -> `docs/changelog/2026-07-24.mdx`: Selected-test risk signals, retry cleanup, full root-image validation, direct-main Hermes setup, executed PR-gate evidence, nightly history, and runner wait reporting. - [#7447](#7447) is an internal pinned-runtime prerequisite and is intentionally excluded from canonical supported-integration documentation. - [#7370](#7370) adds maintainer-only advisory reconciliation tooling and does not change supported user behavior. - [#7495](#7495) updates existing documentation and does not add a new v0.0.95 behavior claim. ## Type of Change - [ ] Code change (feature, bug fix, or refactor) - [ ] Code change with doc updates - [x] Doc only (prose changes, no code sample modifications) - [ ] Doc only (includes code sample changes) ## Quality Gates - [ ] Tests added or updated for changed behavior - [x] Existing tests cover changed behavior — justification: `test/changelog-docs.test.ts` validates the dated changelog structure, heading uniqueness, and published links. - [ ] Tests not applicable — justification: - [x] Docs updated for user-facing behavior changes - [ ] Docs not applicable — justification: - [ ] 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: - [ ] Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: ## Documentation Writer Review - [x] Documentation writer subagent reviewed the completed changes - Result: `docs-updated` - Evidence: `docs/changelog/2026-07-24.mdx`; writing rules, documentation style, factual release meaning, and published links reviewed at exact head `58b02f2bf`. - Agent: Codex documentation writer reviewer <!-- docs-review-head-sha: 58b02f2 --> <!-- docs-review-agents-blob-sha: 9c9b36d --> ## DGX Station Hardware Evidence - [ ] Tested on DGX Station - Tested commit: - Station profile/scenario: - Result: - Supporting evidence: ## Verification - [x] PR description includes a `Signed-off-by:` line and every commit appears as `Verified` in GitHub - [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or `npm run check:diff` passed when hooks were skipped or unavailable - [x] Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result or justification: `npx vitest run test/changelog-docs.test.ts` passed 6 tests. - [ ] Applicable broad gate passed — `npm test` for broad runtime/test-harness changes; `npm run check` for repo-wide validation/coverage changes — command/result: - [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 passed with 0 errors and 2 Fern warnings. - [x] Doc pages follow the [style guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md) (doc changes only) - [ ] New doc pages include SPDX header and frontmatter (new pages only) --- Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Added a new v0.0.95 changelog entry above v0.0.94. * Documented improved externally supervised gateway lifecycle ownership. * Improved snapshot restore reliability and SQLite state handling. * Tightened CLI `backup-all` behavior and host artifact verification. * Updated Windows onboarding guidance (including Ollama service reuse and CDI directory fallback). * Noted inference compatibility fixes, deeper agent failure classification, stricter base-image validation, updated Discord bot command permissions, and refined E2E release automation evidence handling. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
<!-- markdownlint-disable MD041 --> ## Summary A normal `0002` checkout can stage executable Docker payloads as `0775`, so the exact metadata gate added by #7486 aborts a sandbox replacement build. This change clears group and other write bits while preserving owner write and executable intent, so permissive and restrictive source modes both produce canonical Docker payload modes without weakening the gate. ## Changes - Clear group and other write bits in `normalizeReadModesForDockerCopy()` before adding the read, traverse, and executable permissions required by Docker. - Cover optimized and legacy staging with `0775` directory and executable fixtures plus a `0664` non-executable fixture. The tests assert exact staged modes of `0755` and `0644`. - Retain coverage that normalizes restrictive `0700` directories and executables plus `0600` ordinary files. - Confirm the regression history: #3664 introduced read-mode normalization, #7072 applied it to scripts with restrictive-mode coverage, #7332 added `patch-bundled-npm-tar.mts`, and #7486 made its preserved `0775` mode fail the exact `0755` assertion. - Validate the fix on Brev instance `nc-july26` from base SHA `3b2f6d557`. A transactional rebuild with `0775` and `0664` source inputs completed the strict payload metadata stage, replacement creation, state restore, policy restore, and deployment health checks. ## Type of Change - [x] 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 - [x] Tests added or updated for changed behavior - [ ] Existing tests cover changed behavior — justification: - [ ] Tests not applicable — justification: - [ ] Docs updated for user-facing behavior changes - [x] Docs not applicable — justification: The fix restores the existing staged-payload permission contract and does not change commands, configuration, or supported workflows. - [x] 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: - [ ] Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: ## Documentation Writer Review - [x] Documentation writer subagent reviewed the completed changes - Result: `no-docs-needed` - Evidence: No documentation files changed. The fix restores canonical staged modes without changing commands, configuration, or supported workflows. The reviewer found no actionable wording issues. - Agent: Codex Desktop <!-- docs-review-head-sha: 14967c5 --> <!-- docs-review-agents-blob-sha: 9c9b36d --> ## DGX Station Hardware Evidence - [ ] Tested on DGX Station - Tested commit: - Station profile/scenario: - Result: - Supporting evidence: ## Verification - [x] PR description includes a `Signed-off-by:` line and every commit appears as `Verified` in GitHub - [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or `npm run check:diff` passed when hooks were skipped or unavailable - [x] Targeted behavior tests pass for the current change set, or tests are marked not applicable above — `npx vitest run test/sandbox-build-context.test.ts src/lib/onboard/build-context-stage.test.ts src/lib/actions/sandbox/rebuild-managed-image-preparation.test.ts` (22/22 passed); `npm run typecheck:cli` passed; Brev `nc-july26` rebuild passed the strict Docker payload metadata stage and completed successfully. - [ ] Applicable broad gate passed — `npm test` for broad runtime/test-harness changes; `npm run check` for repo-wide validation/coverage changes — command/result: - [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) - [ ] Doc pages follow the [style guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md) (doc changes only) - [ ] New doc pages include SPDX header and frontmatter (new pages only) --- Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com> Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
Summary
Current-main
full-e2ecompleted functionally but spent 108.1 seconds exporting the final OpenClaw image, pushing the sandbox phase to 200.2 seconds against its 171-second budget. This change collapses repository-owned final-image payloads from 39COPYlayers to four materialization layers while preserving the three intentional direct-copy boundaries, reducing the final repository layer count from 42 to seven.Related Issue
Related to #6660
Changes
COPYinstructions are insufficient here because every instruction produces another exported image layer even when the functional build work is already complete.COPYboundaries so Node replacement, dependency installation, and the completed-image security scan retain their existing cache and review semantics.Type of Change
Quality Gates
85bef6d9e; the signed merge tree is exact and the six-file feature patch is unchanged. Fresh exact-head x86/arm64 image builds and protected E2E remain required before merge.Documentation Writer Review
no-docs-neededDGX Station Hardware Evidence
Verification
Signed-off-by:line and every commit appears asVerifiedin GitHubpre-commit,commit-msg, andpre-pushhooks passed, ornpm run check:diffpassed when hooks were skipped or unavailablenpx vitest run --project integration test/openclaw-final-image-layout.test.ts test/node-tar-dockerfile-contract.test.ts test/sandbox-provisioning-helper-permissions.test.ts test/messaging-runtime-preload-packaging.test.ts test/runner.test.ts test/openclaw-dependency-review.test.ts test/openclaw-version-parser.test.ts test/sandbox-build-context.test.ts(98/98 passed)npm testfor broad runtime/test-harness changes;npm run checkfor repo-wide validation/coverage changes — command/result:npm run docsbuilds without warnings (doc changes only)Signed-off-by: Apurv Kumaria akumaria@nvidia.com
Summary by CodeRabbit
Bug Fixes
Tests
Chores / Compatibility