agent-orchestrator/frontend/src/shared
Harshit Singh Bhandari 14c2c485be
fix(desktop): recover login-shell env so the daemon finds zellij/credentials (#389)
* fix(desktop): recover login-shell env so the daemon finds zellij/credentials

A Finder/Dock launch starts the app via launchd, not a login shell, so
~/.zprofile and ~/.zshrc are never sourced. The daemon then inherits
launchd's minimal env (no /opt/homebrew/bin on PATH, no exported
ANTHROPIC_API_KEY, etc.), cannot exec zellij/git, and its agents cannot
authenticate. Launching from a terminal masked this because the shell had
already populated the env, so it only reproduced on a real Finder/Dock launch.

Resolve the login-shell environment once at startup
($SHELL -ilc "printf sentinel; env -0"), adopt it as the base for
daemonEnv(), and force PATH from the shell with a static floor when the probe
fails (timeout/non-zero exit). The probe never blocks startup (3s SIGKILL
timeout, stdin closed) and degrades to the floor rather than erroring.

Windows keeps its existing behavior: its env comes from the registry/session
and is inherited by GUI-launched apps, so this bug does not exist there.

Pure parse/merge logic lives in shared/shell-env.ts (no node:* imports, per
the daemon-attach.ts convention) with unit tests; main.ts owns the real spawn.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* chore: format with prettier [skip ci]

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-06-23 02:28:12 +05:30
..
daemon-attach.test.ts fix(desktop): attach to a serving daemon instead of spawning a doomed child (#373) 2026-06-22 13:14:46 +05:30
daemon-attach.ts fix(desktop): attach to a serving daemon instead of spawning a doomed child (#373) 2026-06-22 13:14:46 +05:30
daemon-discovery.test.ts Use ~/.ao as canonical state home (#233) 2026-06-14 22:52:25 +05:30
daemon-discovery.ts Use ~/.ao as canonical state home (#233) 2026-06-14 22:52:25 +05:30
daemon-launch.test.ts Split: backend runtime/session updates + frontend shell refactor (#222) 2026-06-13 12:18:55 +05:30
daemon-launch.ts Split: backend runtime/session updates + frontend shell refactor (#222) 2026-06-13 12:18:55 +05:30
daemon-status.ts fix: recover terminal reattach after daemon idle (#354) 2026-06-21 13:59:15 +05:30
posthog-config.ts Feat/backend telemetry v0 (#307) 2026-06-18 22:00:25 +05:30
shell-env.test.ts fix(desktop): recover login-shell env so the daemon finds zellij/credentials (#389) 2026-06-23 02:28:12 +05:30
shell-env.ts fix(desktop): recover login-shell env so the daemon finds zellij/credentials (#389) 2026-06-23 02:28:12 +05:30
telemetry.test.ts fix(storage): renumber telemetry migration to 0015 to resolve 0014 version collision (#334) 2026-06-20 11:23:13 +05:30
telemetry.ts Feat/backend telemetry v0 (#307) 2026-06-18 22:00:25 +05:30