fix(desktop): import CA trust variables from the login shell #19604
main fromrefs/pull/19604/head·merged by maria-rcks View on GitHubProblem#
The desktop app imports a fixed set of variables from the login shell, and CA trust variables are not in it. When the node on the shell's PATH has no bundled root store (for example a shared-OpenSSL Node such as zerobrew's node 26), every Node child the server spawns fails TLS unless SSL_CERT_FILE/SSL_CERT_DIR reach it.
Seen on macOS: clicking Update for Pi fails with "Update command exited with code 1." The server runs pi update --self, which exits with:
Error: Could not determine latest pi version: fetch failed (UNABLE_TO_GET_ISSUER_CERT_LOCALLY)
The same command succeeds from a terminal, where the shell profile exports SSL_CERT_FILE.
Change#
Import SSL_CERT_FILE, SSL_CERT_DIR, and NODE_EXTRA_CA_CERTS from the login shell, filling them only when the app process has none, like XDG_* and HOMEBREW_*.
Scope and approval#
Small focused fix of an obvious bug: CA trust configured in the shell profile is dropped for GUI launches, so provider updaters and agents on such setups cannot make HTTPS requests. No behavior change when these variables are unset.
Verification#
- Reproduced in T3 Code Nightly 0.0.46-nightly.20261014.3118: the Pi update toast showed "Update command exited with code 1".
- Re-ran
pi update --selfwith the server process's exact environment: exit 1 with the error above. Same environment plus theSSL_CERT_FILE/SSL_CERT_DIRvalues the login shell probe returns:Updated pi from 1.0.0 to 1.2.0, exit 0. /opt/zerobrew/bin/node -e 'fetch("https://registry.npmjs.org/")'fails withUNABLE_TO_GET_ISSUER_CERT_LOCALLYin a clean env and returns 200 withSSL_CERT_FILEset.- Added a case to
DesktopShellEnvironment.test.ts(missing vars are hydrated, an existingSSL_CERT_DIRis kept).vp test run src/shell/DesktopShellEnvironment.test.tspasses 19/19; desktop typecheck, lint, and fmt check pass. - Unverified: a packaged desktop build running the update end to end.
Written by Claude Opus 5.5 (claude-opus-5-5) in Claude Code.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
juliusmarminge added labelsmacroscope-review
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XS
Approvability#
Verdict: Not approved
Macroscope's review found this PR not approvable — This is a narrowly scoped, well-tested fix that propagates shell-configured CA trust into the desktop backend and agents while preserving existing values. Because it changes TLS certificate trust behavior for production processes, human review is warranted.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Provider Metric Main baseline This PR Impact PR ceiling Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅ Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅ Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅ Codex Live turn WebSocket decoded 20.9 KiB 20.9 KiB 0 B (0.0%) 29.3 KiB ✅ Codex Live turn messages 2 2 0 (0.0%) 8 ✅ Claude Total thread wire 5.0 KiB 5.0 KiB −7 B (−0.1%) 6.8 KiB ✅ Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅ Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB −7 B (−0.6%) 2.0 KiB ✅ Claude Live turn WebSocket decoded 21.2 KiB 21.2 KiB 0 B (0.0%) 29.3 KiB ✅ Claude Live turn messages 2 2 0 (0.0%) 8 ✅ Baseline:
348f217· PR result:e96a53e· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
- Codex decoded thread snapshot: 108.5 KiB
- Claude decoded thread snapshot: 108.8 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.
maria-rcks merged thisaa81d12
maria-rcks closed this
Sign in to join this conversation.
Warning
Review limit reached#
Only developers with an assigned seat can use this organization's usage-based review budget, and seats here are assigned manually. Ask an admin to assign a seat, or change the review continuation mode in Billing.
Next included review available in 30 minutes.
Check out review usage here.
View limit details
Limit details: You’ve used all 10 included reviews currently available.
Learn how review limits work.
Review configuration:
⚙️ Run configuration
c7d97a5e-2da1-4151-a189-c5e2175a2654📥 Commits
Reviewing files that changed from the base of the PR and between 348f217a853dd4a23d7fa4834dedb05f545c2075 and e96a53ee9bcc0ea0a111495a66f6dbff87d88bbe.
📒 Files selected for processing: 2
apps/desktop/src/shell/DesktopShellEnvironment.test.tsapps/desktop/src/shell/DesktopShellEnvironment.ts- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment `@coderabbitai help` to get the list of available commands.