Repository navigation
Have Codex trust the Herdr hook the kit installs - #693
Merged
Merged
Conversation
The kit records the hook entries Herdr's Codex integration adds to hooks.json when the kit runs the install, read from the file before and after the call. The Codex trust check lists those recorded entries with Hide's own and selects them through the same exact-match rule, so a Codex first start on a kit-installed machine shows no review screen for Herdr's hook either. An integration the operator installed first has no record and a look-alike command is not byte-equal to one, so neither is trusted. The trust check now runs once after the agents' pieces, because Herdr's integration is only in place then; the Codex hook part still carries its failure.
The agent-hooks guide, the install guide and the architecture guide now say the entry Herdr's integration wrote when the kit installed it is recorded and trusted exactly, that an integration the operator installed first is not, and which agents ask for a hook review (a survey dated 2026-10-07, with Pi and Cursor inferred from documentation).
The hook file is read right after the integration install returns, so the window another writer could land an entry in is that one call. An install that removed or edited anyone else's entry, or added more than four, teaches nothing and forgets what was recorded; an unreadable file leaves the record alone. Recorded entries are handed to the trust check only while Herdr reports the integration current. A new entry and recorded entries still in the file are both kept. Tests cover a foreign entry added after the install, an install that also removed another entry, a pile of entries, an unreadable record, the record's ownership gate, and compare the hash Codex holds with the entry's current one.
A refused learn no longer clears the entries recorded from an earlier install: they were seen when Herdr wrote them and are only ever matched against a byte-equal entry in the file. Recorded entries of a handler type other than command are never expected. The guide now says a machine whose record predates the entries does not heal when Herdr reinstalls.
…hook Only a Herdr that adds a new entry without removing the old one lets such a machine learn it; a refused learn leaves the record as it was.
Contributor
Author
|
Merge check before merge: origin/main 9e9e6a9 is already an ancestor of head f4ec34a, so |
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: PRD
agents/prd/codex-herdr-hook-trust/prd.md· 선행: #670 (Codex hook 신뢰), #668 (kit의 Herdr 연동), #688 (spawn guard)Summary
herdr integration install codex를 부르기 직전과 직후에~/.codex/hooks.json을 읽어, 그 호출이 추가한 항목(event, matcher, 종류, command)을 kit 기록(herdr_hooks)에 남긴다. Herdr의 명령은 hide에 적혀 있지 않다.select_targets가 hide 자기 항목과 같은 글자 단위 일치 규칙으로 함께 고른다. 신뢰 확인은 pass당 한 번이고, 에이전트 부품 설치 뒤로 옮겨 첫 설치에서 한 번의 app-server 세션으로 둘 다 신뢰된다.docs/agent-hooks.md,INSTALL.md,ARCHITECTURE.md에 이 규칙과 2026-10-07 조사 결과를 적었다.Review
상한 4개, 사용자 권한의 쓰기가 필요하고,
config.toml을 직접 쓰는 것보다 더 얻는 것은 없다. 호출 구간 밖의 쓰기, 다른 항목의 삭제나 수정은 막았다.더 막으려면
integration status의 스크립트 경로를 명령에 요구하는 규칙이 필요한데, 손으로 쓴 Herdr 규칙에 가까워 넣지 않았다. 이 잔여 위험을 받아들이시겠습니까?herdr:codex만 있고 항목 기록이 없는 기기(Clean up Settings: six tabs, seven agents, a Hide AI tab and Reopen for unheard panes #668 빌드가 설치)는 학습하지 못한다. Herdr가 이미 쓴 항목은 재설치해도 그대로라 kit에 추가로 보이지 않는다.그 기기는 검토 화면을 한 번 보고, 승인하면 그 해시가 신뢰된다. Herdr가 옛 항목을 지우지 않고 새 항목만 더할 때만 회복하며, 제자리 교체는 기록에 없는 항목의 제거라 거절된다. 이전은 넣지 않았다.
agent_kit::apply뒤로 옮겼다. Herdr 연동이 그때서야 설치되므로 B1에 필요하다. 프로세스와 확인 경로는 그대로 하나다.hide-agent-hooks/src/codex_trust.rs- 신뢰 대상 선택(select_targets,learn_herdr_entries), 가장 먼저 볼 곳.hide-kit/src/agent_kit.rs- 설치 전후 읽기,apply/reports분리.hide-kit/src/lib.rs- 확인 위치와 Codex 부품 실패 전파.hide-kit/src/record.rs-herdr:codex가 있을 때만 항목을 읽는 관문.codex app-server확인은 pass당 1회 그대로이고, 설치 호출마다 hooks.json 읽기 2회, 학습 항목 상한 4개다.Evidence
contracts/herdr-bundle.json과 일치)과 codex-cli 0.160.0, 격리된 Herdr 서버, 비공개 HOME에서 실제 kit pass(hide_kit::apply)를 돌려 봤다.빈
~/.codex에서 한 pass로 7개 항목이 신뢰됐고 Codex가 "Hooks need review" 없이 시작했으며, 첫 턴 뒤herdr agent list에agent_session(sourceherdr:codex)과 hide의hide_hooks토큰이 있었다(B1, 수정 뒤 코드로 다시 확인).반복 pass는
config.toml을 바이트 단위로 그대로 두었다(B6). 운영자가 먼저 설치한 연동은 신뢰되지 않아 Codex가 그 hook 하나만 검토 화면에 올렸다(B2). 같은 이름의 다른 경로 명령도 검토 화면에 올랐다(B3).워크스페이스 전체
cargo test와lint가 통과했다(kit 140개,hide-agent-hooks통합 22개, 단위 25개 이상 포함).auth.json사본의 지문은 끝까지 같았고rm -P로 지웠다.hide.app, 기기(device) 경로, Herdr가 명령을 제자리에서 바꾸는 실제 동작, Herdr 재설치가config.toml의hooks.state를 보존하는지, Cursor와 Pi의 실제 동작은 확인하지 못했다.Verification record
agents/prd/codex-herdr-hook-trust/prd.md(sha256 5efb1726de39a3c658cbe20a3d78b38b17f3e111d72cdce00b2e58ca7ed1a5ae)agents/runs/codex-herdr-hook-trust/verification-report.jsonandagents/runs/codex-herdr-hook-trust/verification-report.md; source fingerprint 303af8c81f58d9b78dfe504150308ce977849713bc2efe752613539d398fa624bash scripts/verify-cargo.sh test(exit 0)bash scripts/verify-cargo.sh lint(exit 0)integration status경로로 명령 교차 확인, 기록 로드 시 상한 검사(이유는 Review에).a_refused_learn_keeps_what_was_recorded_before에 설치 호출 발생 단언 추가,handler_type검사가 세 곳에 겹침.