Skip to content

fix(hooks): emit verb checklist on both channels - #933

Merged
devseunggwan merged 3 commits into
mainfrom
issue-932-fix-checklist-exit0-reach
Aug 3, 2026
Merged

devseunggwan merged 3 commits into
mainfrom
issue-932-fix-checklist-exit0-reach

Conversation

@devseunggwan

@devseunggwan devseunggwan commented Aug 2, 2026 •

Copy link
Copy Markdown
Owner

문제

PR #931 (23b0b4a) 이 verb 게이트 체크리스트를 decision JSON → stderr 로
옮겼습니다. deny 경로는 의도대로 동작하지만 ask 경로에서는 체크리스트가
모델에 도달하지 않습니다
— #931 이전에는 permissionDecisionReason 안에
있어 표면화됐으므로 회귀입니다.

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 로 나가고 소실됩니다.

수정 전 probe:

$ printf '%s' "$payload" | python3 hooks/_lib/_dispatch.py PreToolUse AskUserQuestion claude
dispatcher exit=0
stderr 1660 bytes, "Every gate on `AskUserQuestion`" 포함
stdout permissionDecisionReason → 체크리스트 MISSING

수정

양쪽 채널 동시 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 만으로 충분하지만, 두 훅 처리를 갈라둔 것이 이 결함의
    원인이므로 동일하게 맞췄습니다.

각 채널이 커버하는 케이스:

경로 dispatcher exit 도달 채널
falsify 단독 ask (일반) 0 reason 문자열
형제 게이트 deny 선행 2 stderr (이 훅의 stdout 은 버려짐)

검증

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, 수정 후):

dispatcher exit=0
reason 안 체크리스트 → FOUND, block-ask-end-option 포함
stderr 체크리스트 → 유지 (grep -c = 1)

음성대조:

대조 결과
NC3 — falsify reason 채널 제거 #932 케이스 3건 FAIL (104 passed / 3 failed), 복원 후 107/0
NC4 — momentum reason 채널 제거 토큰 5개 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

    • Checklists now appear in both decision messages and stderr for merge-denial and AskUserQuestion flows.
    • AskUserQuestion checklists remain visible when the dispatcher returns successfully or another gate blocks first.
    • Parallel deny scenarios retain checklist visibility without changing existing message formatting.
  • Documentation

    • Updated checklist delivery guidance and behavior descriptions.
  • Tests

    • Expanded regression coverage for checklist content across decision and stderr output channels.

#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
@devseunggwan devseunggwan self-assigned this Aug 2, 2026
@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@devseunggwan, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 33 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d8901e17-42d7-4626-b5c0-b622bfce0ed1

📥 Commits

Reviewing files that changed from the base of the PR and between 5548171 and 1ff7c78.

📒 Files selected for processing (2)
  • tests/hooks/advisory-nudge/test_momentum_rule_retrieval_gate.sh
  • tests/hooks/advisory-nudge/test_output_block_falsify_advisory.sh
📝 Walkthrough

Walkthrough

The 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.

Changes

Verb checklist delivery

Layer / File(s) Summary
Merge-deny checklist delivery
hooks/advisory-nudge/momentum-rule-retrieval-gate/impl.py, hooks/advisory-nudge/momentum-rule-retrieval-gate/spec.md, tests/hooks/advisory-nudge/test_momentum_rule_retrieval_gate.sh, docs/hook/INDEX.md
Merge denials include the checklist in the decision JSON and stderr. Documentation and tests describe and verify both channels.
Ask-path checklist delivery
hooks/advisory-nudge/output-block-falsify-advisory/impl.py, hooks/advisory-nudge/output-block-falsify-advisory/spec.md, tests/hooks/advisory-nudge/test_output_block_falsify_advisory.sh
Ask decisions append the checklist to the decision reason and retain stderr emission. Tests cover T1 and T2 paths and sibling-gate blocking behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: bug

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: emitting the verb checklist through both channels.
Linked Issues check ✅ Passed The changes restore checklist delivery in both affected hooks, update both channels, add regression coverage, and correct the related documentation for issue #932.
Out of Scope Changes check ✅ Passed All implementation, test, specification, and documentation changes directly support the linked issue objectives.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-932-fix-checklist-exit0-reach

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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
@devseunggwan

Copy link
Copy Markdown
Owner Author

reviewdog markdownlint 2건 반영 (5548171)

docs/hook/INDEX.md:39, output-block-falsify-advisory/spec.md:475 — 문장이
#873 으로 줄을 시작해 MD018(ATX heading, hash 뒤 공백 없음)로 잡혔습니다.

reviewdog 의 제안(```suggestion # 873 shipped stderr-only... ```)은 채택하지
않았습니다. 공백을 넣으면 해당 줄이 실제 h1 헤딩이 되어 문서 구조가
바뀝니다 — 린트는 통과하지만 의미가 틀어집니다. 대신 어순을 바꿔
Issue #873 shipped stderr-only, ... 로 고쳐 이슈 참조를 줄 중간으로 옮겼습니다.

검증:

  • markdownlint-cli2 재실행 → MD018 0건 (잔여 8건은 이 PR 이전부터 있던 지적)
  • pytest tests/ 527 passed
  • check-plugin-manifests.py OK
  • falsify 107/0, momentum 88/0

CodeRabbit 검사 상태

CodeRabbit pass 로 표시되지만 실제 리뷰는 수행되지 않았습니다 —
"Review limit reached, next review available in 18 minutes" 의 rate-limit
경로입니다. 이 PR 은 현재 봇 리뷰 없이 CI(10/10 pass) + reviewdog 지적 반영
상태입니다.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
tests/hooks/advisory-nudge/test_momentum_rule_retrieval_gate.sh (1)

740-750: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Validate 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 registered gh pr merge token in stderr and the parsed permissionDecisionReason, instead of checking a partial list and raw stdout.
  • tests/hooks/advisory-nudge/test_output_block_falsify_advisory.sh#L304-L324: assert every registered AskUserQuestion token 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

📥 Commits

Reviewing files that changed from the base of the PR and between cf71fe9 and 5548171.

📒 Files selected for processing (7)
  • docs/hook/INDEX.md
  • hooks/advisory-nudge/momentum-rule-retrieval-gate/impl.py
  • hooks/advisory-nudge/momentum-rule-retrieval-gate/spec.md
  • hooks/advisory-nudge/output-block-falsify-advisory/impl.py
  • hooks/advisory-nudge/output-block-falsify-advisory/spec.md
  • tests/hooks/advisory-nudge/test_momentum_rule_retrieval_gate.sh
  • tests/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
@devseunggwan

Copy link
Copy Markdown
Owner Author

CodeRabbit nitpick 반영 (1ff7c78)

지적이 맞았습니다. 두 셸 테스트가 게이트 토큰을 하드코딩된 부분 목록으로
검사하고 있었습니다 — momentum 은 5개만 보는데 _VERB_CHECKLISTS 의
gh pr merge 항목에는 8개가 등록돼 있어 다음 3개가 무검사였습니다:

  • 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:)는 ← 태그가 아닌 산문이라 파생 대상이 아닙니다 — 명시
유지하고 주석에 이유를 남겼습니다.

검증

항목 결과
파생 토큰 수 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
이 그 리뷰의 결과입니다.

@devseunggwan
devseunggwan merged commit e25689f into main Aug 3, 2026
10 checks passed
@devseunggwan
devseunggwan deleted the issue-932-fix-checklist-exit0-reach branch August 3, 2026 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(hook): verb checklist lost on exit-0 ask path

1 participant