Skip to content

[codex] Fix terminal login shell environment#132

Merged
samuelstroschein merged 1 commit into
mainfrom
codex/fix-terminal-login-env
Jun 17, 2026
Merged

[codex] Fix terminal login shell environment#132
samuelstroschein merged 1 commit into
mainfrom
codex/fix-terminal-login-env

Conversation

@samuelstroschein

@samuelstroschein samuelstroschein commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary

Fix Flashtype terminal sessions so bundled agent launches like Claude Code and Codex can resolve user-installed CLIs when the macOS app is launched from Finder or another GUI context.

Root Cause

The embedded terminal spawned the configured shell directly with no login-shell args and inherited Electron's sparse GUI app environment. On macOS, that can leave PATH without Homebrew or local CLI install locations, producing errors like zsh: command not found: claude even though the command works in Terminal.app.

Changes

  • Launch common Unix shells as login shells from the terminal IPC path.
  • Normalize terminal environment construction in a small helper.
  • Preserve the existing PATH order while appending missing platform fallback paths such as /opt/homebrew/bin, /opt/homebrew/sbin, and /usr/local/bin.
  • Add helper coverage for shell resolution, login-shell args, fallback PATH entries, and deduplication.

Validation

  • node --check electron/terminal-shell.mjs
  • node --check electron/ipc-terminal.mjs
  • node --check electron/terminal-shell.test.mjs
  • Direct Node smoke checks for resolveShell, resolveShellArgs, and buildTerminalEnv

Full Vitest was not runnable in this checkout because @lix-js/sdk@workspace:* is missing from the empty submodule/lix workspace.


Note

Medium Risk
Changes how every embedded PTY is spawned and which environment variables it receives; wrong PATH or login-shell behavior could break agent/CLI launches but scope is limited to the Electron terminal IPC path.

Overview
Fixes embedded terminal sessions so user-installed CLIs (e.g. Homebrew tools) work when the macOS app is started from Finder by inheriting a sparse GUI PATH.

Terminal creation now spawns common Unix shells with login-shell args (-l) instead of a bare shell with empty argv, and builds the PTY environment through a shared terminal-shell.mjs helper. On non-Windows platforms, PATH keeps the inherited order and appends missing platform fallbacks (including /opt/homebrew/bin on darwin), with deduplication; Windows behavior stays env spread plus TERM.

ipc-terminal.mjs drops its inline resolveShell and wires in resolveShellArgs and buildTerminalEnv. Vitest coverage was added for shell resolution, login args, PATH augmentation, and dedup.

Reviewed by Cursor Bugbot for commit ee2140b. Bugbot is set up for automated code reviews on this repo. Configure here.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
flashtype-website ee2140b Commit Preview URL

Branch Preview URL
Jun 17 2026, 06:45 PM

@samuelstroschein samuelstroschein marked this pull request as ready for review June 17, 2026 18:45
@samuelstroschein samuelstroschein merged commit c0a161f into main Jun 17, 2026
5 checks passed
@samuelstroschein samuelstroschein deleted the codex/fix-terminal-login-env branch June 17, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant