Repository navigation
fix: check and run each agent CLI as the operator's shell finds it - #1714
Merged
Merged
Conversation
The hook version probe, Codex's trust and daemon commands and the device's herdr looked for programs without the login shell, so an older copy left in an install folder stood in for the one the operator's terminal runs and the hook was refused as needing an update already made. Every lookup now goes through the account's search, hands on the program with the PATH it was found on, and a refusal names the program it judged.
yansfil
added a commit
that referenced
this pull request
Oct 27, 2026
…version (#1720) Related: #1714 (the refusal shape this extends), #1717 (the canary record, which now shows the Minimum column) ## Summary Until now only Claude Code and Codex CLI had a minimum CLI version. Grok, OpenCode, Pi, omp and Antigravity had none, so a too-old CLI still got Hide's hook, plugin or extension and some features broke without saying why. Now each of the seven agents' declarations (`hide-agent-adapter/src/declarations.rs`) carries the oldest CLI version Hide's integration was proven on, plus where that proof lives, and nothing else keeps a copy. Below that version, the kit puts down no hook, plugin or extension for any agent, and the row says why: `Pi 1.0.3 at ~/.local/bin/pi is older than 1.0.4, which Hide's extension needs; update it`. | Agent | Minimum | Proof | | --- | --- | --- | | Claude Code | 2.1.278 | the Memory hook shape (unchanged) | | Codex CLI | 0.155.1 | the oldest version Hide installs into, read from source at `rust-v0.155.1` (unchanged) | | Grok | 1.0.52 | the agent journey ran on 1.0.52 on all three systems (run 39152230964); the 1.0.50 source reading is kept as a note, since a reading is not a run | | OpenCode | 1.18.35 | Windows: a `windows-latest` runner loaded Hide's plugin on 1.18.35 on 2026-10-11, and its helper `spawn` crossed stdin and stdout; macOS/Linux: 1.18.30 shapes, journey 2.0.29 | | Pi | 1.0.4 | extension shapes captured from 1.0.4 (`fixtures/pi-extension/pi-1.0.4.json`), journey 1.0.4 | | omp | 18.7.0 | `fixtures/pi-extension/omp-18.7.0.json`, journey 18.7.0 | | Antigravity | 1.4.2 | Windows: 1.4.2 runs hooks through `cmd /c` with Go escaping, and the encoded PowerShell guard was proven on it; journey 1.4.2 on all three systems (run 39152230964) | ## Review - **규칙 (운영자 결정 2026-10-27)**: minimum은 에이전트마다 하나입니다. macOS·Linux·Windows 모든 시스템에서 통합이 증명된 버전 중 가장 오래된 것을 씁니다. 한 시스템에서만 증명된 버전은 기준이 되지 않고, 시스템별 minimum도 두지 않습니다. 소스를 읽은 것은 실행이 아니므로 증명으로 치지 않습니다. 이 규칙은 `MinimumVersion` doc와 docs/agent-hooks.md에도 적었습니다. 그래서 OpenCode는 1.18.30에서 1.18.35로, agy는 1.4.0에서 1.4.2로, Grok은 1.0.50에서 1.0.52로 올렸습니다. - **조심해서 볼 파일**: `hide-agent-hooks/src/diagnosis.rs` - `program_version`이 CLI의 `--version` 답을 파일의 경로·search·수정 시각·길이 단위로 기억합니다(최대 32개, 버전을 못 읽었을 때만 60초 뒤 다시 물음). docs/agent-hooks.md는 "파일 버전마다 한 번만 묻는다"고 적어 두었는데 763ca34 이후 코드에는 그 캐시가 없었습니다. 이 PR이 다시 넣습니다. - **조심해서 볼 파일**: `hide-kit/src/agent_kit.rs` - guidance(Grok, agy)와 plugin(OpenCode, Pi, omp) 경로가 이미 current인 조각은 건드리지 않고, 새로 쓰거나 교체하려 할 때만 거부합니다. #1714의 hook part와 같은 순서입니다. - **비용 검토**: kit 패스마다 프로그램 수만큼 `stat` 한 번이 늘고, `--version` 하위 프로세스는 CLI 파일이 바뀔 때만 한 번 돕니다. 기억은 32개로 상한을 두었고 넘치면 가장 오래된 것부터 지웁니다. ## Evidence - **확인한 것**: `hide-kit` 새 테스트 `an_agent_older_than_its_minimum_version_gets_no_hook_plugin_or_extension` - 다섯 에이전트에 각각 `0.0.1`이라고 답하는 CLI를 두면 Failed와 `update_agent`가 나오고, 이유에 라벨·버전·경로·minimum이 모두 들어가며 Hide 파일은 쓰이지 않습니다. 같은 CLI가 minimum으로 답하면 Installed가 됩니다. - **확인한 것**: `hide-agent-hooks` 새 테스트 `agent_version` - Unix에서는 스크립트, Windows에서는 npm식 `.cmd` shim으로 같은 CLI를 만듭니다. 두 번 물어도 실행은 한 번이고, 파일이 바뀌면 다시 물어 새 버전을 읽습니다. Windows 레인에서 돕니다. - **확인한 것**: `hide-agent-adapter` 계약 테스트 - 지원하는 모든 에이전트가 `x.y.z` 형식의 minimum과 저장소 안의 증거(파일, 그리고 문서면 heading)를 가지는지 봅니다. `scripts/tests/test_agent_journey_contract.py` - `agent-clis.json`의 CI pin이 모두 minimum 이상인지 봅니다. - **확인한 것**: 로컬 macOS에서 `nextest -p hide-kit`(192), `-p hide-agent-hooks`(388), `-p hide-agent-adapter`(18), clippy `-D warnings`, fmt, `scripts/tests` 681개가 모두 통과했습니다. 나머지 레인은 CI에 맡겼습니다. - **확인한 것**: #1714 테스트(`the_hook_is_judged_by_the_copy_...`)의 CLI 스텁을 이미 시작해 둔 `stand_ins::program`으로 바꿨습니다. 부하가 큰 상황(load 12)에서 새로 쓴 스크립트의 macOS 첫 실행 검사가 750 ms를 넘었고, 캐시가 그 실패를 그 패스 동안 유지해 테스트가 한 번 떨어졌습니다. - **확인한 것**: canary record(`scripts/agent-canary-record.py`)에 Status와 Last passed 사이 Minimum 열을 추가했습니다. 값은 `contracts/agent-journey.json`의 `minimum_version`에서 읽습니다. `test_agent_canary`가 표의 머리줄과 행을 확인하고, 로컬 `scripts/tests` 673개가 main을 머지한 뒤에도 통과했습니다. - **확인하지 못한 것**: 실제 오래된 CLI(예: Pi 1.0.3)로 직접 재본 적은 없습니다. 다섯 에이전트의 `--version` 출력 형식은 CI journey가 pin 버전과 맞추는 답을 근거로 삼았습니다. - **확인하지 못한 것**: Windows에서 kit의 거부 판단 자체. `hide-kit` 테스트는 macOS·Linux에서만 돕니다(docs/INSTALL.md에 unverified 칸으로 적었습니다). - **확인하지 못한 것**: 설치된 앱과 Settings 화면. 화면 코드는 바꾸지 않았고, 웹이 이미 `update_agent` 이유를 모든 조각에 대해 보여 줍니다. - **확인하지 못한 것**: 브랜치 커밋 본문에 bare `Codex's`가 한 번 들어갔습니다. 로컬 attribution 검사가 이를 잡았지만, 이미 푸시된 히스토리라 고쳐 쓸 수 없었습니다. byline이 아니라 대상을 가리키는 표현입니다. <details><summary>Verification record</summary> </details>
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.
Summary
사용자 피드백에서 기기 등록 때 Codex 훅이 "업데이트 필요"로 막혔습니다. 터미널에서 실제로 쓰는 Codex는 nvm에 깔린 0.164였는데, Hide는
~/.local/bin에 남아 있던 옛 0.149에게 버전을 물었습니다.원인은 프로그램을 찾는 방법이 갈라져 있던 것입니다. 에이전트가 있는지는 로그인 셸 기준으로 찾고, 버전 확인, Codex trust와 데몬 명령, 기기의 herdr는 셸을 건너뛰고 찾았습니다.
이제 이 모든 곳이 계정 검색(
hide_platform::programs) 하나로 찾습니다. 찾은 결과는Program(프로그램과 찾은 PATH)으로 넘기고, 실행도 그 PATH로 합니다. 거절 문구에는 어느 파일을 판단했는지 적습니다.product 코드가 이 모듈을 거치지 않고 프로그램을 찾으면(직접 검색, 셸 없는 검색, 파일로 지정) 가드 테스트가 CI를 실패시킵니다.
Review
HookDiagnosis)도 이제 로그인 셸 결과를 읽습니다. 예전에는 일부러 셸을 피했지만, 셸 결과는 프로세스 전체에서 캐시됩니다(시작 파일이 바뀔 때만 다시 읽음). 그래서 추가로 드는 비용은 첫 번째 읽기뿐이라고 판단했습니다.hide-agent-hooks/src/codex_trust.rs,codex_daemon.rs: failure path. Codex를 찾은 PATH 그대로 실행합니다. node의 폴더 trust가 nvm codex를 찾아놓고 nvm 없는 PATH로 실행하던 버그도 이 변경으로 함께 고쳐집니다.hide-kit/src/device.rs: 기기의 herdr를 찾을 때 손으로 적어둔 목록(~/.cargo/bin포함) 대신 계정 검색을 씁니다. 이 값은 옛 labels 플러그인을 지울 때만 쓰입니다.hide-host/src/serve.rs: 계정 검색을 읽지 못하면HookDiagnosis가 조용히 넘어가지 않고 오류를 돌려줍니다.Evidence
the_copy_the_login_shell_finds_wins_over_an_older_one_in_an_install_folder: 셸 쪽 사본이 선택되고, 그 폴더에만 있는 인터프리터로 실행되는지 봅니다.the_hook_is_judged_by_the_copy_the_login_shell_runs_not_an_older_one_in_an_install_folder: 피드백과 같은 모양을 재현합니다. 셸이 없으면 낡은 사본 경로를 적은 거절이 나오고, 셸이 있으면 훅이 설치되는지 봅니다.no_product_code_outside_the_platform_looks_for_a_program_on_its_own: 정상 코드에서는 통과하고,cli_path_with(…, None)을 product 코드에 일부러 넣으면 실패합니다.hide-platform,hide-agent-hooks,hide-kit,hide-host,hide-node의 nextest 1261개가 통과했습니다.-D warnings를 통과했고, workspace 전체가cargo check --all-targets를 통과했습니다.herdr-core와hided의 테스트: 이 Mac의 디스크가 꽉 차서 링크가 실패했습니다(ld: write() failed, errno=28). 두 crate의 변경은 반환 타입을 맞춘 것뿐이라 CI에 맡깁니다.Verification record