-
Notifications
You must be signed in to change notification settings - Fork 614
fix: acp process env #1121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: acp process env #1121
Conversation
WalkthroughChanges include: (1) adding CDN resource extraction to two electron-builder configuration files to include unpacked resources in the app bundle, (2) refactoring environment variable handling in the process manager to use full propagation with enhanced PATH augmentation and shell environment merging, (3) reducing iframe sandbox permissions by removing same-origin access. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
electron-builder-macx64.yml (1)
32-34: CDN resources mapping looks correct and consistentThe new
extraResourcesentry mirrors the existing./runtime/mapping and targets the unpacked ASAR tree underapp.asar.unpacked/resources/cdn, which should make CDN assets available at runtime as intended.As a minor maintenance note, keep
electron-builder.ymlandelectron-builder-macx64.ymlin sync whenever adding future resource roots so platform-specific configs don’t drift.src/main/presenter/llmProviderPresenter/agent/acpProcessManager.ts (1)
271-353: Env seeding and PATH aggregation for Node/UV commands look sound, with a few edge cases to keep in mindThe updated logic to:
- seed
envfromprocess.env,- enrich it with filtered
getShellEnvironment()vars (excluding PATH-like keys), and- rebuild PATH from
shellEnv+ existing PATH variants + default/runtime paths vianormalizePathEnvis a solid approach for fixing ACP PATH issues, especially for Node/UV commands started from Electron where the GUI’s PATH is often incomplete.
A few small points to consider:
PATH key canonicalization on Windows
Becauseenvis first populated fromprocess.env, you can end up with bothPATHandPathentries beforenormalizePathEnvruns and setsenv[pathKey]. On Windows this is case-insensitive, but Node still passes both keys through. It’s probably fine, but worth confirming thatRuntimeHelper.normalizePathEnvalways returns a canonical key (Pathon win32) so the spawned process sees a single authoritative PATH.Logging verbosity
pathValuecan be quite large after merging shell/default/runtime paths. If this log runs frequently in production, you may eventually want to downgrade or gate it behind a debug flag, though it’s very helpful while validating this change.Extensibility of
isNodeCommand
If you later support additional Node-based CLIs (e.g.,pnpm,yarn), consider adding them to theisNodeCommandlist so they also benefit from this richer PATH construction.Functionally, the current change aligns well with the PR goal and should significantly reduce “tool not found” issues for ACP agents across platforms.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
electron-builder-macx64.yml(1 hunks)electron-builder.yml(1 hunks)src/main/presenter/llmProviderPresenter/agent/acpProcessManager.ts(1 hunks)src/renderer/src/components/artifacts/ReactArtifact.vue(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/main/presenter/llmProviderPresenter/agent/acpProcessManager.ts (1)
src/main/presenter/llmProviderPresenter/agent/shellEnvHelper.ts (1)
getShellEnvironment(160-240)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build-check (x64)
🔇 Additional comments (2)
electron-builder.yml (1)
33-35: Consistent CDN resources inclusion across platformsThis
extraResourcesentry cleanly aligns with the macx64 config and the existing./runtime/mapping, so CDN assets should now be available from the unpacked ASAR on all targets.Recommend running at least one full build per target to confirm the
app.asar.unpacked/resources/cdntree is populated as expected.src/renderer/src/components/artifacts/ReactArtifact.vue (1)
7-7: Stronger iframe sandbox with no apparent functional regressionsDropping
allow-same-originwhile keepingallow-scriptsis a good hardening step here: the component only setssrcdocand anonloadhandler and does not access the iframe’s DOM orcontentWindow, so it shouldn’t depend on same-origin privileges.Please double-check any embedded React artifacts that might rely on document cookies/localStorage or parent-window access, just to ensure none of them implicitly depended on same-origin behavior.
Summary by CodeRabbit
Bug Fixes
Chores
✏️ Tip: You can customize this high-level summary in your review settings.