Repository navigation
Windows agent hook: 각 런타임이 Windows에서 실행하는 형태로 hook 항목을 씁니다 - #344
Merged
Merged
Conversation
Claude Code's Windows entry runs PowerShell in exec form and Codex's is a PowerShell guard its session shell runs; the macOS and Linux bytes stay as version 6 wrote them, pinned by a test. The marker is read from an entry's args as well as its command, and the helper is named with .exe on Windows.
… there Windows has no nonblocking pipe read, so a reader thread collects stdin and the helper stops waiting at the same deadline. PowerShell re-encodes what the helper prints there, so the JSON goes out in ASCII. The deadline test now passes the flag that reads stdin, and the helper finds hide.exe beside it.
The test installs both entries, then starts them as Claude Code and Codex do on Windows, under Windows PowerShell and PowerShell 7, with the real helper moved away and then in place. The agent hooks document says which form each runtime runs and where that is documented or read from its source.
…ferred The Windows test now enables Memory for its Project, so only a helper that read the session from stdin answers with a receipt, and its folder name has brackets and a $. The documents say PowerShell can re-encode output rather than that it does, cite Codex 0.155.1 too, and name the section that holds the Windows forms.
The pinned path moves to /Users/example/o'brien; the bytes around it are the same format version 6 wrote.
The prompt hook's path context stripped a `\\?\`-less cwd against the project's `\\?\` checkout root, which never matched on Windows, so a linked worktree lost its checkout-relative path. Both now go through the platform's canonical spelling. The diagnosis test names the settings file in the system's separators.
Contributor
Author
|
머지 준비 완료 b2fef2f |
yansfil
added a commit
that referenced
this pull request
Oct 3, 2026
Related: #293 (batch 7, 항목 4) ## Summary `pnpm --dir desktop package`가 macOS `hide.app`만 만들던 것을, 실행한 시스템의 패키지를 만들도록 넓혔습니다. Windows x64는 폴더를 zip으로, Linux x64는 폴더를 tar.gz로 묶고 각각 `.sha256`을 붙입니다. 둘 다 서명하지 않습니다(운영자 결정 2026-10-03). macOS는 지금처럼 ad-hoc 서명입니다. 새 `package.yml`이 windows-latest와 ubuntu-latest에서 각 패키지를 만들고, 압축을 풀어 창 없이 띄워 봅니다(`smoke-package.mjs`). release는 이 워크플로를 불러 세 패키지를 한 draft에 올립니다. smoke를 준비하다 Windows에서 `hide connect`가 성공할 수 없던 원인 세 가지를 고쳤습니다: `hided.exe`가 아니라 `hided`를 찾았고, `/health`를 `/usr/bin/curl`로 물었고, detach한 `hided`가 CLI의 stdout 파이프를 상속해 호출자(데스크톱 앱)가 출력 끝을 영영 못 보게 됩니다. ``` ok checksum / unpack / bundled files / herdr --version / hide-host-helper-<os>-x86_64 --version ok hide-agent-hooks doctor --json / Electron runs the bundled hcoord as Node ok hide connect starts the bundled daemon / the daemon answers /health / serves the web shell it embeds / hide stop ends it ``` ## Review - **판단해 주세요**: 형식은 같은 도구(@electron/packager) 그대로 zip(Windows)과 tar.gz(Linux)입니다. 설치 프로그램(NSIS/MSIX)이나 AppImage/deb는 다른 도구가 필요하고, 서명 없이 얻는 것이 없어 뒤로 미뤘습니다. tar.gz는 실행 비트를 보존합니다. - **판단해 주세요**: `package.yml`은 PR에서는 패키지에 들어가는 경로(`desktop/scripts/**`, `desktop/package.json`, `desktop/resources/**`, Herdr pin과 fetch 스크립트, `verify-cargo.sh`, 워크플로 자신)를 바꿀 때만 돌고 `verify`에 넣지 않았습니다. 콜드 release 빌드라 `windows check`의 몇 배가 들고, 일부 PR에서만 도는 검사는 required가 될 수 없습니다. 패키지는 7일간 artifact로 남아 실기 확인에 쓸 수 있습니다. - **판단해 주세요**: Linux에서 마지막 창을 닫으면 앱이 종료됩니다(macOS만 창 없이 남음). 관례대로 두고 INSTALL과 ARCHITECTURE에 적었습니다. `hided`는 어느 쪽이든 계속 돕니다. - **조심해서 볼 파일**: `hided/src/cli.rs` - failure path. `hide connect`/`status`의 health 확인이 curl fork에서 이미 링크된 `ureq`(프록시 없음, 1초)로 바뀌었습니다. - **조심해서 볼 파일**: `hide-platform/src/process.rs` - ownership. Windows `detach`가 이 프로세스의 표준 핸들 상속 플래그를 끕니다(프로세스 전역 상태). 이후 `Stdio::inherit` 자식은 std가 상속 가능한 사본을 넘기므로 영향 없습니다. 실패는 `io::Result`로 올라가 `start_failed`가 됩니다. - **조심해서 볼 파일**: `hide-kit/src/local.rs` - 화면 문구. macOS 밖에서는 This machine 행이 "Hide installs its kit only from its macOS app, so it installs nothing on this machine"을 보여 줍니다(이전 문구는 "설치된 앱으로 열라"는 거짓 안내). - **조심해서 볼 파일**: `desktop/scripts/package.mjs` - macOS 경로를 공유합니다. 로컬에서 macOS 패키지를 한 번 만들어 서명, RunAsNode 확인, 아이콘, Resources 목록이 그대로인 것을 봤습니다. - **조심해서 볼 파일**: `.github/workflows/release.yml` - 태그 없이는 돌릴 수 없습니다. 각 패키지가 artifact가 되고 `draft` 잡 하나가 체크섬 3개를 확인한 뒤 draft를 하나 만듭니다. - **질문**: Windows/Linux 패키지는 kit(`hide` 링크, 훅, hcoord)을 설치하지 않습니다. `hide_kit::bundled_kit_dir`가 `hide.app/Contents/Resources`만 알아보기 때문입니다. 같은 이유로 새 버전이 이전 버전의 `hided`를 교체하지 않고 거절하므로, INSTALL에 업데이트 전 `resources/hide stop`을 적었습니다. Electron 폴더 구조를 알아보게 할지는 #3(Windows 훅 명령)이 들어온 뒤 정하는 게 맞아 보입니다. 어떻게 할까요? - **원칙**: #2 가장 단순한 형식(새 도구 없음). #3 창 없이 시작까지 증명된 패키지를 먼저, kit/설치기/서명은 그 위에. #4 다른 아키텍처는 거절, 빠진 파일은 이름으로 실패. #7 기존 packager, 시스템 tar, 이미 있는 `ureq`. #12 새 테스트와 smoke 모두 심은 버그로 수익을 확인. #14 smoke와 테스트는 시작한 데몬을 모든 경로에서 멈춤. - hcoord는 macOS와 같은 `resources/hcoord/dist`로 넣었습니다. #3이 `hide-kit/src/hcoord.rs`에 Windows 런처를 넣어도 패키지 내용은 바뀌지 않고, kit이 Windows 패키지에서 켜질 때 런처가 쓰입니다. ## Evidence - **확인한 것**: 새 `connect_stop` 테스트가 macOS에서 통과. `hided` 이름에 `.exe`를 붙이는 버그를 심으면 `start_failed`, health 확인을 깨면 `no_response`로 실패. - **확인한 것**: 새 OS contract 테스트(detach한 자식이 부모 출력을 붙잡지 않음)가 macOS에서 통과. 자식에 stdout을 상속시키는 버그를 심으면 15초 뒤 실패. Windows에서의 결과는 아래 CI. - **확인한 것**: smoke 스크립트를 로컬 debug 바이너리로 만든 Linux 구조의 가짜 tar.gz에 돌려 11개 확인 모두 통과. `hided`를 시작 못 하는 파일로 바꾸면 `hide connect` 단계에서 이름을 달고 실패. - **확인한 것**: `HIDE_VERSION=0.0.0-local.1 pnpm --dir desktop package`로 macOS 패키지 생성(서명 검증 통과), 확인 후 출력과 `target/release` 삭제. `/Applications/hide.app`은 건드리지 않음. - **확인한 것**: `verify-cargo.sh lint`, 워크스페이스 테스트 57 suite, desktop lint/typecheck/test, script suite, pin single-source 검사. - **확인한 것**: 첫 push(head `5ff03f0d`)에서 `verify` run 37123328975 전부 green. `windows check`에서 `connect_stop` 통과(0.4초), `os contract (windows)`에서 새 detach contract 통과. - **확인한 것**: `package` run 37123328851 green. Windows: release 빌드 14m51s, 잡 17분, zip artifact 약 200 MB. Linux: 빌드 7m28s, 잡 9분, tar.gz 약 164 MB. 두 runner 모두 smoke 11개 확인 통과(`hide connect` -> `/health` -> 내장 셸 -> `hide stop` 포함). - **리뷰(별도 subagent)**: Fix now 4건 모두 반영 - Windows 핸들 상속(위), smoke가 timeout으로 죽인 `hide`의 출력을 받아들이던 것, 사실과 다른 kit 안내 문구, Windows에서 WSL `bash`가 잡힐 수 있는 소스 빌드(문서에 Git Bash 명시). 경로 필터 보강, `CARGO_BIN_EXE_hide`, stop 실패가 원래 오류를 가리던 것도 반영. - **확인하지 못한 것**: #344, #345 위로 rebase한 head `ff1730f5`에서 `verify`의 `web e2e linux 2/6`이 두 번(재실행 포함) 실패. `cmdk.spec.ts:394`(프로젝트 3개, `catalog.root_unresolved`)와 재실행 때 `new-tab.spec.ts:71`. 둘 다 main `39000d6a`와 직전 head에서는 통과했고, 이 PR이 닿지 않는 경로라 #288에 기록. `package`는 이 head에서도 green(run 37125618484). - **확인하지 못한 것**: 실제 Windows/Linux 기기에서 창을 띄운 적 없음(SmartScreen 화면, chrome-sandbox 메시지, Herdr 서버 자동 시작 포함). release 워크플로는 태그가 없어 실행하지 않음. - **확인하지 못한 것**: Windows 데스크톱 호스트의 경로/PATH 처리는 #2(별도 PR) 몫이라 이 패키지에 반영되지 않음. Refs #293
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: with-hide/hide-private#103 (batch 7, 세 번째 PR)
Summary
hide-agent-hooks는 Claude Code와 Codex 설정에/bin/sh문법의 hook 명령만 썼습니다. Windows에서는 두 런타임 모두 그 명령을 sh로 돌리지 않습니다.이제 각 런타임이 Windows에서 실제로 hook을 실행하는 방식에 맞춘 형태로 씁니다. macOS/Linux 바이트는 그대로이고, 테스트가 그 바이트를 고정합니다.
"command": "powershell.exe", "args": ["-NoProfile", "-NonInteractive", "-Command", <guard>](exec form이라 Git Bash 유무와 상관없음)"command": <guard>(Codex는 세션 셸, Windows에서는 PowerShell-NoProfile -Command로 실행)<guard>=if (Test-Path -LiteralPath '<kit>\hide-agent-hooks.exe' -PathType Leaf) { & '<kit>\hide-agent-hooks.exe' hook ... }도우미 쪽도 맞췄습니다. Windows에서는 stdin을 reader thread로 마감 시각까지만 기다리고, JSON을 ASCII(
\uescape)로 출력하며, 옆의hide.exe를 찾습니다.windows check가 두 entry를 런타임이 띄우는 그대로(Windows PowerShell과 PowerShell 7) 실제 도우미로 실행합니다.Windows에서 이 crate의 테스트를 처음 돌리자 기존 버그 하나가 드러났습니다. prompt hook의 path context가
\\?\없는 cwd를\\?\가 붙은 checkout root와 비교해서, linked worktree의 상대 경로를 잃었습니다. 이제 둘 다 같은 표기로 맞춰 비교합니다(memory.rscanonical_path_context).Review
transport.ts:46이 win32에서 daemon 연결을 거절하고,identity.ts:36은 macOS/Linux만,platform.ts:77daemon 시작은 macOS만 지원합니다.hide-kit/src/hcoord.rsunsupported_system). launcher를 써도 아무도 설치하지 않는 죽은 코드가 됩니다(원칙 1, 2).cmd-shim처럼.cmd).cmd로 떨어지는 경우는 지원하지 않습니다(PowerShell을 못 찾거나 세션이 셸을 보고하지 않을 때만). 그때 hook은 cmd 문법 오류로 실패하고 turn은 계속됩니다. 대안인powershell -EncodedCommand는 PowerShell을 두 번 띄우고 운영자가 읽을 수 없어 택하지 않았습니다.hide-agent-hooks/src/memory.rs: high-frequency path(매 prompt)입니다. canonicalize가 하나 늘었고 Unix 결과는 같습니다.hide-agent-hooks/src/install.rs: 운영자 소유 파일 writer입니다. marker를command와args양쪽에서 찾아야 재설치가 수렴하고, 제거도 Hide 항목만 가져갑니다. 경로는 PowerShell 따옴표 규칙(', U+2018/2019/201A/201B를 두 번 씀)으로 읽고 씁니다.hide-agent-hooks/src/bin/hide-agent-hooks.rs: failure path입니다. Windows stdin reader thread는 마감에서 놓고, 막힌 thread는 프로세스 종료와 함께 끝납니다.hide-agent-hooks/tests/hook_deadline.rs: 이제 실제 entry처럼--memory-injection을 넘깁니다. 그 전에는 stdin을 읽지 않아서 이 테스트가 증명하는 것이 없었습니다.hide_platform::fs::atomic::write_file(Windows에서는 계정 전용 ACL), stdin cap은read_bounded, marker는 기존hide-subagents@6을 씁니다.windows check가 Windows에서 돌립니다.commandstring is passed to a shell:sh -con macOS and Linux, Git Bash on Windows, or PowerShell when Git Bash isn't installed." / exec form은 "No shell tokenization happens on any platform."args는 changelog 2.1.139부터 있고, Memory 최소 버전 2.1.278보다 낮습니다.commandWindowsis an optional Windows-only command override." 무엇이 실행하는지는 문서에 없어서 소스를 읽었습니다.rust-v0.160.0과 최소 버전rust-v0.155.1에서 같습니다:core/src/session/mod.rsbuild_hooks_config(세션 셸),shell-command/src/shell_detect.rsdefault_user_shell(Windows = PowerShell),core/src/shell.rsderive_exec_args(-NoProfile -Command),hooks/src/engine/command_runner.rsbuild_command(셸이 없을 때%COMSPEC% /C).hide_kit::bundled_kit_dir가 Windows 앱 레이아웃을 알아야 합니다. 지금은.app/Contents/Resources만 압니다. PR 4에서 할까요, 별도 PR로 할까요?Evidence
cargo test -p hide-agent-hooks -p hide-kit이 모두 통과합니다(unit 47 + 2, 마감 1, kit 40). clippy-D warnings와cargo fmt --check도 통과합니다.the_posix_entry_is_exactly_what_macos_and_linux_have_installed는 수정 전origin/main91877ba9의hook_group출력을 찍어 고정한 바이트와 비교합니다(따옴표 escape 포함).the_windows_entries_are_powershell_guards_hide_reads_back는 세 OS 모두에서 Windows entry 전체 바이트를 확인하고, 공백·'·’가 든 경로가 그대로 읽혀 돌아오는지 봅니다.windows check(run 37122891893)에서cargo test -p hide-agent-hooks전체가 Windows에서 통과했습니다(unit 47, 마감 1, Windows 통합 1, 9.4 s).it's [1] $x here폴더에 두고 돌렸습니다. Claude Code entry는 exec form, Codex entry는powershell.exe와pwsh.exe양쪽입니다. 도우미가 없을 때는 exit 0에 출력이 없고, 있을 때는…가 든 문맥이 ASCII JSON으로 그대로 건너왔습니다.windows check결과로만 증명됩니다. 실제 Windows 기기와 실제 Claude Code/Codex로는 돌려 보지 않았습니다(운영자 결정 2026-10-03, VM 없음).args를 모름)은 확인하지 않았습니다.bundled_kit_dir).Refs with-hide/hide-private#103