Repository navigation
fix(hooks): emit verb checklist on both channels - #933
Conversation
#931 이 체크리스트를 decision JSON → stderr 로 옮겼는데, ask 경로에서는 모델에 도달하지 않는다. hooks/_lib/_dispatch.py 의 종료 코드 분기: :201 deny → return 2 :207 ask → return 0 PreToolUse 훅의 stderr 는 exit 2 일 때만 모델에 전달된다. 따라서 형제 게이트가 아무도 deny 하지 않는 일반적인 경우(output-block-falsify-advisory 단독 ask) 체크리스트는 exit-0 stderr 로 나가고 소실된다. #931 이전에는 permissionDecisionReason 안에 있어 표면화됐으므로 회귀다. 수정: 양쪽 채널 동시 emit. - reason 문자열 → 단독 ask(exit 0)에서 도달 - stderr → 형제 게이트 deny 선행(exit 2)에서 도달 deny 는 항상 exit 2 라 momentum 은 stderr 만으로도 충분하지만, 두 훅 처리를 갈라둔 것이 이 결함의 원인이므로 동일하게 맞춘다. 검증: - fix-up probe: dispatcher exit=0 경로에서 reason 에 체크리스트 FOUND, stderr 에도 유지 (수정 전 동일 probe 는 reason MISSING) - NC3 falsify reason 채널 제거 → #932 케이스 3건 FAIL (104/3), 복원 후 107/0 - NC4 momentum reason 채널 제거 → 토큰 5개 missing from decision JSON, FAIL (87/1), 복원 후 88/0 - PRAXIS_TESTS_STRICT=1 ./scripts/run-tests.sh → ALL TESTS PASSED Closes #932 Confidence: high Premise-Verified: _dispatch.py:195-207 종료 코드 분기를 dispatcher 직접 실행으로 실측 Not-tested: exit 2 경로의 stderr 표면화는 코드 근거만 — 7.8.0 미배포로 런타임 실측 없음 Session-Id: c16298d9-ce90-4536-8b4b-3d63818b411d
|
Warning Review limit reached
Next review available in: 33 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe hooks now emit verb-gate checklists through both decision reasons and stderr. Merge-deny and AskUserQuestion paths were updated, with documentation and regression tests covering both output channels. ChangesVerb checklist delivery
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: 🚥 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 |
reviewdog markdownlint MD018 지적 2건 반영. 문장이 `#873` 으로 줄을 시작해 ATX heading 으로 파싱됐다. reviewdog 제안(`# 873`)은 실제 h1 헤딩을 만들어 의미를 바꾸므로 채택하지 않고, "Issue #873 ..." 으로 어순을 바꿨다. 검증: markdownlint MD018 0건 (잔여 8건은 기존 지적), pytest 527 passed, manifest check OK, falsify 107/0, momentum 88/0. Refs #932 Confidence: high Session-Id: c16298d9-ce90-4536-8b4b-3d63818b411d
reviewdog markdownlint 2건 반영 (
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/hooks/advisory-nudge/test_momentum_rule_retrieval_gate.sh (1)
740-750: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winValidate the complete checklist contract, not selected tokens.
Both regression tests can pass when only part of the registry-defined checklist is emitted.
tests/hooks/advisory-nudge/test_momentum_rule_retrieval_gate.sh#L740-L750: assert every registeredgh pr mergetoken in stderr and the parsedpermissionDecisionReason, instead of checking a partial list and raw stdout.tests/hooks/advisory-nudge/test_output_block_falsify_advisory.sh#L304-L324: assert every registeredAskUserQuestiontoken in both channels, instead of checking only the triggering gate.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/hooks/advisory-nudge/test_momentum_rule_retrieval_gate.sh` around lines 740 - 750, Update tests/hooks/advisory-nudge/test_momentum_rule_retrieval_gate.sh lines 740-750 to derive every registered gh pr merge checklist token, asserting each appears in stderr and the parsed permissionDecisionReason rather than raw stdout or a partial list; update tests/hooks/advisory-nudge/test_output_block_falsify_advisory.sh lines 304-324 similarly to derive and assert every registered AskUserQuestion token in both output channels, preserving the existing failure reporting.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tests/hooks/advisory-nudge/test_momentum_rule_retrieval_gate.sh`:
- Around line 740-750: Update
tests/hooks/advisory-nudge/test_momentum_rule_retrieval_gate.sh lines 740-750 to
derive every registered gh pr merge checklist token, asserting each appears in
stderr and the parsed permissionDecisionReason rather than raw stdout or a
partial list; update
tests/hooks/advisory-nudge/test_output_block_falsify_advisory.sh lines 304-324
similarly to derive and assert every registered AskUserQuestion token in both
output channels, preserving the existing failure reporting.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: c5729678-f854-4341-a7f6-a35d7a84f476
📒 Files selected for processing (7)
docs/hook/INDEX.mdhooks/advisory-nudge/momentum-rule-retrieval-gate/impl.pyhooks/advisory-nudge/momentum-rule-retrieval-gate/spec.mdhooks/advisory-nudge/output-block-falsify-advisory/impl.pyhooks/advisory-nudge/output-block-falsify-advisory/spec.mdtests/hooks/advisory-nudge/test_momentum_rule_retrieval_gate.shtests/hooks/advisory-nudge/test_output_block_falsify_advisory.sh
CodeRabbit nitpick 반영. 두 셸 테스트가 게이트 토큰을 하드코딩된 부분 목록으로 검사하고 있었다 — momentum 은 5개만 보는데 _VERB_CHECKLISTS 의 `gh pr merge` 항목에는 8개가 등록돼 있어 momentum-rule-retrieval-gate / pipefail-advisory / skill-gate-commands 가 무검사였다. 이 PR 계열이 없애려는 under-enumeration 결함이 테스트 쪽에 남아 있던 셈이다. - verb_gate_checklist() 출력에서 `←` 태그된 게이트명을 정규식으로 도출해 전수 검사. 레지스트리에 항목이 늘면 테스트가 자동으로 따라간다. - raw stdout grep → 파싱된 permissionDecisionReason 대조. JSON 봉투의 다른 필드에 매칭되는 오진을 막는다. - falsify 쪽 개별 run_case 6건을 파생 전수 케이스 2건으로 대체. - momentum 의 relief 문구(PRAXIS_MOMENTUM_MERGE_ADVISORY=1, briefing-surfaced:)는 `←` 태그가 아닌 산문이라 파생 불가 — 명시 유지하고 주석에 이유를 남겼다. 검증: - 파생 토큰 수 merge 8개(기존 하드코딩 5개), AskUserQuestion 5개 - NC5 falsify reason 채널 제거 → 게이트 5개 전부 missing from decision reason, FAIL 2건 (101/2), 복원 후 103/0 - NC6 레지스트리에서 pipefail-advisory 제거 → 파생 8 → 7, 복원 8. 파생이 레지스트리를 실제로 추종함 확인 - PRAXIS_TESTS_STRICT=1 ./scripts/run-tests.sh → ALL TESTS PASSED Refs #932 Confidence: high Session-Id: c16298d9-ce90-4536-8b4b-3d63818b411d
CodeRabbit nitpick 반영 (
|
| 항목 | 결과 |
|---|---|
| 파생 토큰 수 | gh pr merge 8개 (기존 하드코딩 5개), AskUserQuestion 5개 |
| NC5 — falsify reason 채널 제거 | 게이트 5개 전부 missing from decision reason, FAIL 2건 (101 passed / 2 failed), 복원 후 103/0 |
NC6 — 레지스트리에서 pipefail-advisory 제거 |
파생 8 → 7, 복원 8. 파생이 레지스트리를 실제로 추종함 확인 |
| 전체 스위트 | PRAXIS_TESTS_STRICT=1 ./scripts/run-tests.sh → ALL TESTS PASSED |
앞선 보고 정정
직전 코멘트에서 "CodeRabbit 은 rate-limit 이라 리뷰가 수행되지 않았다"고
적었는데, 그 이후 제한이 풀려 실제 리뷰(00:37:30Z)가 들어왔습니다. 위 nitpick
이 그 리뷰의 결과입니다.
문제
PR #931 (
23b0b4a) 이 verb 게이트 체크리스트를 decision JSON → stderr 로옮겼습니다. deny 경로는 의도대로 동작하지만 ask 경로에서는 체크리스트가
모델에 도달하지 않습니다 — #931 이전에는
permissionDecisionReason안에있어 표면화됐으므로 회귀입니다.
hooks/_lib/_dispatch.py의 종료 코드 분기::201return 2:207return 0PreToolUse 훅의 stderr 는 exit 2 일 때만 모델에 전달됩니다. 형제 게이트가
아무도 deny 하지 않는 일반적인 경우(
output-block-falsify-advisory단독 ask)체크리스트는 exit-0 stderr 로 나가고 소실됩니다.
수정 전 probe:
수정
양쪽 채널 동시 emit.
output-block-falsify-advisory:_with_verb_checklist()신설 →_emit_ask/_emit_t1_ask가 reason 에 append._emit_verb_checklist()의 stderr write 는 유지.
momentum-rule-retrieval-gate: 동일하게 stderr + reason. deny 는 항상exit 2 라 stderr 만으로 충분하지만, 두 훅 처리를 갈라둔 것이 이 결함의
원인이므로 동일하게 맞췄습니다.
각 채널이 커버하는 케이스:
검증
Pre-commit verified:
PRAXIS_TESTS_STRICT=1 ./scripts/run-tests.sh→ALL TESTS PASSED(manifest OK, hook-token 7 invariants OK, ruff clean,shellcheck clean)
Caller chain verified:
_dispatch.py:195-207의 종료 코드 분기를 dispatcher직접 실행으로 실측 — ask 경로
exit=0, deny 분기return 2. 호출 지점은_emit_ask/_emit_t1_ask(falsify),_merge_escalation_reason직후(momentum) 2곳뿐임을 grep 으로 확인.
fix-up 증상 소멸 확인 (동일 probe, 수정 후):
음성대조:
missing from decision JSON, FAIL (87/1), 복원 후 88/0문서
momentum .../spec.md,output-block-falsify-advisory/spec.md,docs/hook/INDEX.md의 "stderr 로만 보낸다" 서술을 exit code 별 도달 채널설명으로 정정했습니다.
미검증
exit 2 경로에서 stderr 가 실제로 모델에 전달되는지는 코드 근거까지만입니다
(7.8.0 미배포). exit-0 경로의 비가시성은 #874 본문 실측(ADVISE 42건 발화 /
효과 0건)이 뒷받침합니다.
Closes #932
Summary by CodeRabbit
Bug Fixes
Documentation
Tests