[Bug]: Provider agent sessions inherit ELECTRON_RUN_AS_NODE=1 on macOS, so Electron apps launched from agent shells run as Node and exit

Đang mở Phù hợp với người mới
#26,966 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
electron, macos, typescript
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu với mergeProviderInstanceEnvironment và các bộ điều hợp phiên của provider trong apps/server; issue cho biết chúng tạo môi trường phiên thông qua helper này. So sánh đường đi đó với TERMINAL_ENV_BLOCKLIST trong apps/server/src/terminal/Manager.ts và cách xử lý môi trường hiện có được mô tả trong issue. Hoàn thành khi các shell của provider không còn kế thừa ELECTRON_RUN_AS_NODE, trong khi các helper cần chế độ Node vẫn có thể tự đặt biến này.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Before submitting
  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.
Area

apps/server

Steps to reproduce
  1. On macOS, start a Claude (or Codex) thread in the desktop app.
  2. Ask the agent to run echo $ELECTRON_RUN_AS_NODE with its shell tool. It prints 1.
  3. Ask it to launch any Electron app from that shell, for example /Applications/Slack.app/Contents/MacOS/Slack --remote-debugging-port=9222.
Expected behavior

Agent shells don't have ELECTRON_RUN_AS_NODE, so an Electron app launched from one opens normally.

Actual behavior

The Electron app starts as plain Node and exits without opening a window. Agents that drive desktop apps over CDP (Slack, VS Code, Discord, etc.) can't start them.

The desktop app starts the server with ELECTRON_RUN_AS_NODE=1 on purpose (apps/desktop/src/backend/DesktopBackendConfiguration.ts), and mergeProviderInstanceEnvironment passes it through unchanged to provider sessions, so every tool shell inherits it. The integrated terminal (TERMINAL_ENV_BLOCKLIST in apps/server/src/terminal/Manager.ts) and the external launcher (#20206) already drop it; provider sessions are the remaining path.

This is the provider-session part of #16456, which was closed with a request for a new issue covering only that part. It isn't Linux-specific: the same leak happens on macOS without any AppImage variables.

#16679 (maintainer takeover) fixes this: its mergeProviderInstanceEnvironment deletes ELECTRON_RUN_AS_NODE on every platform before applying provider overrides, and Claude, Codex, Grok, Antigravity and the ACP registry adapters all build their session environment through it. T3's own helpers that need Node mode (agent-device wrappers since #18301, the Claude history worker, document text extraction) set the variable themselves, so they're unaffected.

Impact

Major degradation or frequent failure

Version or commit

T3 Code (Nightly) 0.1.5-nightly.20261029.3877; code references are upstream/main at 20497e4890.

Environment

macOS 27 (Apple Silicon), desktop app, Claude provider. Same code path for Codex.

Logs or stack traces
$ echo "ELECTRON_RUN_AS_NODE=${ELECTRON_RUN_AS_NODE-<unset>}"   # inside a Claude agent's Bash tool
ELECTRON_RUN_AS_NODE=1
Workaround

Prefix the launch with env -u ELECTRON_RUN_AS_NODE, or unset ELECTRON_RUN_AS_NODE in the agent's shell first.

Ngôn ngữ chính
TypeScript
Star
24.8k
Fork
6.4k
Merge trung bình
14 giờ 40 phút
Pull request đã merge (30 ngày)
193

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của pingdotgg/t3code

Tất cả issue của pingdotgg/t3code

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.