You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Linux -> child processes inherit ELECTRON_RUN_AS_NODE=1 and break other Electron apps #1162
I searched existing issues and did not find a duplicate.
I included enough detail to reproduce or investigate the problem.
Area
apps/desktop
Steps to reproduce
Launch T3 Code
From its environment, run:
env | grep ELECTRON_RUN_AS_NODE
obsidian help
Observe:
ELECTRON_RUN_AS_NODE=1
Obsidian fails with Cannot find module 'electron'
Run:
env -u ELECTRON_RUN_AS_NODE obsidian help
Observe:
Obsidian works normally
Expected behavior
ELECTRON_RUN_AS_NODE=1 should stay scoped to the internal process that needs it and should not be inherited by external commands/apps launched from T3 Code.
Actual behavior
On Linux desktop builds, commands launched from the T3 Code environment can inherit ELECTRON_RUN_AS_NODE=1.
That breaks unrelated Electron apps started from that environment. In my case, obsidian help fails with:
This fix is good, but the scope is narrow, and this kind of issue still reproduces on v0.0.36, through a path the terminal fix doesn't cover: agent sessions bypass the sanitizer entirely. Creating a shared helper to be able to cover a broader scope seems like a small fix IMO.
From a Claude agent session's shell:
$ env | grep -E '^(APPIMAGE|APPDIR|OWD|LD_LIBRARY_PATH|ELECTRON_RUN_AS_NODE)='
APPDIR=/tmp/.mount_t3code26Eb74
OWD=/home/rafa
LD_LIBRARY_PATH=/tmp/.mount_t3code26Eb74/usr/lib
APPIMAGE=/home/rafa/.local/bin/t3code.AppImage
ELECTRON_RUN_AS_NODE=1
$ obsidian
Error: Cannot find module 'electron' # same failure as the original report
PATH also still carries the /tmp/.mount_* entries (the #1699 symptom).
Root cause: the sanitizers from 4b4abcd (TERMINAL_ENV_BLOCKLIST, stripAppImageRuntimeEnv) are private to apps/server/src/terminal/Manager.ts
and only run on the PTY spawn path. Provider sessions build their env in apps/server/src/provider/ProviderInstanceEnvironment.ts, where mergeProviderInstanceEnvironment defaults baseEnv to process.env and
returns it unchanged when no custom environment is configured. ClaudeDriver.ts
(and the other four drivers) pass that straight into the agent spawn, so every
command an agent runs inherits the Electron/AppImage runtime state.
Suggested fix: extract the terminal sanitizer into a shared helper and apply
it in mergeProviderInstanceEnvironment before layering the explicitly
configured provider variables. One chokepoint covers all five drivers, and the
desktop→backend spawn (which legitimately needs ELECTRON_RUN_AS_NODE=1) is
untouched.
Related: #2867 is the same class of leak on the provider boundary — packaged-backend
cwd escaping where this is packaged-backend env. A shared "sanitize before provider
spawn" chokepoint is a natural place to address both.
Could this be reopened? I'm happy to re-test a build.
i can still see the leakage in a Claude session (not the terminal), on 0.0.44 (Linux AppImage).
Agent cannot run obsidian cli anymore due to the leakage.
Activity
juliusmarminge commentedon Jun 20, 2026
The terminal environment sanitizer explicitly blocks
ELECTRON_RUN_AS_NODEbefore spawning child processes, so this is fixed.This was closed as part of a large repo-wide maintenance sweep. If you think it's still relevant, please reopen.
rafazaya commentedon Aug 29, 2026
This fix is good, but the scope is narrow, and this kind of issue still reproduces on v0.0.36, through a path the terminal fix doesn't cover: agent sessions bypass the sanitizer entirely. Creating a shared helper to be able to cover a broader scope seems like a small fix IMO.
From a Claude agent session's shell:
PATHalso still carries the/tmp/.mount_*entries (the #1699 symptom).Root cause: the sanitizers from 4b4abcd (
TERMINAL_ENV_BLOCKLIST,stripAppImageRuntimeEnv) are private toapps/server/src/terminal/Manager.tsand only run on the PTY spawn path. Provider sessions build their env in
apps/server/src/provider/ProviderInstanceEnvironment.ts, wheremergeProviderInstanceEnvironmentdefaultsbaseEnvtoprocess.envandreturns it unchanged when no custom environment is configured.
ClaudeDriver.ts(and the other four drivers) pass that straight into the agent spawn, so every
command an agent runs inherits the Electron/AppImage runtime state.
Suggested fix: extract the terminal sanitizer into a shared helper and apply
it in
mergeProviderInstanceEnvironmentbefore layering the explicitlyconfigured provider variables. One chokepoint covers all five drivers, and the
desktop→backend spawn (which legitimately needs
ELECTRON_RUN_AS_NODE=1) isuntouched.
Related: #2867 is the same class of leak on the provider boundary — packaged-backend
cwd escaping where this is packaged-backend env. A shared "sanitize before provider
spawn" chokepoint is a natural place to address both.
Could this be reopened? I'm happy to re-test a build.
xian0x5a commentedon Sep 30, 2026
i can still see the leakage in a Claude session (not the terminal), on 0.0.44 (Linux AppImage).
Agent cannot run obsidian cli anymore due to the leakage.