Skip to content

fix(sandbox): pass declared environment to the initial process - #3392

Merged
johntmyers merged 1 commit into
NVIDIA:mainfrom
cv:3377-initial-command-environment/cv
Sep 17, 2026
Merged

johntmyers merged 1 commit into
NVIDIA:mainfrom
cv:3377-initial-command-environment/cv

Conversation

@cv

@cv cv commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Restore declared sandbox environment variables for the initial command. After the RFC 0012 runtime split, those values are carried separately from inherited supervisor environment, but canonical process launch never applies them; applications can therefore start without required configuration even when later exec sessions see it.

Related Issue

Fixes #3377.

Changes

  • Apply the declared environment in apply_canonical_process_environment.
  • Run supervisor-only environment stripping and provider-placeholder injection afterward in both canonical launch paths, preserving protected-value precedence.
  • Add a child-process regression for application variables, explicit HOME, supervisor-token removal, and provider-placeholder precedence.
  • Add a Docker-backed lifecycle regression checking initial and exec environments in TTY and non-TTY modes; clarify the documented initial-command contract.

Testing

  • mise run pre-commit passes.
  • Unit regression fails without environment application; sandbox library suite passes with the fix: 201 passed, one existing skip, using pinned Rust 1.95.0 on Linux ARM64.
  • Docker lifecycle regression fails against the original b3e4ad457 sandbox runtime with declared_env=missing and passes against the rebuilt patched runtime in both modes.
  • Focused Clippy checks for the sandbox and feature-enabled lifecycle test pass with warnings denied.
  • Full mise run ci passes on Linux ARM64 after installing the required libz3-dev dependency. The first run hit two WebSocket test failures in openshell-supervisor-network; both passed in an isolated serial run, and an unchanged full CI rerun passed. No source changes were needed.

The Docker comparison used the same b3e4ad457 gateway and supervisor, the same workload image from #3377, and a CLI built from this branch. Only the sandbox runtime image changed between failing and passing runs. Tests used an isolated temporary gateway and owned sandboxes; no images were published. This verifies environment propagation, not NemoClaw model inference.

Checklist

  • Follows Conventional Commits.
  • Commits are signed off (DCO).
  • Architecture and user documentation updated.

Apply the workload environment before stripping supervisor-only values and injecting provider placeholders in both canonical launch paths. The RFC 0012 bootstrap carries these values separately from inherited supervisor environment.

Add child-process coverage for declared values, explicit HOME, stripped identity material, and provider precedence. Add a Docker-backed lifecycle regression for initial and exec environments in TTY and non-TTY modes.

Validation: the child-process test fails without env application; the Docker regression fails with the pinned unpatched runtime and passes with the rebuilt runtime. Sandbox library tests: 201 passed, one ignored on Rust 1.95.0. mise run pre-commit passed. Full mise run ci is blocked by the host linker missing libz3. Fixes NVIDIA#3377.
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Sep 16, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@github-actions

github-actions Bot commented Sep 16, 2026

Copy link
Copy Markdown

All contributors have signed the DCO ✍️ ✅
Posted by the DCO Assistant Lite bot.

@cv

cv commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

I have read the DCO document and I hereby sign the DCO.

@cv
cv marked this pull request as ready for review September 16, 2026 19:39
@cv
cv requested review from a team, derekwaynecarr, mrunalp and sjenning as code owners September 16, 2026 19:39
@drew

drew commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

/ok to test 4c5c661

@johntmyers johntmyers added gator:in-review Gator is reviewing or awaiting PR review feedback test:e2e Requires end-to-end coverage labels Sep 17, 2026
@github-actions

Copy link
Copy Markdown

Label test:e2e applied for 4c5c661. Open the existing run and click Re-run all jobs to execute with the label set. The run will execute the standard E2E suite after building the required gateway, sandbox, and supervisor images once. The matching required CI gate status on this PR will flip green automatically once the run finishes.

@johntmyers johntmyers 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.

gator-agent

PR Review Status

This focused fix restores declared environment variables to the initial sandbox process while preserving supervisor-only stripping and provider-placeholder precedence in both canonical launch paths. The implementation, regression coverage, architecture note, and user documentation are consistent, and no blocking findings remain.

Blocking findings:

  • No blocking findings remain

Carried findings:

  • None

Non-blocking suggestions:

  • None
Gator metadata
  • Validation: Project-valid focused fix for linked regression #3377
  • Docs: Relevant Fern sandbox documentation and architecture contract updated
  • Checks: Branch Checks, Helm Lint, and Trivy Changes are green; required E2E is queued for the current head
  • E2E: test:e2e applied; E2E Label Help requested rerun 35141913252, which is queued
  • Head SHA: 4c5c661f84930973c46b00f7e628ffe4934bc183
  • Base SHA: 7c592196e74ce4e512e43af8cb4faa7b19473b96
  • Merge base SHA: 2ccef97769e0e39c4dc06b4c3953d3735814f146
  • Patch ID: 881708d22062297530fd947d58194b8a50eddb39
  • Gator payload: 9
  • Review mode: initial
  • Previous reviewed SHA: none
  • Review budget exhausted: no
  • Maintainer decision required: no
  • Next state: gator:watch-pipeline

@johntmyers johntmyers added gator:watch-pipeline Gator is monitoring PR CI/CD status gator:approval-needed Gator completed review; maintainer approval needed and removed gator:in-review Gator is reviewing or awaiting PR review feedback gator:watch-pipeline Gator is monitoring PR CI/CD status labels Sep 17, 2026
@johntmyers
johntmyers added this pull request to the merge queue Sep 17, 2026
@johntmyers johntmyers added gator:merge-ready and removed gator:approval-needed Gator completed review; maintainer approval needed labels Sep 17, 2026
Merged via the queue into NVIDIA:main with commit 7e7a8d5 Sep 17, 2026
132 of 137 checks passed
@cv
cv deleted the 3377-initial-command-environment/cv branch September 17, 2026 06:08
@johntmyers

Copy link
Copy Markdown
Collaborator

gator-agent

Monitoring Complete

Monitoring is complete because this PR has merged.

Final status: Gator review found no blocking issues, the required checks including E2E passed, and maintainer approval was present before merge.

I removed the active gator:* label because there is nothing left for gator to monitor on this PR.

Gator metadata
  • Head SHA: 4c5c661f84930973c46b00f7e628ffe4934bc183
  • Gator payload: 9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:e2e Requires end-to-end coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: sandbox --env is not passed to the initial command

3 participants