Skip to content

Attempt to fix CI runtime failures#72

Open
scotttrinh wants to merge 3 commits intomainfrom
fix-bundler-example-ci
Open

Attempt to fix CI runtime failures#72
scotttrinh wants to merge 3 commits intomainfrom
fix-bundler-example-ci

Conversation

@scotttrinh
Copy link
Collaborator

@scotttrinh scotttrinh commented Mar 25, 2026

Probably missed some pinned environment thing, but this unblocks the rest of CI. Will investigate the underlying cause more thoroughly soon.

@vercel
Copy link

vercel bot commented Mar 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vercel-py Ready Ready Preview Mar 25, 2026 11:18am

Request Review

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Ruby-based sandbox examples to reduce Bundler install failures in the Vercel Sandbox environment by forcing Bundler to use project-local config/home/path/cache locations.

Changes:

  • Add a bundle_env prefix to ensure Bundler uses local .bundle* and vendor/* directories.
  • Configure Bundler path and cache_path, and apply these settings to bundle install and bundle exec invocations.
  • For Rails, generate the app with --skip-bundle and run Bundler explicitly afterward.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
examples/sandbox_09_rails_api.py Adds Bundler env/config + skips automatic bundling during rails new, then runs Bundler with local paths.
examples/sandbox_07_ruby_sinatra.py Adds Bundler env/config and runs install/exec with local paths to avoid unwritable home/config locations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +44 to +49
bundle_env = (
"BUNDLE_APP_CONFIG=.bundle "
"BUNDLE_USER_HOME=.bundle-home "
"BUNDLE_PATH=vendor/bundle "
"BUNDLE_CACHE_PATH=vendor/cache"
)
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

bundle_env is being built as a shell fragment and then interpolated into multiple bash -lc strings. Since AsyncSandbox.run_command_detached already supports an env: dict[str, str] parameter, consider storing these as a dict and passing them via env=... instead of string concatenation. This avoids brittle spacing/quoting issues and reduces the risk of shell-injection when additional env vars are appended later.

Suggested change
bundle_env = (
"BUNDLE_APP_CONFIG=.bundle "
"BUNDLE_USER_HOME=.bundle-home "
"BUNDLE_PATH=vendor/bundle "
"BUNDLE_CACHE_PATH=vendor/cache"
)
bundle_env = {
"BUNDLE_APP_CONFIG": ".bundle",
"BUNDLE_USER_HOME": ".bundle-home",
"BUNDLE_PATH": "vendor/bundle",
"BUNDLE_CACHE_PATH": "vendor/cache",
}

Copilot uses AI. Check for mistakes.
Comment on lines +50 to +55
bundle_env = (
"BUNDLE_APP_CONFIG=.bundle "
"BUNDLE_USER_HOME=.bundle-home "
"BUNDLE_PATH=vendor/bundle "
"BUNDLE_CACHE_PATH=vendor/cache"
)
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

bundle_env is assembled as a shell prefix string and spliced into several bash -lc commands. The sandbox API supports env=... (dict) on run_command_detached, so it would be more robust to pass these values via env rather than string interpolation. This prevents subtle quoting/spacing bugs and keeps commands easier to read/modify.

Copilot uses AI. Check for mistakes.
Comment on lines +232 to +234
f"cd {app_path} && "
f"ALLOWED_HOST={allowed_host} bundle exec rails server -b 0.0.0.0 -p {port}"
f"ALLOWED_HOST={allowed_host} {bundle_env} "
f"bundle exec rails server -b 0.0.0.0 -p {port}"
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

allowed_host is interpolated directly into a bash -lc command as ALLOWED_HOST=... without any shell escaping. If the hostname ever contains unexpected characters, this can break the command or become a shell-injection vector. Prefer passing ALLOWED_HOST via the env parameter to run_command_detached (or, if keeping inline assignment, ensure it is shell-escaped).

Copilot uses AI. Check for mistakes.
Comment on lines +147 to 150
f"bundle exec rackup -s webrick -o 0.0.0.0 -p {port}"
),
],
)
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

RACK_ENV=production and the bundler env settings are currently injected by concatenating shell fragments into the bash -lc string. Since run_command_detached supports an explicit env dict, passing these via env would avoid shell quoting issues and makes it clearer which variables are being set for the process.

Copilot uses AI. Check for mistakes.
Getting this new runtime error:

* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
  - setuptools>=61.0
> /home/runner/work/vercel-py/vercel-py/.venv/bin/python3 -m pip --python
  /tmp/build-env-3ee0ml40/bin/python install --use-pep517 --no-warn-script-
  location --no-compile -r /tmp/build-requirements-_p80z08g.txt
< /home/runner/work/vercel-py/vercel-py/.venv/bin/python3: No module named pip
ERROR Command '['/home/runner/work/vercel-py/vercel-py/.venv/bin/python3', '-m', 'pip', '--python', '/tmp/build-env-3ee0ml40/bin/python', 'install', '--use-pep517', '--no-warn-script-location', '--no-compile', '-r', '/tmp/build-requirements-_p80z08g.txt']' returned non-zero exit status 1.
@scotttrinh scotttrinh changed the title wip Attempt to fix bundler install failures Attempt to fix CI runtime failures Mar 25, 2026
@scotttrinh scotttrinh marked this pull request as ready for review March 25, 2026 11:26
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