Skip to content

Fix Linux desktop Codex CLI detection at startup#1100

Merged
juliusmarminge merged 3 commits intopingdotgg:mainfrom
Ryan-D-Gast:fix/linux-desktop-codex-path
Mar 28, 2026
Merged

Fix Linux desktop Codex CLI detection at startup#1100
juliusmarminge merged 3 commits intopingdotgg:mainfrom
Ryan-D-Gast:fix/linux-desktop-codex-path

Conversation

@Ryan-D-Gast
Copy link
Copy Markdown
Contributor

@Ryan-D-Gast Ryan-D-Gast commented Mar 15, 2026

Hello, when running the .AppImage on Linux and creating the corresponding .desktop application, t3code was unable to find the codex CLI even though it was correctly available in my PATH (set in both .bashrc and .zshrc).

At first I assumed this was something specific to my system, but after digging into it I determined the issue was caused by how PATH hydration was handled in the t3code startup sequence. This PR fixes that

Fixes #234
Fixes #367
Fixes #269
Fixes #301
Also related to #226

What Changed

  • Fixed desktop PATH hydration so Linux packaged launches resolve codex the same way terminal launches do.
  • Moved server PATH hydration earlier in startup so provider health checks run after PATH has been normalized.
  • Added regression tests covering startup ordering and shared shell PATH behavior.

Why

When launching from a Linux desktop entry, the app could report that the Codex CLI was missing or not executable even though codex worked fine in the terminal. This happened for two reasons:

  1. PATH hydration for desktop/server startup only handled macOS, so Linux GUI launches could miss shell-managed paths.
  2. Provider health was computed before PATH normalization ran, which could cause the Codex status to be reported incorrectly during startup.

Note

Fix Codex CLI detection on Linux by extending shell environment hydration to Linux

  • Extends fixPath in os-jank.ts and syncShellEnvironment in syncShellEnvironment.ts to run on both darwin and linux (previously macOS-only).
  • Adds resolveLoginShell in shell.ts to determine the login shell per platform: uses the provided $SHELL, falls back to /bin/zsh on macOS and /bin/bash on Linux, and returns undefined on unsupported platforms.
  • Both fixPath and syncShellEnvironment now return early without modifying the environment if no login shell can be resolved (e.g. on Windows).
  • Behavioral Change: fixPath now accepts an options object for env, platform, and readPath overrides and writes PATH back to the provided env rather than always process.env.

Macroscope summarized ccb8b25.


Note

Medium Risk
Changes process environment hydration on Linux and alters default shell selection behavior, which can impact CLI discovery and startup behavior across platforms. Risk is moderate due to OS-specific variability, but changes are guarded to only run on darwin/linux with added regression tests.

Overview
Fixes Linux packaged startup CLI detection by extending login-shell environment hydration to Linux in both desktop (syncShellEnvironment) and server (fixPath) startup.

Adds shared resolveLoginShell helper to choose a platform-appropriate default shell (/bin/zsh on macOS, /bin/bash on Linux) and no-op on unsupported platforms, and adds tests verifying PATH/SSH_AUTH_SOCK hydration plus that server fixPath runs before server start.

Written by Cursor Bugbot for commit ccb8b25. This will update automatically on new commits. Configure here.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 15, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3e2e068f-20a6-464f-b122-c431d1781c2a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Mar 15, 2026
@arthurbm
Copy link
Copy Markdown

I independently hit the same issue on Ubuntu 22.04 with the AppImage (v0.0.11) and arrived at the same fix. Tested locally with codex installed via nvm (Node v24) — after applying the platform guard change + moving fixPath() before Layer construction, the Codex provider status correctly shows "ready".

One note: since #972 landed, the desktop side was refactored from fixPath.ts to syncShellEnvironment.ts, so the platform guard change now needs to go in that file instead. The server-side os-jank.ts is unchanged.

@Ryan-D-Gast
Copy link
Copy Markdown
Contributor Author

One note: since #972 landed, the desktop side was refactored from fixPath.ts to syncShellEnvironment.ts, so the platform guard change now needs to go in that file instead. The server-side os-jank.ts is unchanged.

Might need to rebase and refactor then. Thanks for letting me know!

@arthurbm
Copy link
Copy Markdown

One note: since #972 landed, the desktop side was refactored from fixPath.ts to syncShellEnvironment.ts, so the platform guard change now needs to go in that file instead. The server-side os-jank.ts is unchanged.

Might need to rebase and refactor then. Thanks for letting me know!

You're welcome! If you need any help, let me know! I really want this fix to land, so that I can normally use the app on Linux

@Ryan-D-Gast Ryan-D-Gast force-pushed the fix/linux-desktop-codex-path branch 2 times, most recently from 5d7d29b to b2c097d Compare March 18, 2026 19:38
@Ryan-D-Gast
Copy link
Copy Markdown
Contributor Author

Rebased onto main and simplified the implementation:

  • The fix now lives in syncShellEnvironment.ts instead of the removed fixPath.ts (as noted, fix(desktop): backfill SSH_AUTH_SOCK from login shell on macOS #972 refactored the desktop side)
  • Added resolveLoginShell() helper to @t3tools/shared/shell for platform-aware shell resolution (darwin → zsh, linux → bash)
  • Desktop: syncShellEnvironment now supports both macOS and Linux
  • Server: fixPath() uses the same resolveLoginShell helper directly
  • Removed the redundant readPathForDesktopRuntime wrapper — both desktop and server compose the primitives directly

All typechecks and tests pass.

@Ryan-D-Gast Ryan-D-Gast force-pushed the fix/linux-desktop-codex-path branch from b2c097d to b8b3aec Compare March 27, 2026 05:36
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

- Extend PATH sync to Linux desktop and server startup
- Add tests for Linux handling and non-matching platforms
@juliusmarminge juliusmarminge enabled auto-merge (squash) March 28, 2026 18:21
@juliusmarminge juliusmarminge merged commit 32c1f98 into pingdotgg:main Mar 28, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

3 participants