Repository navigation
fix(hooks): judge only the session's own changes in Stop model rules - #237
furedea-agent[bot] wants to merge 14 commits into
Conversation
|
@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 summaryReviewed read-only. The change looks sound. Using HEAD's reflog to separate the session's own commits from fast-forwarded or pulled ones is reasonable, and the uncommitted-side filter against Finding
No P0 or P1 issues found. I did not run the test suite. 🤖 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: 65b9735644
ℹ️ 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".
Also accept the commits that pull --rebase replays as the session's own. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@codex review |
Review summaryI found no P0, P1 or P2 problems, so I posted no inline comments. This was a read-only review. I did not run the test suite. What I checked:
Remaining points, none blocking:
Overall: the approach and the documented limitations (cross-worktree fast-forward, expired reflog) are reasonable, and the new tests cover the main scenarios. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 46d610b120
ℹ️ 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 <noreply@anthropic.com>
|
@codex review |
Review summaryNo P0, P1 or P2 findings. I read the diff and checked the following.
Remaining P3 gaps, all in the over-inclusion direction:
I did not run the tests. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9093f60ac3
ℹ️ 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 <noreply@anthropic.com>
|
@codex review |
Review summaryI found no P0 or P1 issues. I read the diff only and did not run the tests. What I checked
Finding
Other notes (no action needed)
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 33361fd3c8
ℹ️ 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".
…ut a reflog Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@codex review |
Review summaryRead-only review of the Stop hook change that limits model rules to the session's own commits. I found one issue and have not run the test suite. P2 (inline comment on Checked, no finding:
No security problems found. Git is invoked with an argument list, 🤖 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: dbe28fc7fb
ℹ️ 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".
…selection Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@codex review |
|
Review summary: no P0 or P1 findings. I left two inline P2 comments.
I read the diff only and did not run the tests. The reflog-based attribution looks sound for commit, amend, cherry-pick, revert, rebase, ff and merge, and the tests cover those cases. 🤖 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: db464f9701
ℹ️ 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".
|
Review summary: no blocking findings. I read the changes to What I checked:
Minor observations, no action needed:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ff87e264f3
ℹ️ 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".
… not a count Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@codex review |
Review summaryI found nothing blocking. The reflog-based selection of the session's own commits looks sound. I read the diff and did not run the tests.
Things I checked that look fine:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 19b904c793
ℹ️ 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".
…s, and count git am Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@codex review |
Review summaryI read the diff only and did not run the tests. There are no P0 or P1 findings. The reflog-based "own commits" logic looks sound. The
Separately, the PR description is about package-manager settings ( 🤖 Generated with Claude Code |
|
Codex Review: Didn't find any major issues. Breezy! 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". |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@codex review |
|
Review summary (read-only) Reviewed the reflog-based "own commits" selection in
No P0 or P1 findings. |
|
Codex Review: Didn't find any major issues. Breezy! 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". |
…ection fingerprint Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@codex review |
Review summaryI read the diff read-only and did not run the tests. The reflog-based attribution is carefully built, and the tests cover most of its edge cases. The fallback to `committed_paths` when the reflog can't say is sound. `advise()` also catches `ValueError`, so a failing git call degrades to a skipped advice instead of crashing the Stop hook. Findings
Notes (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: ca3986f255
ℹ️ 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".
…#247) ## 概要 Stop hook の model rules が,default branch に取り込まれた commit(他の作業,または既にレビュー済みの自分の PR)のファイルまで判定していた.判定の基準を単純な方法で見直す. Closes #234 Refs #169 ## 方法 commit 済みの変更の基準(base)を,セッション開始時の HEAD と `git merge-base HEAD refs/remotes/origin/HEAD` のうち新しい方にする. - 後者が前者の子孫のとき(`git merge-base --is-ancestor`)だけ使う - remote の default branch が分からないとき,または子孫でないときは,従来どおりセッション開始時の HEAD - `committed_paths`,ADR の選択(`ReviewedSpan`),`Review` の `--base` が同じ base を使う(`review_base` を `model_rules_files.py` に追加) #237 の reflog 解析は重すぎるため使っていない. - receipt の fingerprint(`_inputs`)に解決後の base を含める(review の指摘 P1/P2 への対応) ## テスト - default branch に入った commit は判定せず,その後の自分の commit だけ判定する - default branch が開始時の commit につながらないときは,開始時の HEAD を base にする - default branch が Stop の間に進んだら,古い receipt を再利用せず判定し直す - 既存テストのうち `_Changes` を直接組み立てる 2 件に base を渡すよう更新 ## 範囲外(Issue #234 のコメントと brief による) 自分の commit を隠す迂回(fast-forward,default branch への rebase,reflog 編集),merge commit の conflict 解決,default branch を持たない repository,#245. ## レビュー指摘の扱い - P1/P2(fingerprint に base が無い): 修正済み - MEDIUM(agent が書ける ref から base を決める,security review): 範囲外.agent が自分の commit を隠す迂回(default branch への rebase,ref の書き換え)に当たり,rules は advisory で,漏れても 1 件を見逃すだけ(brief の threat model) - P2(Stop 中の背景 `git fetch` が fingerprint と review の 2 回の `review_base` の間に ref を動かす競合): 範囲外.rules は advisory で,漏れても次の Stop までの 1 件を見逃すだけ(brief の threat model) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: furedea <132188853+furedea@users.noreply.github.com> Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
概要
Stop hook の model rules が,セッション中に fast-forward・pull で取り込んだ他人の commit のファイルまで判定対象にしていた.セッションが自分で作った変更だけを対象にする.判定の仕組み(Jev,advisory,Stop だけで動く)は変えていない.
Closes #234
Refs #169
原因
対象ファイルを 2 か所で選んでいて,どちらも取り込んだ commit を含んでいた.
git diff <セッション開始時の HEAD> HEADなので,fast-forward で進んだ範囲がすべて入る(issue の再現)選んだ方法
HEAD の reflog で,セッション自身が作った commit を見分ける.
committed_pathsをown_committed_pathsに置き換えた.登録後の reflog の各 step のうち,件名がcommit・commit (amend)・commit (cherry-pick)・cherry-pick・revert・am・rebase (pick など)・pull --rebase … (pick)のものだけを数えるmerge・pull・checkout・rebase (start)・commit (merge)は数えない.merge commit は自分の部分と取り込んだ部分を分けられないため常に数えないgit statusで HEAD・index と異なる(または未追跡の)ファイルに限る(uncommitted_paths).開始時の commit が無い repository では絞り込まないcommitted_paths)_is_changed_adr,ReviewedSpan(record.head, "HEAD"))は,渡される path が上の選択を通った後のものなので変更していない新しい状態
登録時の reflog の印だけを
baseline.jsonのreflog(entry 数と最も新しい entry の行)に追加した.時刻で区切ると秒精度で登録直前の commit と区別できず,件数だけで区切ると古い entry の期限切れでずれるため,最も新しかった entry を探し直す.退けた案
--first-parent.cc-writesの記録制限
git rebaseで載せ替えると,replay された commit が自分のものとして数えられる(余計な advisory の方向)テスト・checks
tests/hooks/test_model_rules_own_commits.py(新規 43 件)とtest_session_head.pyの 1 件.fast-forward・pull,自分の commit,amend,rebase,cherry-pick,revert,am,登録前の commit,期限切れ,reflog 無し,破棄した commit,receipt の fingerprint,Stop hook 経由の確認.主要なものは修正を外すと失敗することを確認したuv run pytest tests/hooks: 5036 passed,2 skipped.ruff,ty,lefthook も通ったall-greenは passレビュー指摘の扱い
P0/P1 は常に修正し,P2/P3 は変更を誤らせるものだけ修正した.それ以外は brief の範囲外として返信して resolve した.
pull --rebaseの reflog 件名に合わないreflog_entriesが git の失敗を 0 として記録(fail-open,security review)None,Noneなら全 commit 判定commit (cherry-pick):が数えられないgit amの件名が数えられない/am (continue)の正規表現の誤りsplitlinesが件名の Unicode 改行で割れるown_committed_pathsと test の責務の指摘は分けないgit rebaseの replaycommit-tree+update-refassume-unchanged・skip-worktreeuncommitted_pathsの git 失敗,期限切れ再指摘,重複行,効率,merge の衝突解消,非 UTF-8 パス,登録時の競合🤖 Generated with Claude Code