Skip to content

refactor(ci): share sandbox base-image resolver primitives - #6968

Merged
cv merged 12 commits into
NVIDIA:mainfrom
HOYALIM:codex/issue-6957-base-image-resolver
Jul 16, 2026
Merged

refactor(ci): share sandbox base-image resolver primitives#6968
cv merged 12 commits into
NVIDIA:mainfrom
HOYALIM:codex/issue-6957-base-image-resolver

Conversation

@HOYALIM

@HOYALIM HOYALIM commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • extract shared image pull, digest, glibc, candidate iteration, local-build, and GitHub environment mechanics into a narrow Bash helper
  • keep OpenClaw version/input-change policy and Hermes digest/layout/MCP trust checks explicit in their existing composite actions
  • add shell-contract coverage for remote compatibility, incompatible or missing glibc, missing digest, agent-owned rejection, candidate exhaustion, local fallback, and environment output validation

Closes #6957.

Validation

  • bash -n .github/actions/base-image-resolver.sh
  • npx vitest run --project integration test/base-image-resolver-helper.test.ts (6 passed)
  • npm run build:cli
  • npm run typecheck
  • npm run test-size:check
  • npm run check:diff

DCO

I certify that all commits in this pull request are signed off in accordance with the Developer Certificate of Origin.

Signed-off-by: Prekshi Vyas prekshiv@nvidia.com

Summary by CodeRabbit

  • Improvements
    • Refactored sandbox and Hermes base-image resolution to use shared helper logic for pulling, digest validation, and GLIBC compatibility checks.
    • Updated candidate selection to try alternatives automatically until a compatible image is found.
    • Tightened how the resolved base image is written to workflow environment variables, with stricter format validation.
  • Tests
    • Added a comprehensive test suite for the shared resolver helper (GLIBC checks, digest extraction, candidate iteration, local build args, and env output validation).
    • Adjusted a workflow contract test to set the action path for the Hermes resolver step.

Signed-off-by: Ho Lim subhoya@gmail.com

Copilot AI review requested due to automatic review settings July 15, 2026 18:22
@copy-pr-bot

copy-pr-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Shared base-image resolution logic is moved into a reusable shell helper. Sandbox and Hermes actions use it for image validation, candidate selection, local builds, and environment output, with Vitest coverage for the helper contracts.

Changes

Base-image resolution

Layer / File(s) Summary
Shared resolver primitives
.github/actions/base-image-resolver.sh
Adds reusable helpers for GLIBC validation, image pulling and digest inspection, candidate iteration, local builds, and validated GITHUB_ENV writes.
Composite action integration
.github/actions/resolve-hermes-base-image/action.yaml, .github/actions/resolve-sandbox-base-image/action.yaml, test/pr-workflow-contract.test.ts
Updates both actions to source the helper and use it for remote candidates, local fallbacks, GLIBC checks, and environment assignments; the workflow contract supplies GITHUB_ACTION_PATH for Hermes execution.
Helper contract tests
test/base-image-resolver-helper.test.ts
Tests Docker interactions, digest filtering, GLIBC compatibility, candidate exhaustion, local builds, and environment validation.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CompositeAction
  participant ResolverHelper
  participant Docker
  participant GITHUB_ENV
  CompositeAction->>ResolverHelper: Try candidate image
  ResolverHelper->>Docker: Pull and inspect image
  Docker-->>ResolverHelper: Digest and GLIBC version
  ResolverHelper-->>CompositeAction: Accept compatible candidate
  CompositeAction->>ResolverHelper: Write validated image reference
  ResolverHelper->>GITHUB_ENV: Append environment assignment
Loading

Possibly related issues

Possibly related PRs

  • NVIDIA/NemoClaw#4082 — Also changes sandbox base-image candidate generation and selection logic.

Suggested labels: area: ci, chore

Suggested reviewers: cv, laitingsheng, cjagwani

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The shared helper extraction and action refactors match #6957, and the added tests cover the required resolver and fallback behaviors.
Out of Scope Changes check ✅ Passed The changes stay focused on shared resolver primitives, action wiring, and supporting tests, with no obvious unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the shared CI base-image resolver refactor and matches the main change in the PR.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — Informational

Advisor assessment: Informational / high confidence
Next action: No advisor follow-up needed.
Findings: 0 blockers · 0 warnings · 0 suggestions
Status: No actionable findings remain in the canonical review ledger.

Model lanes

  • GPT-5.6 Terra (primary): Completed · high confidence · 0 blockers · 0 warnings · 0 suggestions
  • Nemotron 3 Ultra (second opinion): Completed · high confidence · 0 blockers · 0 warnings · 0 suggestions
  • Model comparison: normalized findings match; normalized E2E selections differ; severity counts match.

Nemotron output stays in workflow artifacts and does not change the assessment above.

E2E guidance

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

Recommended E2E: None

2 optional E2E recommendations
  • rebuild-hermes
  • sandbox-rebuild

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: 2

🤖 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/actions/resolve-hermes-base-image/action.yaml:
- Line 65: Propagate resolver_write_env failures so candidate-selection
callbacks do not report success without exporting the required variable: in
.github/actions/resolve-hermes-base-image/action.yaml lines 65-65, return
failure when writing HERMES_BASE_IMAGE fails; apply the equivalent change in
.github/actions/resolve-sandbox-base-image/action.yaml lines 40-40 for
BASE_IMAGE.

In `@test/base-image-resolver-helper.test.ts`:
- Around line 102-117: Add assertions in the “writes one validated GitHub
environment assignment” test for empty and multiline BASE_IMAGE values,
verifying each invocation fails and the existing GITHUB_ENV contents remain
unchanged. Exercise these cases through resolver_write_env and assert only the
observable command status and file output.
🪄 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: 7303e8af-e0ce-47ae-96e3-47f70203649d

📥 Commits

Reviewing files that changed from the base of the PR and between 3c9159f and 2d2ff5c.

📒 Files selected for processing (4)
  • .github/actions/base-image-resolver.sh
  • .github/actions/resolve-hermes-base-image/action.yaml
  • .github/actions/resolve-sandbox-base-image/action.yaml
  • test/base-image-resolver-helper.test.ts

Comment thread .github/actions/resolve-hermes-base-image/action.yaml Outdated
Comment thread test/base-image-resolver-helper.test.ts
@HOYALIM
HOYALIM force-pushed the codex/issue-6957-base-image-resolver branch from 2d2ff5c to 9b07ee2 Compare July 15, 2026 19:11

@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: 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/base-image-resolver-helper.test.ts`:
- Around line 88-99: Update the fakeDocker command and assertion around run to
preserve argument boundaries: log each positional argument from "$@" using a
delimiter rather than joining "$*". Assert the resulting delimited argument
vector, including the Dockerfile path, tag, and build context as separate
arguments.
🪄 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: f52b119d-c178-47da-af2c-573a75b511d2

📥 Commits

Reviewing files that changed from the base of the PR and between 2d2ff5c and 9b07ee2.

📒 Files selected for processing (4)
  • .github/actions/base-image-resolver.sh
  • .github/actions/resolve-hermes-base-image/action.yaml
  • .github/actions/resolve-sandbox-base-image/action.yaml
  • test/base-image-resolver-helper.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • .github/actions/resolve-sandbox-base-image/action.yaml
  • .github/actions/base-image-resolver.sh
  • .github/actions/resolve-hermes-base-image/action.yaml

Comment thread test/base-image-resolver-helper.test.ts Outdated
@HOYALIM
HOYALIM force-pushed the codex/issue-6957-base-image-resolver branch from 9b07ee2 to d4997c6 Compare July 15, 2026 20:10

@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: 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/base-image-resolver-helper.test.ts`:
- Line 34: Update the suite title in the “base image resolver helper” describe
block to append the local issue reference as the final “(`#6957`)” suffix, without
changing child test titles.
🪄 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: 7e225953-7178-41e9-84c5-3ef51509e8d4

📥 Commits

Reviewing files that changed from the base of the PR and between 9b07ee2 and d4997c6.

📒 Files selected for processing (4)
  • .github/actions/base-image-resolver.sh
  • .github/actions/resolve-hermes-base-image/action.yaml
  • .github/actions/resolve-sandbox-base-image/action.yaml
  • test/base-image-resolver-helper.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • .github/actions/resolve-sandbox-base-image/action.yaml
  • .github/actions/resolve-hermes-base-image/action.yaml
  • .github/actions/base-image-resolver.sh

Comment thread test/base-image-resolver-helper.test.ts Outdated
HOYALIM added 4 commits July 15, 2026 13:21
Signed-off-by: Ho Lim <subhoya@gmail.com>
Signed-off-by: Ho Lim <subhoya@gmail.com>
Signed-off-by: Ho Lim <subhoya@gmail.com>
Signed-off-by: Ho Lim <subhoya@gmail.com>
@HOYALIM
HOYALIM force-pushed the codex/issue-6957-base-image-resolver branch from d4997c6 to e2596ad Compare July 15, 2026 20:21
@prekshivyas prekshivyas self-assigned this Jul 16, 2026

@prekshivyas prekshivyas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the shared shell helper extraction against both resolver actions. Agent-specific validation remains local, shared behavior is preserved, environment writes are validated, and helper tests cover the extracted contracts. No blocking findings.

Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>

@prekshivyas prekshivyas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the current head after syncing main. The workflow contract now supplies the standard GITHUB_ACTION_PATH when executing the composite step directly; helper coverage passes and the Linux CI path retains the existing Bash behavior.

Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>

@prekshivyas prekshivyas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed at ae51f85: the Linux CI timeout is fixed by replacing the nested Node fake-Docker process with a deterministic Bash harness; the composite action is now Bash 3-compatible as well. Focused workflow-contract test, shell syntax, CLI build and typecheck pass.

Signed-off-by: Ho Lim <subhoya@gmail.com>

@prekshivyas prekshivyas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed at d552e19: the follow-up only simplifies parsing of the NUL-delimited fake-Docker log while preserving the verified Bash harness and current-operation behavior.

Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>

@prekshivyas prekshivyas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed at df150e3: the sandbox composite action now runs end-to-end under a fake Docker contract with its real GITHUB_ACTION_PATH and verifies the exact BASE_IMAGE export. The focused seven-test resolver suite, CLI build/typecheck, and test-size gate pass.

HOYALIM and others added 4 commits July 15, 2026 20:15
Signed-off-by: Ho Lim <subhoya@gmail.com>
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
…olver' into codex/pr-6968-sync

# Conflicts:
#	test/base-image-resolver-helper.test.ts
#	test/pr-workflow-contract.test.ts
@cv
cv merged commit 8c52687 into NVIDIA:main Jul 16, 2026
41 checks passed
@wscurran wscurran added area: ci CI workflows, checks, release automation, or GitHub Actions area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery refactor PR restructures code without intended behavior change labels Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI workflows, checks, release automation, or GitHub Actions area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery refactor PR restructures code without intended behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Share sandbox base-image resolver primitives outside composite-action YAML

5 participants