Repository navigation
Find the hide CLI when the desktop app starts without the operator's PATH - #166
Merged
Merged
Conversation
…PATH An app opened from Finder or the Dock gets launchd's bare PATH, and the five-second login-shell probe timed out on a real rc file, leaving the window on the missing-CLI screen. The search now goes PATH, the CLI that last attached (remembered under the profile), the login shell with a ten-second bound and shell-env's Oh My Zsh guards, then ~/.local/bin, /opt/homebrew/bin and /usr/local/bin. The home directory comes from HOME, so an isolated instance never finds the operator's CLI.
# Conflicts: # desktop/e2e/fixture.ts
A relaunch that attaches to a running daemon leaves the status page for the daemon's origin within tens of milliseconds, and Playwright can lose that early renderer swap: its page stays on the status page, or no window event arrives, while the window shows the shell. The lifetime and discovery relaunches now read the window through the main process. The fixture cleanup retries ENOTEMPTY while the stopped daemon removes its files.
yansfil
added a commit
that referenced
this pull request
Sep 28, 2026
## Summary In a browser display, ⌘= / ⌘- / ⌘0 used to hand focus back to the shell and resize the terminal or editor text, and a trackpad pinch did nothing. Now, while a page holds the keyboard, the text-size commands zoom that page in Chrome's steps (25% to 500%, reset to 100%) and the page keeps focus. ⌘+ (⌘⇧=) also zooms in, and pinch zoom is enabled up to 3x. With the shell focused, the same commands size text exactly as before. Routing is by command id in `DesktopHost.sendCommand`, so a rebound text-size chord zooms the page too.  ## Review - **Please judge**: ⌘+ is answered by the host before the page, unless the operator bound ⌘⇧= to a command, in which case that binding wins. - **Please judge**: zoom is Chromium's per-host level inside a Workspace's page partition, so same-host pages in one Workspace zoom together (Chrome behaves the same). Nothing is persisted. - **Files to watch**: `desktop/src/main/host.ts` - `sendCommand` is the app-menu path for every command; the zoom branch runs only for the three text-size ids while a visible page is focused. - **Files to watch**: `desktop/src/main/browser.ts` - pinch limits are re-applied on every main-frame `did-navigate`, because they live in the renderer and a cross-site navigation swaps it (failure path: a rejected call is logged as `browser.pinch_zoom_failed`). ## Evidence - **Confirmed**: new desktop e2e `zoom:` drives the menu commands with the page focused and checks the zoom steps 1.1, 1.25, 1.1, 1, 0.9, 1, plus ⌘⇧= to 1.1. The page keeps focus throughout and no `pane_text_scale` / `editor_text_scale` is sent. - **Confirmed**: the same e2e moves focus to the shell, and `text_larger` / `text_reset` then send exactly one text-scale event each while the page zoom stays put. - **Confirmed**: a CDP pinch gesture raises `visualViewport.scale` above 1.2, and does so again after the page navigates to another site in a new renderer process (PID checked). - **Confirmed**: the pinch assertions are not vacuous. With the limits call removed, the first pinch fails. With it applied only once, the post-navigation pinch fails. - **Confirmed**: native keys through macOS. A throwaway spec posted real CGEvent key presses to the dev app's process on the operator's Mac. With the page focused: ⌘= 1.1, ⌘= 1.25, ⌘⇧= 1.5, ⌘- 1.25, ⌘0 1, each once. With the shell focused: ⌘= and ⌘0 each sent one text-scale event and the page did not zoom. - **Confirmed**: `browserSync.test.ts` unit-tests the step table against Chromium's `kPresetZoomFactors`, the clamping at both ends, and off-step starting values. - **Confirmed**: the `browser.spec.ts`, `keys.spec.ts` and `close-policy.spec.ts` desktop suites passed (7/7), along with desktop typecheck, lint and unit tests (44). - **Not confirmed**: a physical trackpad pinch. Pinch was proven with CDP `Input.synthesizePinchGesture`, not by hand. - **Not confirmed**: the ⌘⇧= override when an operator binds that chord to a command. It is covered by code only, not by a test. - **Not confirmed (flaky)**: across repeated local runs, the long `browser:` test failed some of the time at `browser.spec.ts:350`, the `enterWorkspace` after a relaunch. That is the known relaunch race from #166 and outside this diff. <details><summary>More evidence</summary>  </details> **AI tooling**: mostly AI tools. By hand I compared each zoom step, focus state and text-scale count against the e2e output and the native key-press transcript.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #149 (the desktop host)
Summary
Finder나 Dock에서 연 패키지 hide.app은 launchd의 PATH(
/usr/bin:/bin:/usr/sbin:/sbin)로 시작합니다.운영자 머신에서 5초 로그인 셸 조회가 실제 zsh rc(웜 2.4초, 콜드는 더 김)에 타임아웃됐고, 창이 "hide CLI not found"에 머물렀습니다.
이제 CLI 탐색 순서는
HIDE_CLI_PATH-> (비패키지) 워크트리 빌드 -> PATH -> 마지막으로 붙은 CLI -> 로그인 셸 PATH(패키지만, 10초) ->~/.local/bin,/opt/homebrew/bin,/usr/local/bin입니다.붙은 CLI는 프로필의
cli-path.json에 기억되어, 두 번째 실행부터는 느린 로그인 셸을 부르지 않습니다.실패 화면은 그대로이고, 시도한 경로는 모두 한 번씩 로그에 남습니다.
Review
shellEnvironmentResolutionTimeout기본값). 실패는 캐시하지 않아 Retry가 다시 묻습니다desktop/src/main/cli.ts-resolveCli가 async가 됐고 로그인 셸은 앞 단계가 모두 빗나갈 때만 호출됩니다desktop/src/main/host.ts- failure path: 로그인 셸 조회 중 quit/Retry,hide connect성공 뒤에만 기억을 씁니다desktop/src/main/env.ts-HOME을 레지스트리에 추가. Electronapp.getPath("home")은HOME을 무시해 격리 QA가 운영자 CLI를 찾았습니다desktop/e2e/fixture.ts- 이미 떠 있는 데몬에 다시 붙는 relaunch는relaunch()로 메인 프로세스에서 창을 읽습니다(아래 Evidence)/usr/bin/env DISABLE_AUTO_UPDATE=true ZSH_TMUX_AUTOSTART*=...로 감싸 Oh My Zsh 업데이트 프롬프트와 tmux 자동 시작을 막습니다RuntimeEnvironment.swift의 fallback과 같습니다.jsonFile.ts는windowState.ts의 원자적 쓰기를 뽑아낸 것입니다Evidence
pnpm --dir desktop typecheck,lint,test(30개, 새 순서 테스트 6개와 기억 파일 파싱, 실제/bin/sh로그인 조회 포함) 통과pnpm --dir desktop e2e8/8, 새discovery테스트: PATH를 launchd 값으로,HIDE_CLI_PATH없이, 워크트리 밖으로 복사한 앱에서~/.local/bin으로 붙고cli-path.json을 쓴 뒤 재실행은remembered로 붙음pnpm --dir desktop package)을env -i로 launchd 같은 환경, 비공개 HOME/state/profile/socket으로 세 번 실행login으로 붙고 기억 (cli.login_pathelapsed 3243ms)remembered로 0.1초 안에 붙음~/.local/bin에서well-known으로 붙음. 사건 시나리오 그대로hide stop, 남은 프로세스 없음. 운영자 hided와 상태 디렉터리는 건드리지 않음python3 -m unittest discover -s scripts/tests(39),check-no-workstation-identity.sh,check-no-attribution.py통과discovery실패는 relaunch 경합이었습니다. 로컬 반복에서 기존lifetime도 같은 모양으로 실패했습니다file://에 머물거나 window 이벤트가 안 옵니다rmSync는 ENOTEMPTY를 재시도합니다(main에서도 16회 중 1회 재현)lifetime/discovery반복 30회 통과(운영자 화면 때문에 중간에 멈춤). e2e 창은 여전히 화면에 뜨며, 숨김 실행은 이 PR에 넣지 않았습니다env -i와 가짜 셸로 흉내낸 것입니다