fix(desktop): strip AppImage ARGV0 before child shells (#2588)

AppImage exports ARGV0 into the process environment. zsh treats that as
argv[0] for every external command, which broke Python venv detection in
the integrated terminal and managed OpenCode sessions.

Clear ARGV0 in Electron before login-shell probing, refuse to re-apply it
from shell snapshots, and strip it from terminal PTY and managed OpenCode
launch environments.

Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-08-03 08:54:39 +00:00
co-authored by Serhii Dziupin
parent 2ba8ae8bd4
commit be38fb8cf4
12 changed files with 148 additions and 5 deletions
@@ -232,7 +232,7 @@ export const createOpenCodeEnvRuntime = (deps) => {
return;
}
const skipKeys = new Set(['PWD', 'OLDPWD', 'SHLVL', '_']);
const skipKeys = new Set(['PWD', 'OLDPWD', 'SHLVL', '_', 'ARGV0']);
for (const [key, value] of Object.entries(snapshot)) {
if (skipKeys.has(key)) {
continue;
@@ -244,6 +244,9 @@ export const createOpenCodeEnvRuntime = (deps) => {
process.env[key] = value;
}
// AppImage ARGV0 must never remain on process.env (zsh rewrites argv[0]; #2588).
delete process.env.ARGV0;
const currentPath = process.env.PATH || '';
const shellPath = snapshot.PATH || '';
if (!shellPath) {