fix(cli): rebuild sandboxes from locally built base images - #7481
Conversation
Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
📝 WalkthroughWalkthroughTemporary rebuild image tags are recognized as content-addressed references. Base-image onboarding validates handoff provenance, while rebuild preflight derives, reuses, or recreates trusted local overrides and preserves stable outer resolution metadata. ChangesSandbox rebuild base-image handoff
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant ensureRebuildAgentBaseImage
participant ensureAgentBaseImage
participant bindLocalAgentBaseImageHandoffToResolution
participant resolveSandboxBaseImage
ensureRebuildAgentBaseImage->>ensureAgentBaseImage: Resolve or force local rebuild
ensureAgentBaseImage-->>ensureRebuildAgentBaseImage: Return image and metadata
ensureRebuildAgentBaseImage->>bindLocalAgentBaseImageHandoffToResolution: Validate handoff provenance
bindLocalAgentBaseImageHandoffToResolution-->>ensureRebuildAgentBaseImage: Return trusted local override
ensureRebuildAgentBaseImage->>resolveSandboxBaseImage: Resolve trusted handoff ref
resolveSandboxBaseImage-->>ensureRebuildAgentBaseImage: Return local resolution
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage in commit d18d410 in the TypeScript / code-coverage/cliThe overall coverage in commit d18d410 in the Show a code coverage summary of the most impacted files.
Updated |
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/sandbox-base-image-resolution.test.ts`:
- Around line 334-348: Ensure both test sites clean up test doubles on success
and failure: in src/lib/sandbox-base-image-resolution.test.ts lines 334-348,
reset dockerMocks.imageInspectFormat after the assertion; in
src/lib/actions/sandbox/rebuild-flow-helpers.test.ts lines 269-281, reset
baseImageMocks.inspectLocalImageMetadata and restore every spy returned by
mockBaseImagePreflight inside a finally block.
🪄 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: 1b30339d-b073-4b30-ae4c-3f4d13d1b823
📒 Files selected for processing (4)
src/lib/actions/sandbox/rebuild-flow-helpers.test.tssrc/lib/actions/sandbox/rebuild-flow-helpers.tssrc/lib/sandbox-base-image-resolution.test.tssrc/lib/sandbox-base-image.ts
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: 1 optional E2E recommendation
This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge. |
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
Signed-off-by: Aaron Erickson <aerickson@nvidia.com> (cherry picked from commit 2aa9969)
|
Maintainer hardening update for exact head
Code is GO for exact-head CI. Merge remains gated on the new CI run and Docker/offline E2E evidence for this head. |
Signed-off-by: Aaron Erickson <aerickson@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-handoff.test.ts`:
- Around line 102-125: Remove the explicit if statement from the
dockerMocks.imageInspectFormat mock implementation. Preserve the non-JSON
behavior by folding the format check into the returned expression, using the
existing ternary logic so the mock remains functionally identical and the test
body stays linear.
🪄 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: 8a52bea9-be2a-411b-afe0-5aa1fd100aea
📒 Files selected for processing (12)
src/lib/actions/sandbox/rebuild-agent-base-image-preflight.test.tssrc/lib/actions/sandbox/rebuild-flow-helpers.test.tssrc/lib/actions/sandbox/rebuild-flow-helpers.tssrc/lib/agent/base-image-handoff.test.tssrc/lib/agent/base-image.test.tssrc/lib/agent/base-image.tssrc/lib/agent/onboard.tssrc/lib/onboard/base-image-resolution-flow.test.tssrc/lib/onboard/base-image-resolution-flow.tssrc/lib/sandbox-base-image-resolution.test.tssrc/lib/sandbox-base-image.tstest/helpers/base-image-test-harness.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/lib/sandbox-base-image-resolution.test.ts
|
Exact-head follow-up for |
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
|
Exact-head CI repair is now published at The prior CLI shard failure was deterministic test-fixture drift, not a production or Docker/runtime regression: the shared rebuild harness modeled a successful local build with a mutable tag, missing display name, and incomplete trust lease. Follow-up Fresh validation: original failing/lease set 26/26, all shared-harness consumers 63/63, CLI typecheck passed, and exact-final-head |
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 `@test/helpers/rebuild-flow-harness.ts`:
- Around line 287-288: Update createRebuildFlowHarness so the content-addressed
agentBaseImageRef and valid trustedLocalOverride are supplied only for explicit
local-handoff scenarios, including the required Hermes case. Preserve the
existing "openclaw" default and omit these local fixture values for non-local
and negative-path invocations so trust-validation branches remain exercised.
🪄 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: 190c3881-fcb5-4fc2-8ea5-74887230b952
📒 Files selected for processing (2)
src/lib/actions/sandbox/rebuild-dcode-base-image-lease.test.tstest/helpers/rebuild-flow-harness.ts
|
Direct exact-head runtime evidence: The selected matrix also has |
prekshivyas
left a comment
There was a problem hiding this comment.
Reviewed PR SHA d18d410b5 against base SHA 88b3e35e8. The handoff parser rejects malformed refs. Preflight binds trust only from the exact reused local resolution and matching image, platform, and provenance data. Fresh fallback metadata forces one repository build and uses its in-memory lease. All nine security categories pass, and no code findings remain.
I accept E2E / PR Gate Coordination as a scoped exception. The selected full-e2e job completed its functional contract and exceeded only the cold-onboard performance budget tracked in #6660. Exact-head upgrade-stale-sandbox, hermes-e2e, onboard-repair, onboard-resume, and state-backup-restore pass.
<!-- 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>
Summary
Rebuilding a Hermes sandbox originally created with
NEMOCLAW_SANDBOX_BASE_LOCAL_BUILD=1could reject its local base-image handoff or rebuild the base again after an upgrade. The rebuild now carries local authority only from an exact reused resolution or a fresh in-memory build lease, preserves the stable resolution metadata through recreate, and fails before sandbox mutation if that proof changes.Related Issue
Fixes #7477
Changes
image-<sha256>refs and exactrebuild-<pid>-<nonce>-image-<sha256>handoffs. The shared parser is required by the resolver, preflight binder, and cleanup path so those consumers cannot drift;src/lib/agent/base-image-handoff.test.tsandsrc/lib/sandbox-base-image-resolution.test.tsprotect the grammar and moved-tag cases.Type of Change
Quality Gates
d18d410b5; see fix(cli): rebuild sandboxes from locally built base images #7481 (comment). Exact-head hosted and Docker/offline E2E remain required before merge.Documentation Writer Review
no-docs-neededCodex DesktopDGX 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 unavailablenpm run check:diffpassed.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: Tinson Lai tinsonl@nvidia.com
Signed-off-by: Aaron Erickson aerickson@nvidia.com
Summary by CodeRabbit