Repository navigation
fix(hooks): fall through when a launcher's impl is absent - #1066
Conversation
런처가 impl 을 못 띄우면 그 종료 코드가 그대로 호스트에 나간다. `@fail_open`
은 impl 안에서 도는 장치라 impl 이 뜨지 못한 경우에는 손쓸 자리가 없다.
파이썬은 파일을 못 열면 exit 2 를 내는데, 이 리포에서 2 는 deny 다
(`_dispatch.py` 가 `rc == 2` 로 집계). 부분 설치나 플러그인 디렉터리 드리프트로
impl.py 가 없으면, 아무도 내리지 않은 차단이 매칭되는 모든 호출에 걸린다.
$ python3 -c "...subprocess.run([sys.executable,'/missing.py'])..."
missing-file exit: 2
세 템플릿(python / body-as-sh / dispatch) 모두 exec 앞에 impl 존재 확인을
넣고 런처 49개를 재생성한다. `exec` 과 shebang 존중은 그대로이고 프로세스도
늘지 않는다.
비0 을 일괄 0 으로 접는 형태(`… || exit 0`)는 기각했다. 그것은 `return 2` 로
차단하는 훅 41개의 deny 를 함께 삼킨다 — 측정으로 확인했고 PR #1052 스레드에
근거와 함께 회신했다.
이슈 본문의 피해 서술("문법 오류 하나로 모든 호출이 막힌다")도 과장이었다.
Claude Code 에서 PreToolUse 를 차단하는 코드는 exit 2 뿐이고 exit 1 은
non-blocking 이다. 실제 차단 경로는 impl 부재 하나이며, 이 커밋이 닫는 것도
그것이다.
Closes #1053
Confidence: high
Not-tested: codex / cursor / opencode 호스트의 종료코드 규약은 미확인 — Claude
Code 문서 1개 표면만 확인했다. 실세션에서 impl 을 지운 상태의 훅 동작은
미검증이며, 런처를 스크래치 트리에 복제한 스텁 실행으로만 확인했다.
Constraint: 비0 일괄 정규화는 deny(exit 2) 를 삼켜 기각
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (52)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughLaunchers now check for their implementation files before execution. Missing implementations return exit code 0. Existing implementations still receive their arguments and preserve deliberate exit codes. Templates, generated hooks, documentation, and regression tests were updated. ChangesLauncher fail-open behavior
Estimated code review effort: 2 (Simple) | ~15 minutes Merge Risk: ⚪ Minimal · up to This change makes missing hook implementations fall through instead of incorrectly blocking, with the reported manifest and launcher checks passing; no actionable merge-blocking risk remains beyond normal review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
무엇이 바뀌나
훅 런처가 자기 impl 을 못 띄울 때, 아무도 내리지 않은 차단이 호스트에 나가던 것을 막습니다. 이 PR 이후 impl 이 없으면 그 훅은 판정하지 않고 통과시킵니다.
원인
@fail_open은 impl 안에서 도는 장치라, impl 이 뜨지 못한 경우에는 손쓸 자리가 없습니다. 그리고 파이썬은 파일을 못 열면exit 2를 내는데, 이 리포에서 2 는 deny 입니다 —_dispatch.py가rc == 2로 결정을 집계합니다.부분 설치, 플러그인 디렉터리 드리프트,
hosts필터가 런처만 쓰고 impl 을 안 쓴 경우가 실제 발생 경로입니다.어떻게 고쳤나
scripts/build-plugin-manifests.py의 템플릿 3개(python / body-as-sh / dispatch) 모두exec앞에 impl 존재 확인을 넣고, 런처 49개를 재생성했습니다.exec과 shebang 존중은 그대로이고 프로세스도 늘지 않습니다.기각한 대안 — 비0 일괄 정규화
PR #1052 의 CodeRabbit 리뷰가 제안한
python3 … || exit 0은 비0 을 구분 없이 접습니다. 이 리포에서는 그것이return 2로 차단하는 훅 41개의 deny 를 함께 삼킵니다. 측정으로 확인했습니다:근거와 함께 해당 스레드에 회신하고 닫았습니다.
이슈 본문의 서술도 정정합니다
#1053 은 "문법 오류가 하나 들어가면 매칭되는 모든 호출이 세션 내내 막힌다"고 적었는데, 성립하지 않습니다. Claude Code 에서 PreToolUse 를 차단하는 코드는
exit 2하나뿐이고exit 1은 non-blocking 입니다 (hooks 문서). 실제 차단 경로는 impl 부재 하나이며, 이 PR 이 닫는 것도 그것입니다. 이슈 본문에 반영했습니다.Pre-commit verified:
python3 scripts/check-plugin-manifests.py→plugin-manifest check OK,bash tests/test_launcher_fail_open.sh→ 9 passed / 0 failedCaller chain verified: 런처 49개는 전부 이 생성기의 산출물이며(
grep -c "^# AUTO-GENERATED by scripts/build-plugin-manifests.py" hooks/*.sh→ 49), 재생성 후check-plugin-manifests.py의 wrapper-drift 규칙이 전량 일치를 확인합니다. 템플릿 문자열의 다른 소비자는 없습니다.Closes #1053
Summary by CodeRabbit
Bug Fixes
Tests
Documentation