Skip to content

Create missing file cloudxr.env#377

Open
lotusl-code wants to merge 1 commit intomainfrom
lotusl/create-required-cloudxr-env
Open

Create missing file cloudxr.env#377
lotusl-code wants to merge 1 commit intomainfrom
lotusl/create-required-cloudxr-env

Conversation

@lotusl-code
Copy link
Copy Markdown
Contributor

@lotusl-code lotusl-code commented Apr 9, 2026

When running the cloudxr runtime with run_cloudxr_via_docker.sh, the file clourxr.env is not generated. This branches from the behavior of pip package where the file is generated and contains environment variable values. This mismatch causes some user apps can't work with run_cloudxr_via_docker.sh since they depends on cloudxr.env.

This MR adds the file generation and stores the same environment variable values as the pip package approach.

Summary by CodeRabbit

Release Notes

  • New Features
    • Setup process now generates a reusable environment configuration file with pre-configured CloudXR and OpenXR variables, automating environment variable setup and reducing manual configuration steps.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 9, 2026

📝 Walkthrough

Walkthrough

The setup script now generates a reusable cloudxr.env configuration file within the CloudXR runtime directory. It creates necessary directories, defines a boolean normalization helper, exports key CloudXR and OpenXR environment variables with sensible defaults, applies restrictive file permissions, and instructs users to source the generated file.

Changes

Cohort / File(s) Summary
CloudXR Environment Setup
scripts/setup_cloudxr_env.sh
Added logic to generate a persistent cloudxr.env file exporting CloudXR/OpenXR variables (runtime paths, feature toggles with defaults, logging settings, device profile, stdin configuration, and XR runtime JSON path). Includes a boolean normalization helper, directory creation, chmod 600 permissions, and user sourcing instructions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A bunny hops with glee,
As env files dance and play,
CloudXR settings now are free,
Just source them on the way! ✨
Variables hop from shell to shell,
Permissions locked—all's well! 🔐

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Create missing file cloudxr.env' accurately describes the primary change: generating a cloudxr.env file that was previously missing when using the Docker-based CloudXR runtime setup.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch lotusl/create-required-cloudxr-env

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

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@scripts/setup_cloudxr_env.sh`:
- Around line 103-120: The script currently creates directories and writes the
cloudxr.env here-doc without checking for failures; update the block that uses
NV_CXR_RUNTIME_DIR, _CXR_LOGS_DIR, the mkdir -p call, the here-doc that writes
to CXR_ENV_FILE and the chmod "$CXR_ENV_FILE" step to explicitly detect errors:
after mkdir -p check its exit status and fail with a clear error and non-zero
exit if it fails; after the here-doc redirect to "$CXR_ENV_FILE" verify the
write succeeded (e.g., check the exit status or test that the file exists and is
not empty) and bail out with an explanatory error if not; likewise verify chmod
succeeded and error/exit on failure; do not change behavior otherwise, just add
defensive checks and informative error messages around
NV_CXR_RUNTIME_DIR/_CXR_LOGS_DIR/CXR_ENV_FILE creation and permission steps.
- Around line 108-117: The export lines (e.g., CXR_HOST_VOLUME_PATH,
CXR_INSTALL_DIR, NV_CXR_ENABLE_PUSH_DEVICES via __cxr_to_bool, NV_CXR_OUTPUT_DIR
using _CXR_LOGS_DIR, NV_CXR_RUNTIME_DIR, NV_DEVICE_PROFILE, XRT_NO_STDIN,
XR_RUNTIME_JSON) are written without quoting/escaping, which can break when
values contain spaces or special chars; update the serialization that writes
these exports into cloudxr.env to emit shell-safe assignments by quoting or
shell-escaping each value (use quoted values or a shell-escaping routine like
printf '%q' when writing the right-hand side) so every export becomes a valid,
sourceable shell token.
🪄 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: ASSERTIVE

Plan: Pro

Run ID: 1a0fe171-f947-4cc7-9958-a2daa3058343

📥 Commits

Reviewing files that changed from the base of the PR and between 18c8e36 and 3fbb66e.

📒 Files selected for processing (1)
  • scripts/setup_cloudxr_env.sh

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants