Merge pull request #195 from nwparker/cloud/agents-node-ca

fix(cloud): orcad and its terminals trust the egress proxy's CA (Gemini CLI hung in cloud terminals)
This commit is contained in:
Neil
2026-11-10 00:59:02 -08:00
committed by GitHub
3 changed files with 19 additions and 2 deletions
@@ -197,3 +197,12 @@ describe('agents the image ships', () => {
expect(provision).toMatch(/for bin in claude codex opencode gemini cursor-agent copilot gh; do/)
})
})
describe('orcad env', () => {
it("passes the provider's CA settings to orcad, so Node agents trust the egress proxy's certificate", () => {
const start = readFileSync(fileURLToPath(new URL('./vm/orca-sandbox-start', import.meta.url).href), 'utf8')
expect(start).toMatch(/ca_env=\(NODE_USE_SYSTEM_CA="\$\{NODE_USE_SYSTEM_CA:-1\}"\)/)
expect(start).toMatch(/for name in NODE_EXTRA_CA_CERTS SSL_CERT_FILE; do/)
expect(start).toMatch(/env -i HOME="\$HOME" USER="\$\(id -un\)" LANG=C\.UTF-8 TERM=xterm-256color "\$\{ca_env\[@\]\}"/)
})
})
File diff suppressed because one or more lines are too long
@@ -170,7 +170,15 @@ unset ORCA_SECRET_ENV
# Agent CLIs installed with the image's npm (codex, gemini, ...) are `#!/usr/bin/env node` scripts:
# terminals need that node on PATH, not only orcad's bundled runtime.
system_node="$(command -v node 2>/dev/null || echo "$node")"
env -i HOME="$HOME" USER="$(id -un)" LANG=C.UTF-8 TERM=xterm-256color \
# The egress proxy answers for hosts with credential rules (model APIs, api.github.com) with a
# certificate from Vercel's CA, which this command's env trusts (Vercel sets these). Pure-Node clients
# use Node's bundled roots otherwise: Gemini CLI retried forever ("taking a bit longer") in every
# terminal while the same call worked here. Pass the provider's CA settings on to orcad and its shells.
ca_env=(NODE_USE_SYSTEM_CA="${NODE_USE_SYSTEM_CA:-1}")
for name in NODE_EXTRA_CA_CERTS SSL_CERT_FILE; do
if [ -n "${!name:-}" ]; then ca_env+=("$name=${!name}"); fi
done
env -i HOME="$HOME" USER="$(id -un)" LANG=C.UTF-8 TERM=xterm-256color "${ca_env[@]}" \
PATH="$ORCA_HOME/tools/bin:$ORCA_HOME/bin:$(dirname "$system_node"):/usr/local/bin:/usr/bin:/bin" \
ORCA_USER_DATA="$HOME/.orcad-data" ORCA_SANDBOX_ID="$ORCA_SANDBOX_ID" "${managed_env[@]}" \
NODE_COMPILE_CACHE="$ORCA_HOME/compile-cache" ORCA_ORCAD_STARTUP_QUALIFICATION_DIR="$ORCA_HOME/startup-qualification" \