Repository navigation
fix(hooks): show each Stop model-rule finding once per session - #252
Conversation
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Review summaryI found one minor problem and no blockers. Review was by reading the diff and the surrounding code. I did not run the tests. P2 (inline,
Behaviour I traced and found sound
Gaps, not blocking
🤖 Generated with Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 66160370c2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…e receipt Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
|
Review summary: no blocking findings. I read the full diff and checked these paths:
Minor, not worth blocking (P3):
I didn't run the tests. The PR reports |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: edbeec8ac0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
Review summaryNo findings at P0–P2. I read the full diff and traced these paths:
Checked and found sound
P3 (optional, no inline comment)
Tests cover the new behaviour well: move, edit, new session, duplicates, and the failed save. |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…s under it (#246) Stop 時の model rules の subject 上限 `SUBJECT_CAP` を,実測に基づいて 250 → 2000 に上げます. あわせて,cap が効くときにキャッシュ済みファイルの finding が落ちる不具合と,1 ファイルも cap に入らないと差分全体を送ってしまう不具合を直します. 当初含めていた「promote 済み rule(`severity: error`)で毎 Stop ブロックする gate」は,ADR-0027(#250)の決定に従って取り除きました. Refs #220 | 項目 | 変更前 | 変更後 | | --------------------------------------------------------------------- | ----------------------------------------------- | ------------------------------------------------------------------------------------------- | | `SUBJECT_CAP` | 250 | 2000 | | cap で他のファイルが外れるとき,全 subject がキャッシュ済みのファイル | judge から外れ,キャッシュ済み finding が消える | 費用 0 として必ず渡し,finding を報告する | | 1 ファイルも cap に入らず,一部がキャッシュ済み | 選択が空になり差分全体を送る(cap 超過) | 何も送らない(`0/N subjects` と報告) | | ADR-0021 の実行時間の記述 | 「A run has 60 seconds」 | Stop 内で最大 90 s(検証の使用分を差し引く),子プロセスごとに最大 60 s(planning は 20 s) | ## 検証 - [x] `uv run pytest`(全体): 6134 passed, 2 skipped(origin/main にリベース後) - [x] ruff check / ty: pass.lefthook pre-commit / commitlint: pass - [x] Red → Green: 全件キャッシュ済みファイルのテストは,実装前に「差分全体を送る」理由で失敗 - [x] Red → Green: 1 ファイルも cap に入らない場合のテストは,実装前に `op` が呼ばれて失敗 - [x] Red → Green: `test_the_subject_cap_holds_the_largest_measured_session_whole` を 988 subjects に更新すると,250 で失敗 - [x] CI: push 後の結果は下のチェック欄を参照 ## 計測(`SUBJECT_CAP` の根拠) - 条件:2026-11-18,`jev-lint` 0.7.0,model `jev-1.14.0`.#201 のマージコミット `db7226d0` を `--base 746cd48` で review.`-R agents/hooks/lint/model-rules`(#240–#244 後の全ルール,ADR ルールを含む),新規キャッシュ,concurrency は既定の 32,`op run` 経由 - 計画(dry-run): 988 subjects,60 requests,cached 0,約 $0.028 - 実測(**1 回のみ**のためばらつきは不明): real 3.41 s(user 2.70 s,sys 0.18 s),exit 0 - 記録ファイル(`--record`)との照合:送信は 60 requests で計画どおり.988 subjects すべてに回答があり(欠落 0),retried・rateLimited・splits はいずれも 0.問い合わせ区間の `wallMs` は 969 ms(リクエスト時間の合計は 20.2 s),入力 583,810 tokens,$0.0245 - 参考:同じ差分を全件キャッシュ済みで実行すると(ネットワークなし),3 回とも 0.17–0.18 s - 判断:2000 は #201 の 2 倍超を丸ごと収める.1 subject ≈ 590 tokens なので,cap いっぱいでは jev-lint の token burst(1.2M)の約 98% になり,超過分のペーシングは最大でも約 6 s.実測の 10 倍でも 90 s 予算の 70%(63 s)を大きく下回る.計測が 1 回だけなので,数値そのものではなく余裕幅で判断した <details> <summary>範囲・除外・経緯</summary> - 範囲:`agents/hooks/lib/model_rules_run.py`(`SUBJECT_CAP`,`_capped_plan`),ADR-0021 の amendment(cap と実行時間の記述),`docs/DESIGN.md` と `docs/DESIGN_ja.md`(cap の値と根拠),テスト(`test_model_rules.py`,`test_model_rules_report.py`,`test_model_rules_tiers.py`) - 取り除いたもの(ADR-0027): exit 1 を error finding の結果として読む処理,gating finding による毎 Stop ブロック,その文言・receipt・resume 項目,`test_model_rules_gate_findings.py`,ADR-0021 への gate の追記.revert コミット 676f15e で取り除き,squash 後の差分には残らない - 除外(ブリーフに従う): model rule の promote やブロック(ADR-0027),セッションごと 1 回の報告(#245/#252),ルールファイルと cutoff,他リポジトリ - キャッシュと cap: dry-run の batches は未キャッシュの subject だけを含むため,キャッシュ済み subject はもともと cap に数えられていなかった(変更不要) - batch の `file` と渡したパスの一致:実際の dry-run(#201 の差分,34 ファイル)で,全件完全一致することを確認した - #252 との関係:#252 は `model_rules_gate.py` を変更する.本 PR は同ファイルを変更しないため,競合はない - レビュー対応(rework 後の 1 回目): - P1(Claude)「gate 機能が差分にない」: 説明を差し替える前のレビューだった.gate は ADR-0027 に従って意図的に除いたもので,タイトルと本文は絞り込み済みと返信して resolve - P2(Codex)「設計書が 250 のまま」: 5891a33 で両方の設計書を 2000 と新しい根拠に更新 - P3(Claude summary,スレッドなし)「`paths` が空のレビューでは全件キャッシュ済みファイルが残らない」: `_Changes.reviews` は `sendable` が空でないときだけ `Review` を作り,常に明示的なパスを渡すため,現状では起きない(潜在のみ).修正はせず,ここに記録する - レビュー対応(rework 後の 2 回目,修正なし): P2「対象のないパスがあると `if not chosen` を通らず,対象のないファイルだけで `op run` が起動する.`judged` にもスキップ分のキャッシュが混ざる」.dry-run だけでは対象のないファイルと全件キャッシュ済みのファイルを区別できず,後者のキャッシュ済み finding を報告するにはその起動が必要.新たな問い合わせは 0 で,誤った finding も出ない.件数表示のずれは以前からのもので advisory に限られるため,ブリーフの基準に従い返信・resolve・記録にとどめた(Limits) - 前回レビューの P3「never paced に余裕がない」は,コメントと ADR の表現を「最大約 6 s のペーシング」に直して解消した </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
🤖 I have created a release *beep* *boop* --- ## [0.3.0](v0.2.0...v0.3.0) (2026-11-19) ### Features * **lint:** fit the bash and yaml model rule cutoffs ([#243](#243)) ([d5eab6b](d5eab6b)) * **lint:** fit the Go model rules on eval fixtures ([#244](#244)) ([cf87c36](cf87c36)) * **lint:** fit the Rust model rules to eval fixtures ([#241](#241)) ([3275ce2](3275ce2)) * **lint:** fit the TypeScript model rules on eval fixtures ([#242](#242)) ([bb41bb7](bb41bb7)) * **lint:** make bash_local_underscore_prefix an error ([#251](#251)) ([cd8c5b8](cd8c5b8)) ### Bug Fixes * **hooks:** let cleanup_worktrees remove worktrees left with only regenerable outputs ([#235](#235)) ([a25ce5b](a25ce5b)) * **hooks:** raise the model rules subject cap and keep cached findings under it ([#246](#246)) ([a451e93](a451e93)) * **hooks:** show each Stop model-rule finding once per session ([#252](#252)) ([49cd6f9](49cd6f9)) * **hooks:** skip commits already on the default branch in model rules ([#247](#247)) ([3df49a2](3df49a2)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: furedea-release[bot] <353651101+furedea-release[bot]@users.noreply.github.com>
概要
Stop の model rules(Jev,advisory)が,同じセッションで一度出した指摘を,別のファイルを編集するたびに出し直していた.一度出した指摘は後の Stop で出さず,件数だけを 1 行で示す.
Closes #245
Refs #169
変更
(ruleKey または rule, file, 作業ツリーの line..endLine の内容のハッシュ).subject の本体が変われば新しい指摘として出し,行番号だけが動いた subject は同じ指摘として隠す.jev-lint 0.7.0 のFinding型(ruleKey,endLine,任意のtext)に基づく.textは実出力にあるとは限らないので使っていない.results.jsonにmodel_rules_shown(出した指摘のハッシュの一覧)を足した.新しい保存機構は作っていない.model_rules)は入力の指紋ごとに置き換わるので,編集で消える.セッション記録は新しいセッションで空になるため,「新しいセッションでは改めて出す」がそのまま成り立つ.jev-lint: 3 findings · 17 already shown · ....save_resultsで保存する.shown)は,指摘のハッシュに置き換えた.再試行(resume)でも二重に数えない.テスト
tests/hooks/test_model_rules_shown.py(新規):無関係な編集後に隠れる,行だけ動いても隠れる,本体が変わると再び出る,新しい指摘だけ列挙し既出は件数にする,新しいセッションでは出る.changed_inputsは別の規則の指摘で再び block することを確かめる.boundedは 1 行ファイルに 30 件の指摘が重なっていたので,30 行のファイルにした.uv run pytest tests/hooks:全件通過.ruff,ty,lefthook も通過.レビュー
3 件の P2(同一ハッシュの衝突を 2 件,保存の原子性を 1 件)は,この変更を誤らせるので修正し,テストを足した.スレッドは解決済み.
4 件目の P2(同一内容の subject が既存のものより前に追加されると,序数が入れ替わって最大 1 件を見逃す)は,内容で識別する以上,同一内容の subject は区別できないという限界なので,修正しない.見逃しは advisory 1 件分で,ブリーフの脅威モデルが許す範囲.対処するなら,識別子に行位置を足す必要があり,行が動いても隠すという要件と両立しない.スレッドは範囲外として回答し,解決した.
範囲外(ブリーフに基づく)
promoted・blocking の規則(#249),ファイル選択(#234),suppression コメント,規則や cutoff.
🤖 Generated with Claude Code