Skip to content

fix(src-tauri): fix PATH inheritance for GUI-launched app (studio#119) - #122

Merged
brettchien merged 1 commit into
mainfrom
fix/path-env-inheritance-119
Aug 28, 2026
Merged

fix(src-tauri): fix PATH inheritance for GUI-launched app (studio#119)#122
brettchien merged 1 commit into
mainfrom
fix/path-env-inheritance-119

Conversation

@brettchien

Copy link
Copy Markdown
Contributor

Summary

Item 2 of #119's runbook. macOS/Linux GUI-launched apps don't inherit the user's shell-rc-configured PATH (only whatever launchd/the display manager hands them). Confirmed live with Brett: gke-gcloud-auth-plugin was correctly installed (which found it at /opt/homebrew/share/google-cloud-sdk/bin/gke-gcloud-auth-plugin, added to PATH only via Homebrew-cask's shell-rc hook), but the spawned oab-mcp sidecar couldn't find it — list_namespaces failed with auth error: unable to run auth exec: No such file or directory (os error 2).

Fix

Call fix_path_env::fix() at the very top of main() in src-tauri/src/main.rs, before app_lib::run() (Tauri init, sidecar spawn) — the crate re-reads PATH from a spawned login shell ($SHELL -ilc 'echo ...; env; ...') and applies it to the process env. Added as a git dependency pinned to a specific commit (c4c45d503ea115a839aae718d02f79e7c7f0f673) since upstream doesn't publish it to crates.io.

This is a general safety net, not GKE-specific — also covers e.g. Azure kubelogin, which (unlike GKE/EKS) has no pure-Rust in-process replacement identified, per #119's scope notes.

Verification

  • Not locally compiledsrc-tauri isn't a root-workspace member and needs macOS system libs (glib-2.0/GTK for the Linux webview target) this sandbox doesn't have, same pre-existing limitation as the Tauri-bridge-layer work (studio#105-118). Read the dependency's source directly (fix_vars/fix() in tauri-apps/fix-path-env-rs's src/lib.rs) to confirm the exact API shape before using it.
  • CI's bundle-macos job (real macOS runner) is the only signal for this crate.
  • Recommend Brett re-test the exec-based-auth path (GKE context, or any context needing an exec plugin) for real after this merges.

Ref #119.

🤖 Generated with Claude Code

macOS/Linux GUI-launched apps don't inherit the user's shell-rc-configured
PATH (only whatever launchd/the display manager hands them) — so exec-based
kubeconfig auth plugins (e.g. gke-gcloud-auth-plugin, installed via a
Homebrew-cask gcloud SDK that only adds itself to PATH via shell rc) are
invisible to the spawned oab-mcp sidecar even when correctly installed on
disk. Confirmed live with Brett: `which gke-gcloud-auth-plugin` found it at
/opt/homebrew/share/google-cloud-sdk/bin, but the app's list_namespaces
call failed with "unable to run auth exec: No such file or directory".

Call fix_path_env::fix() at the very top of main(), before anything else
(Tauri init, sidecar spawn) that could need a PATH-resolved binary. Pinned
to a specific commit of the upstream git crate (not published to
crates.io) for reproducibility.

This is a general safety net for any exec-based kubeconfig provider (also
covers e.g. Azure kubelogin, which has no pure-Rust in-process replacement
unlike GKE/EKS — see #119's other items).

Ref #119.
@brettchien
brettchien merged commit d1afdcb into main Aug 28, 2026
2 checks passed
@brettchien
brettchien deleted the fix/path-env-inheritance-119 branch August 28, 2026 15:50
brettchien added a commit that referenced this pull request Aug 28, 2026
…(studio#119) (#123)

k8s_client_for() previously left kube-rs to shell out to
gke-gcloud-auth-plugin for GKE contexts. Even with fix-path-env (#122)
fixing PATH inheritance in general, this still depends on the plugin
binary being installed and PATH-resolvable at all.

When the resolved kubeconfig context's exec command is exactly
"gke-gcloud-auth-plugin", fetch the bearer token in-process via gcp_auth
instead — it walks the same Application Default Credentials chain the
plugin itself reads (gcloud user creds / GOOGLE_APPLICATION_CREDENTIALS /
GCE-GKE metadata server) — and set it directly on AuthInfo.token, clearing
the exec block. No subprocess, no PATH dependency, for GKE specifically.

Other exec-based providers (e.g. Azure kubelogin) have no equivalent
pure-Rust replacement identified, so they still rely on fix-path-env.

Ref #119.
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