Skip to content

fix(hooks): deny git options that skip repository hooks - #212

Merged
furedea merged 11 commits into
mainfrom
fix/deny-git-hook-bypasses
Nov 15, 2026
Merged

furedea merged 11 commits into
mainfrom
fix/deny-git-hook-bypasses

Conversation

@furedea-agent

@furedea-agent furedea-agent Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

概要

  • 危険な Git 操作のガード(git_safety.py)が,リポジトリのフックを飛ばす Git の形を拒否するようにします.
  • 拒否する形: commit,push,merge,pull,am,rebase の --no-verify(一意な省略形を含む),commit と am の -n(-nm などの結合短縮形を含む),commit --no-post-rewrite,-c core.hooksPath=... と --config-env=core.hooksPath=....
  • 理由文は「<形> skips repository hooks; let the hooks run」です.
  • 環境変数 GIT_CONFIG_PARAMETERS,および core.hooksPath/alias.*/include.* を指す GIT_CONFIG_KEY_<n> の代入(前置き代入と env)も同様に拒否します.
  • -m "--no-verify" のようにオプションの値が同じ文字列を含むだけの場合は拒否しません.

脅威モデル

  • このガードは,エージェントが偶然,または利便性のために hook を飛ばすことを止めます.意図的な回避を止めるとは主張しません.
  • 正式な関門は必須 CI チェックで,ローカルの hook に関係なく走ります.
  • 永続設定(git config core.hooksPath)は対象外です.sandbox が .git/config,~/.gitconfig,~/.config/git/config への書き込みを拒否することを親が確認済みです.
  • 引用なしの -C $W の分割は既存契約の範囲で,この PR では変えません.
  • 回避手段の一覧をこれ以上広げるだけの指摘は,この脅威モデルで答え,実装しません.

検証

  • 先に失敗するテストを追加(tests/hooks/test_git_hook_bypass.py)し,その後ルールを実装
  • uv run ruff check,uv run ruff format,uv run ty check が通過
  • uv run pytest 全件: 4932 passed,1 failed(test_hook_lock_wait.py のタイミング依存テスト,単独実行では 15 passed)
  • CI の結果は push 後に確認
スコープ・参照
  • 変更: agents/hooks/lib/git_safety.py,tests/hooks/test_git_hook_bypass.py(新規)
  • 許可のまま: rebase -n(--no-stat),cherry-pick -n と revert -n(--no-commit),push -n(--dry-run),--no-verify-signatures,--verify
  • 未対応: git config core.hooksPath による永続的な設定,GIT_CONFIG_GLOBAL/GIT_CONFIG_SYSTEM などの他の環境変数と,引用連結や実行時展開で組み立てた GIT_CONFIG_KEY_<n> の値
  • command_permissions.json,skill,ADR は変更していません
  • Refs refactor(skills): move deterministic responsibilities out of Skills #169

🤖 Generated with Claude Code

Deny --no-verify and -n on commit, push, merge, pull, am and rebase,
commit --no-post-rewrite, and core.hooksPath overrides via -c or
--config-env. Option values that only spell the text stay allowed.

Refs #169

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@furedea

furedea commented Nov 15, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T14:00:58.907985Z 07d390a Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Comment thread agents/hooks/lib/git_safety.py Resolved
Comment thread agents/hooks/lib/git_safety.py Resolved
@github-actions

Copy link
Copy Markdown

レビューまとめ

ブロッキングな指摘はありません(P0/P1: 0 件).

  • [P2] HOOK_SKIPPING_VALUED["am"] に入っている -S は,値を省略できるオプションで,値を付けるときは直結する形(-S[<keyid>])だけです.次の引数を値として読むことはありません.そのためガードは git am -S --no-verify p.patch と git am -S -n p.patch を許可してしまい,フックを飛ばす経路が残ります.
  • [P3] 短縮オプションの結合形の判定で,git commit -uno(--untracked-files=no)を -n と誤って読んで拒否します.回避経路ではなく誤検知です.

それ以外の部分(-- 以降の扱い,オプションの値の読み飛ばし,--no-verify の省略形,-c/--config-env による core.hooksPath の上書き検出)はコードを読んで確認し,問題は見つかりませんでした.この環境ではコマンドを実行できなかったため,上の 2 件はテストで再現しておらず,コードを読んだ結果に基づきます.

🤖 Generated with Claude Code

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bf6c3c2499

ℹ️ 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".

Comment thread agents/hooks/lib/git_safety.py Resolved
Comment thread agents/hooks/lib/git_safety.py Resolved
…ass rule

Read a value that spells -- as data, stop short clusters at flags whose
value is attached (-u, -S), drop am -S from the valued options, let a
later --verify or --post-rewrite re-enable a hook, and deny -c alias.*
and include.* settings that can hide a skipping option.

Refs #169

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@furedea

furedea commented Nov 15, 2026

Copy link
Copy Markdown
Owner

@codex review

@github-actions

Copy link
Copy Markdown

レビュー結果(読み取りのみ)

P0 から P3 の指摘はありません.

主に次の点を確認しました.

  • hook_skipping_option が,値を取るオプション(-m,-F,--message,--trailer,--exec など)の次の語をデータとして飛ばすこと.結合短縮形(-nm,-mn,-um,-Sn,-3n)も,Git と同じように読むこと.
  • 値として扱う選択肢の一覧に,実際の Git では値を取らないものが入っていないこと.入っていると後続の --no-verify を見落とすが,該当なし.一覧の漏れは拒否が増える側(安全側)にだけ働く.
  • 最初の -- が値として読まれる場合(-m -- --no-verify)と,--verify/--post-rewrite で後から元に戻す場合の扱い.
  • -c/--config-env のキーを大文字小文字を区別せずに照合すること.core.hooksPathX や値の側にだけ現れる文字列は拒否しないこと.
  • hook_skip_reason を既存の sandbox_form_reason/push_reason より前に評価しても,拒否が許可に変わる経路はないこと.
  • agents/hooks/cleanup_worktrees.py の -c core.hooksPath=/dev/null は hook 自身が実行する subprocess なので,このガードの対象外であること.

注意: この環境ではコマンド実行の承認が得られなかったため,pytest もガードへの試験入力もこちらでは実行していません.上の判断は手で追ったものです.PR 本文にある未対応範囲(永続的な git config,GIT_CONFIG_* 環境変数,実行時に展開される旗)は把握済みとして扱いました.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7479ace3e9

ℹ️ 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".

Comment thread agents/hooks/lib/git_safety.py Resolved
Comment thread agents/hooks/lib/git_safety.py Resolved
…bles it

An option this module does not know could take --verify as its value, so
a later --verify or --post-rewrite no longer clears an earlier skip.

Refs #169

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@furedea

furedea commented Nov 15, 2026

Copy link
Copy Markdown
Owner

@codex review

Comment thread agents/hooks/lib/git_safety.py Resolved
@github-actions

Copy link
Copy Markdown

Review summary

I reviewed hook_skip_reason and its helpers. I traced option parsing for commit, push, merge, pull, am and rebase against Git's parse-options rules: valued options, attached-only values (-u, -S), short clusters, -- used as a value, abbreviations, and -c/--config-env keys. I found no way for a literal argument list to get past the new rule. When a value is mis-parsed, the code denies a command it could have allowed; it never allows a skip. The tests cover the main denied and allowed forms well.

Findings

  • P2: Run-time expansion isn't caught for the newly judged verbs or for global -c. guard_git._git_hides_verdict still checks only OPTION_VERBS, and checks dynamic globals only for push. So git rebase "$F" main and git -c "$C" commit -m x are allowed without review. Details are in the inline comment.

No P0/P1 findings. I didn't run anything, because running commands needed approval in this environment.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4976d62469

ℹ️ 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".

Comment thread agents/hooks/lib/git_safety.py Resolved
Review a run-time word in option position of commit, push, merge, pull,
am, and rebase, or as the setting of a global -c. Option values and
paths after -- still pass.

Refs #169

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@furedea

furedea commented Nov 15, 2026

Copy link
Copy Markdown
Owner

@codex review

Comment thread agents/hooks/guard_git.py Resolved
@github-actions

Copy link
Copy Markdown

レビュー結果

ブロッキングな指摘はありません(P0/P1: 0件).

  • P2: guard_git.py の _config_is_dynamic は -c の後ろにある実行時の語しか見ていません.そのため git --config-env="$X" commit -m x は確認なしで通る可能性があります.$X が core.hooksPath=VAR に展開されると,フックが飛ばされます.同じ形の git -c "$C" commit は ask になるとテストで確認しているので,揃えるのが自然です(インラインコメント参照).

確認した点(問題なし):

  • 短縮形のまとめ書き(-nm,-mn,-un,-cn)で,値を取るフラグの後ろを値として読む処理
  • --no-verify の省略形の判定と,--no-verify-signatures との区別
  • -- 以降とオプションの値を,オプションとして読まない処理
  • _config_is_dynamic で引数と dynamic の添字の位置が揃っていること

なお,このレビューではコードを読んで確認しました.テストは実行していません.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c0b8821912

ℹ️ 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".

Comment thread agents/hooks/lib/git_safety.py Resolved
Comment thread agents/hooks/guard_git.py Resolved
@furedea

furedea commented Nov 15, 2026

Copy link
Copy Markdown
Owner

@codex review

Comment thread agents/hooks/guard_git.py Resolved
@github-actions

Copy link
Copy Markdown

Review summary

Blocking findings: 0 (P0: 0, P1: 0, P2: 1, P3: 0)

  • P2 agents/hooks/guard_git.py:102: _config_is_dynamic does not consider global-option words that split at run time. For example, git -C $W commit -m x is allowed, which the new test expects, but with W='. -c core.hooksPath=/dev/null' bash moves the hooks without any review. Treat any(item.spreading[1:start]) as hiding the verdict.

I traced the rest of the parsing by hand and found no other problems:

  • option_positions and skipped_in handle values and -- correctly.
  • Short clusters (-nm, -mn, -uno, -Sn, -3n) are judged correctly.
  • Long-option abbreviations go through spelled_out for commit and push, and through abbreviates for the other verbs.
  • Splitting -c settings with pairwise over-matches safely and cannot miss a setting.
  • Index alignment in hides_hook_skip is correct.

Every gap I found errs toward denying or asking, not toward allowing. The permission sandbox stopped me from running the test suite, so this is a static review.

🤖 Generated with Claude Code

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 00969fa943

ℹ️ 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".

Comment thread agents/hooks/lib/git_safety.py Resolved
Comment thread agents/hooks/guard_git.py Resolved
@furedea-agent

furedea-agent Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

レビュー指摘への対応(00969fa)

修正済み

  • am -S を値付きオプションから外した(任意の値は直結のみ).
  • -uno,-Sn のように,値が直結する短縮フラグでクラスタの走査を止める.
  • 値として現れる --(-m -- --no-verify)を値として読み,その後の --no-verify を見逃さない.
  • 後続の --verify/--post-rewrite では先のスキップを取り消さない(未知の値付きオプションが値として取りうるため,安全側に倒した).
  • -c alias.*/include.*/includeIf.* を拒否.
  • 実行時の語が option 位置にある場合,commit/push/merge/pull/am/rebase で確認を求める.global -c の設定語と --config-env の動的な語は,どの verb でも確認を求める.空白で分割されうる語も同様.

対応しない(理由)

  • git -C $W commit の $W が空白で分割される経路: 既存契約が引用なしの -C $W を許可している(test_guard_git.py の git -C $W push origin feat/topic).変えるのはこの guard 全体の方針であり,この PR のスコープ外.
  • git config core.hooksPath ... による永続設定と GIT_CONFIG_COUNT などの環境変数: ブリーフは command line の上書きまでを対象とする.別 Issue で扱う.
  • -m"$MSG" や -c user.name="$NAME" に対する不要な確認: 誤検知(安全側)のみで,回避経路ではない.
  • 値付き長形式の省略形(merge --mess --no-verify): 誤検知(安全側)のみ.

Read prefix assignments and env words; refuse GIT_CONFIG_PARAMETERS and
GIT_CONFIG_KEY_<n> naming core.hooksPath, alias.*, or include.*.

Refs #169

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@furedea

furedea commented Nov 15, 2026

Copy link
Copy Markdown
Owner

@codex review

@github-actions

Copy link
Copy Markdown

Review summary (read-only; I could not run tests in this environment, so this is from reading the code)

  • P2 agents/hooks/guard_git.py:56: when a command has several segments, an earlier segment with a run-time word returns ask before later segments are checked. A literal git commit -n after it can then run once the user approves, which defeats the guarantee that a hook skip cannot be approved away. The fix is to check every segment for hook bypass before any ask.

No P0/P1 findings. The option parsing (option values, short clusters, --, abbreviations, -c/--config-env, and the env assignments) looks correct for the threat model stated in the PR description, and the new tests cover both what is denied and what is still allowed.

🤖 Generated with Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 4e8f0d4bf2

ℹ️ 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".

@furedea

furedea commented Nov 15, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 03d6cf18af

ℹ️ 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".

@github-actions

Copy link
Copy Markdown

レビュー結果

ブロッキングな指摘はありません(P0: 0,P1: 0).インラインコメントもありません.

静的に確認した点:

  • 値を取るオプションの一覧(VALUED_OPTIONS と HOOK_SKIPPING_VALUED)には,Git で引数が必須のオプションだけが入っています.任意引数のオプション(-u,-S,--gpg-sign)は,値をくっつけて書く形としてだけ扱っています.このため,値の位置と誤認して --no-verify や -n を見逃す経路は見当たりません.一覧の漏れ(例: --pathspec-from-file,am --quoted-cr)は,拒否しすぎる側に倒れるだけです.
  • option_positions は生の引数を,spelled_out は展開後の引数を使いますが,両者の長さは一対一で揃っています.値をとるオプションを省略形で書いた場合(例: push --push-o --no-verify)は,次の語を値として読まずオプションとして読むので,やはり拒否しすぎる側に倒れます.
  • _config_is_dynamic の添字の計算(dynamic[2 + index],dynamic[1 + index])は正しいです.
  • rebased は replace で assignments を引き継ぐので,ラッパーを剥がした後の項目でも前置き代入が残ります.
  • hook を飛ばす形の判定は,実行時の語の確認(ask)より前に deny するので,後ろのセグメントにある --no-verify が手前の ask に隠れません.テストもあります.

挙動の変化(PR 本文とテストに記載済みのもので,指摘ではありません): 次のコマンドは,これまでの allow から ask に変わります.

  • git commit -m x "$FILE":-- のないパス指定
  • git merge "$BRANCH"
  • git -c "$C" status

注: この環境ではテストを実行できなかったため,この確認は静的な読解によるものです.

@furedea

furedea commented Nov 15, 2026

Copy link
Copy Markdown
Owner

@codex review

Comment thread agents/hooks/lib/git_safety.py Resolved
@github-actions

Copy link
Copy Markdown

Review summary

Blocking findings (P0/P1): none.

I reviewed this statically and did not run the test suite.

What I checked:

  • Option parsing: how hook_skipping_option, option_positions and skipped_in read things against Git's own parser: separate and attached option values, flags that only take an attached value (-u, -S), short flags combined like -anm, long-option abbreviations, and a bare -- given as the value of -m.
  • Allowed forms: push -n, rebase -n, cherry-pick -n, revert -n, and --no-verify-signatures are all still allowed. Where the parser is unsure, it denies or asks rather than allows.
  • Valued options: the new valued-option lists for merge, pull, am and rebase contain only options that require a value. That matters because an option wrongly listed as taking a value would let a following --no-verify slip through as its value.
  • Order of checks: the deny for a settled hook skip now runs before the run-time-word ask. That fits the goal that approving an ask cannot override a skip. The new _config_is_dynamic and hides_hook_skip checks line up their indexes correctly with the parsed arguments.

Non-blocking:

  • P3 (git_safety.py:242): environment_reason reads every word after env, including the command's own arguments. A commit message or another program's argument that contains GIT_CONFIG_PARAMETERS= or GIT_CONFIG_KEY_<n>=alias.* is therefore denied.

The tests cover the changed behavior well: deny and allow cases, run-time words, environment variables, and the ordering across command segments.

🤖 Generated with Claude Code

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 91037afbb6

ℹ️ 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".

Comment thread agents/hooks/guard_git.py Resolved
…ook skips

Stop the env scan at the wrapped command so its arguments are not read as
settings, and ask when xargs may append a skipping option to a verb that
has one.

Refs #169

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@furedea

furedea commented Nov 15, 2026

Copy link
Copy Markdown
Owner

@codex review

Comment thread agents/hooks/lib/git_safety.py Resolved
@github-actions

Copy link
Copy Markdown

レビュー概要

ブロッキングな指摘はありません(P0: 0,P1: 0,P2: 1).

  • P2 git_safety.env_assignments: env --unset NAME や env --chdir DIR のように値を次の語で受け取る長形式オプションの後に置いた GIT_CONFIG_PARAMETERS/GIT_CONFIG_KEY_<n> を読めず,許可してしまいます(詳細はインラインコメント).

確認した点(問題なし):

  • 短縮クラスタ(-nm,-mn,-um,-Sn)と -- の扱い,値を取るオプションの読み飛ばしが Git の解釈と一致し,過検出はあっても見逃しの方向にはずれていないこと
  • _hook_bypass を全セグメントに先に適用しているので,前のセグメントの ask で後の deny が隠れないこと
  • Command.rebased が replace 経由で assignments を引き継ぐため,ラッパーを剥がした層でも前置き代入が見えること
  • _config_is_dynamic の添字(-c の値は dynamic[2 + index])が正しいこと

注意: この環境ではテストを実行する許可がなかったため,上記はコードを読んで確認したものです.

🤖 Generated with Claude Code

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2236d12173

ℹ️ 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".

Comment thread agents/hooks/lib/git_safety.py Resolved
@furedea

furedea commented Nov 15, 2026

Copy link
Copy Markdown
Owner

@codex review

@github-actions

Copy link
Copy Markdown

レビュー結果

ブロッキング指摘はありません(P0: 0,P1: 0).

確認した点:

  • hook_skipping_option の値読み取り(VALUED_OPTIONS と HOOK_SKIPPING_VALUED,結合短縮形,-u/-S の付加値,-- 以降の打ち切り).merge/pull/am/rebase の値付きオプションは Git でいずれも必須値なので,値として扱う語が実は Git ではオプションになる,という見逃しは見つかりませんでした.取りこぼしは誤拒否側(例: git rebase --exe --no-verify)にとどまります.
  • -c/--config-env のキー判定(大文字小文字,includeIf.),GIT_CONFIG_PARAMETERS/GIT_CONFIG_KEY_<n> の前置き代入と env のオプション読み飛ばし.
  • guard_git.inspect で拒否判定を確認(ask)より先に回す順序,_config_is_dynamic の添字の対応,xargs の経路.
  • 新しいテストは,拒否・許可・実行時の語・環境変数・xargs の各経路をカバーしています.

PR に書かれた脅威モデルの範囲外である回避手段(export,GIT_CONFIG_GLOBAL など)は,方針どおり指摘していません.

注: この環境ではテストを実行できなかったため,コードを読んだうえでの確認です.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 07d390a1f1

ℹ️ 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".

@furedea
furedea merged commit e10e5b6 into main Nov 15, 2026
27 checks passed
@furedea
furedea deleted the fix/deny-git-hook-bypasses branch November 15, 2026 15:10
furedea added a commit that referenced this pull request Nov 16, 2026
…ore (#203)

Refs #74


計画:#74 (comment)

## マージ順序

言語ごとの規則の PR(#190〜#195)と #202 はすべてマージ済み.この PR は origin/main(1919b066)に
rebase してある.main にある `severity: error` の規則 28 件は,すべて規則テストの対象で,`note`
を持っている.追加した note は無い.

この PR が入ると,`severity: error` の static rule はすべて編集をブロックする.また,error の規則には
`note`(修正方法)が必須になる.

### rebase で解決したコンフリクト

- 1 回目(#190,#202,#205,#208 の後):ブランチのコミットごとに同じ関数で衝突したため,1 コミットにまとめてから
rebase した(squash merge なので結果は同じ).
- `agents/hooks/lib/static_rule_scan.py`:#202 の「設定ごとの基準ディレクトリから repo
相対パスで走査する」(`scan_root`,`cwd=root`,`--`)と,この PR の `Report`(error と advice
の分離),`note` の表示,信頼判定を両方残した.
- #202 の,git の無いプロジェクトでマニフェストのディレクトリを基準にするフォールバックと,そのテストは削除した.ユーザーの決定
(a) により共有規則は信頼できるリポジトリの中でしか走らないので,このフォールバックには到達しない.
- `tests/test_ast_grep_rules.py`:#190 の「error の規則は note を持つ」テストが,この PR の
`NOTE_PATTERN` を同名で上書きしていた.#190 の規則ごとのテストを残し,この PR の判定(空のブロック note
も検出する)を使うようにした.
    - `checkout_of` フィクスチャを `tests/conftest.py` に移した.
- 最新(#214,#215,#217,#218 の後):#215 で ADR が MADR の front matter
形式になったので,この PR の改訂日を front matter の `amended` に加えた.#214 が ADR-0021
に足した「Which rules ast-grep may block」の節は,この PR の改訂と矛盾しない.
- 2 回目以降(#191〜#195,#198,#199,#212 の後):テキストのコンフリクトは無かった.#194 で YAML
の規則が入ったので,「規則の言語はすべて抑制ガードの対象」というテストに yaml を加えた.YAML の `ast-grep-ignore`
はもともと検査している.

## 概要

ユーザーの決定:static(ast-grep)規則は,linter のエラーと同じくブロックする.advisory
の段階は設けず,規則は「有効(`severity:
error`,ブロックする)」か「削除」のどちらかとする.まれな正当な例外は,理由を書いた抑制コメントで扱う.抑制コメントはエージェントが勝手に追加してはならず,ユーザーが承認する.

- **ADR-0021 の改訂**(`docs/adr/0021_*.md`)
- static rule は編集時にブロックする.「advisory で始めて昇格する」経路は削除した.jev-lint の model
rule は変えていない.
    - 共有規則は所有者のスタイルなので,信頼できるオーナーのリポジトリでだけ動かす(「Whose style」).
    - error の規則は `note` に修正方法を持つ.抑制ガードはすべてのプロバイダで動く.
-
**ブロック**(`agents/hooks/lint_format.py`,`agents/hooks/lib/static_rule_scan.py`)
- ast-grep が `severity: error` の指摘を返したら,PostToolUse の `{"decision":
"block", "reason": ...}` を返す.
- reason には指摘ごとに,規則 ID,場所,規則の `message`(なぜ誤りか),`note`(`Fix:`
として修正方法)を並べる.その後に 1 回だけ次の指示文を続ける:「Fix the code as shown. Do not move or
split the code to avoid the rule; if a real exception is needed, add a
suppression comment, which is reviewed.」
- error,指示文,advice の順に並べ,全体を 1
つのサイズ上限(`NOTIFICATION_LIMIT_BYTES`)に収める.advice は残りに収まる分だけ入れる.
- error 未満の指摘,linter
の診断,走査の失敗はブロックせず,従来どおり通知する.壊れた走査でエージェントを止めないため.出力が切り詰められても,終了コード 1(error
あり)ならブロックする.
- dsh は PostToolUse で `systemMessage` を読むので,ブロック時は同じ文を `systemMessage`
にも入れる(プロバイダのプロファイルがブロックの形式も決める).
- **共有規則は信頼できるオーナーのリポジトリでだけ動かす**(`static_rule_scan.py`)
- 共有規則(`agents/hooks/lint/sgconfig.yml`)は,チェックアウトの origin のオーナーを
`trusted_owners` が信頼している場合にだけ走る(`AGENT_TRUSTED_OWNERS` も同様).
- 判定するのはオーナーだけ.fork かどうかは問わない.fork かどうかは model rule
が何を読めるかに関わることで,誰のスタイルを当てるかには関わらない.問い合わせをしないので,オフラインでも編集のたびに待たされず,オーナー自身のリポジトリで規則が知らせずに止まることもない.
- それ以外のリポジトリ,リポジトリ外,origin が無い,trusted_owners
ファイルが読めない場合は,共有規則を走らせない.プロジェクト自身の `sgconfig.yml` の規則は,従来どおりどこでも走る.
-
**抑制ガード**(`agents/hooks/guard_suppression.py`,`agents/hooks/lib/comment_nodes.py`,`agents/hooks/lib/patch_input.py`)
- `ast-grep-ignore` と Go の `//nolint` を対象に加えた.`ast-grep-ignore` は
`.go`,YAML,Nix でも検査する.
- **コメントかどうかは ast-grep 自身(tree-sitter)に判定させる**.`ast-grep scan --stdin`
で言語ごとのコメントノードを探す.ブロックコメント,複数行文字列,YAML のブロックスカラー,Rust の raw
string,ヒアドキュメント,JS の `<!--` コメントを正しく扱える.
- 以前は言語ごとに手書きの字句解析をしていたが,文字列の形式を見落とす指摘が続いたため置き換えた.対象の拡張子はすべて ast-grep
が解析できる.
- ast-grep
は,走査するテキスト中の抑制をこの走査自体にも当てはめ,マーカーの下のコメントを隠す.そこで,語を同じ長さの別の語に置き換えてから走査する.設定は空の
`sgconfig.yml` を明示的に渡し,プロジェクトや親ディレクトリの設定は読まない.
    - マーカーは件数ではなく,「効く位置にあるか」と「指示と対象の規則」の組で比べる.1 行にある複数のマーカーは,すべて照合する.
- 範囲は,マーカーからコメントの終わりまで(Rust
の属性は閉じ括弧まで,複数行でも)とする.その中で比べるのは,指示と規則の一覧だけ.たとえば `nolint` は linter
の一覧,`noqa` はコード,eslint は `--` の前まで,biome はコロンの前まで,Rust の属性は `reason =
"..."` を除いた部分.理由文の誤字を直すだけなら通る.`ast-grep-ignore`
は,マーカーの後ろの語をすべて規則名として読むので,コメント全体で比べる.
- Rust
の属性の閉じ括弧は,文字列とコメントの中の括弧を数えずに探す.閉じていない属性はファイルの終わりまでを範囲とする.範囲は,同じ種類の次のマーカーの手前で止める(コメントの中のマーカーで,属性の範囲は切らない).
- 判定の時間はファイルの大きさに比例する(行とノードは二分探索,括弧は 1 回の走査).マーカーが 2 万個のファイルでも 1 秒未満.
- そのため,`//nolint:errcheck` を `//nolint` や `//nolint:govet`
に変えるなど,対象の規則を減らす・変える・加える変更は,新しいマーカーと同じく確認する.`noqa` のコード,`type: ignore`
のコード,eslint の規則(複数行のブロックコメントも),`allow` / `expect` の lint,shellcheck
のコードも同じ.
- 規則名を書かない `ast-grep-ignore`
はすべての規則を抑制するので,規則名の変更も確認する.文字列をコメントに変える変更(同じ行でも,前後の行の変更でも)も確認する.
        - マーカーの移動や削除,マーカーの横のコードの編集は通る.
- ast-grep の走査は,1 回の判定の中で 20 秒の期限を共有する(フックの上限は 30
秒).期限は判定の開始時に決まる.期限で打ち切った走査があれば,コメントが不明なので確認する.
-
ファイル全体で比べるときは,コメントの外の語は数えない(文字列は何も抑制しない).文脈の無い断片(完全一致しないハンクなど)では,コメントの中に入るかどうかを判断できないので,すべてのマーカーをどこにあっても数える.
    - 相対パスは,payload の `cwd`(プロバイダがツールを実行するディレクトリ)を基準に読む.
- Rust の `#[allow(...)]` / `#[expect(...)]` は,Rust
の文字列とコメントの中以外なら数える.マクロ本体の中も数える(展開されると効くため).Rust 以外のファイルでは数えない.
    - ast-grep が無いか失敗したときは,コメントかどうかを判定できない.その場合は次の 2 つを確認する.
        - マーカーのある行が新しく現れた場合.行頭のインデントも比べる(YAML のブロックスカラーから外す変更など).
- マーカーを含むテキストで,変更した行に文字列やコメントの区切り(引用符,`/*`,`-->` と `--!>`,`<<`,YAML の
`|` など)がある場合.
- シェルスクリプトで,マーカーと `<<` を含むテキストの行を変えた場合(heredoc
の終端は記号を持たない語なので,行からは見分けられない).
        - それ以外の,抑制とは関係のない編集は通す.
        - 残る抜け道:ast-grep が無い環境で,区切りを含まない行の変更でマーカーがコメントに変わる場合は検出できない.
- Edit / MultiEdit / エディタの `insert` / Write
は,ファイル全体に適用した前後で比べる(replace_all,行の一部の編集,MultiEdit
の後続の手順も含む).エディタ系ツールのフィールド(`old_str`,`new_str`,`file_text`)も読む.置換がファイルに当てはまらないときは,マーカーを含むファイルなら確認する.
    - apply_patch
- すべてのハンクが既存ファイルに完全一致するなら,適用後のファイル全体で比べる.適用器はまず完全一致を探すので,同じ位置に当たる.
            - Add File は新しい内容そのもので比べる.
            - ハンク中の空行は空の文脈行として扱う.
            - ヘッダ行は前後の空白を除いて読む.
        - 次の場合は位置を判定できないので,マーカーを含むファイルなら確認する.
- 完全一致しないハンク,`*** End of File` のチャンク,解釈できない行,完全一致が 2 か所以上ある場合.
- 同じファイルに 2 回届くパッチは確認する.セクションの重複でも,`Move to:` の移動先でも,別の綴りや大文字小文字の違いでも同じ.
- `Move to:` は移動元と移動先の両方で判定する.移動先で初めて効くマーカーがあれば,それ自体を新しい抑制として確認する.
- 該当するのは,移動元では検査しない拡張子のマーカーと,移動先の文法でだけコメント(または Rust の属性)になるマーカー.
- 判定には,パッチを当てた後の内容を使う(再構築できないときは既存の内容).同じパッチでマーカーを消してから移動するなら通る.
            - `.py` から `.go` のような単なる移動は通る.
- ファイル単位の抑制:ast-grep は,1
行目のマーカーの直後に空行があるとファイル全体を抑制する.この状態になる編集や,この状態のマーカーを変える編集は確認する.1
行目のマーカーは,コメントノードの中にあるときだけ数える(1 行目が `MARKER = "ast-grep-ignore"`
のような文字列なら数えない).
    - 拡張子は小文字にして比べる.行の区切りは ast-grep と同じく改行だけとする.
- **プロバイダへの配線**(`agents/hooks.json`)
    - Devin,Hermes,pi,dsh の編集前フックに `content suppression` を加えた.
    - これらのプロバイダは確認を求められないので,新しい抑制はブロックされる.ユーザーが例外を追加する前提で,意図した挙動.
- **規則テスト**(`tests/test_ast_grep_rules.py`):`severity: error` で `note`
の無い規則があると失敗する.

## ユーザーの決定

- 第三者のリポジトリ:案
(a).共有規則は信頼できるオーナーのリポジトリでだけ走らせてブロックし,それ以外では走らせない.リポジトリ自身の規則は従来どおり.
- 抑制ガードを Devin,Hermes,pi,dsh にも配線し,そこでは新しい抑制をブロックする.Go の `//nolint`
も対象にした.
- ブロックメッセージ:指摘ごとの規則 ID,場所,message,note と,回避を禁じる指示文 1 回.note の無い error
規則は規則テストで落とす.
- レビューの指摘は別の Issue に回さず,この PR で直す.
- やらないこと:回避を検出する jev-lint 規則と,回避コストに関する ADR の基準.

## 文章と規則の対応表

| 規則 ID | 元の場所 | 元の規則(原文) | 判定 | 実装 | 例のテスト | 元の文章 |
| -------- | -------- | ---------------- | ---- |
------------------------------------------------------ | ---------- |
-------- |
| (なし) | — | — | — | hook と ADR の変更のみで,文章を規則に置き換えていない | — | — |

## 戻し方

static rule のブロックだけを止める環境変数のスイッチは無い(`AGENT_MODEL_RULES` は model rule
用で,static rule には効かない).戻すにはこの PR を revert する(squash merge の 1
コミット).急ぐ場合は,問題の規則の `severity` を `warning` に下げれば,その規則だけ従来の非ブロックの通知に戻る.ただし
ADR の「有効か削除か」に反するので,一時的な措置に限る.

## 検証

- `REQUIRE_AST_GREP=1 REQUIRE_JEV_LINT=1 uv run pytest
--cov`(b13175e9,CI と同じ設定):5357 passed,1 skipped.以前手元でだけ落ちていた model rule
のテストも,main の #218 の後は通る.
- `ruff check`,`ruff format --check`,`ty
check`,`ls-lint`,ファイル行数(pre-commit):通過.
- 追加・更新したテストは,各項目とも実装前に失敗することを確認した.
-
ブロック(`tests/hooks/test_static_rules.py`,`tests/hooks/test_lint_format.py`)
        - error でブロックし,reason は指摘と指示文 1 回で,全体が上限に収まる.
        - 実際の ast-grep でもブロックする.問題のないファイルと,規則の対象外の言語はブロックしない.
        - 異常終了した走査はブロックしない.切り詰められても,終了コード 1 ならブロックする.
        - Codex と dsh のアダプタ経由でもブロックする.
    - 信頼判定(`tests/hooks/test_static_rules_trust.py`)
        - 共有規則が走るのは,信頼できるオーナーのチェックアウトだけ.
        - fork の問い合わせはしない.
        - 別オーナーでも,プロジェクト自身の規則は走る.
    - コメントの走査(`tests/hooks/test_comment_nodes.py`)
        - 抑制マーカーの直下のコメントも見つける.
        - 作業ディレクトリの `sgconfig.yml` を読まない.
        - 文字列はコメントにしない.JS の `<!--` はコメントとする.エンコードできないテキストは不明として扱う.
-
抑制ガード(`tests/hooks/test_guard_suppression.py`,`tests/hooks/test_guard_suppression_scope.py`)
        - Codex と自動セキュリティレビューが報告したケースは,すべてテストにした.
- 文字列からコメントへの変化:同じ行,ブロックコメント,Python の複数行文字列,YAML のブロックスカラー,Rust の raw
string,ヒアドキュメント,Go の `"//nolint"`,ast-grep が無いときのテンプレート文字列.
        - 同じ行の 2 つ目のマーカー.
-
対象の変更(`tests/hooks/test_guard_suppression_target.py`):`//nolint`,`noqa`,`type:
ignore`,eslint,`allow` / `expect`,shellcheck
で規則を減らす・変える・加える変更は確認し,移動,削除,横のコードの編集は通る.
- 対象の変更では,属性の中のコメントや文字列にあるマーカーや括弧,閉じていない属性も確認する.理由文だけの修正(8 種類のマーカー)は通る.
- 走査の期限(`tests/hooks/test_guard_suppression_budget.py`):ハングする ast-grep
でも,移動を含むパッチの判定が期限内に終わり,確認する.期限切れの結果は次の判定に持ち越さない.マーカーが多いファイルも 5
秒以内に判定する.import
から時間が経っても,判定の外の走査は期限切れにならない(`tests/hooks/test_comment_nodes.py`).
- ast-grep が無いとき(`tests/hooks/test_guard_suppression_unparsed.py`):YAML
のインデント変更と heredoc 終端の挿入は確認し,heredoc の無いスクリプトの無関係な編集は通る.
        - payload の `cwd` にある相対パスのファイルを読む.
        - Rust の属性:raw string からコードへの変化,マクロ本体,Python のコメントから Rust への移動.
- パッチ:` ***`
で始まる文脈行で区切りが終わらない,配置できないハンクの断片で文字列に見えるマーカー,文脈行がコメントに変わる場合,Add
File,空行,`*** End of File`,解釈できない行,複数の一致,同じファイルへの重複(別の綴り,大文字小文字,移動先).
        - 移動:両方で効くマーカーは通る.移動先でだけ効くマーカーは確認する.
        - ast-grep が無いときは,抑制と関係のない編集を通す.`--!>` の変更は確認する.
- 1 行目の文字列はファイル単位の抑制にならない.移動の途中でマーカーを消せば通る.完全一致しないハンクが引用符の中に語を加えると確認する.
- apply_patch のテストは `tests/hooks/test_guard_suppression_patch.py`
に分けた(ファイル行数の上限のため).
- プロバイダ(`tests/test_provider_adapters.py`):5 つのアダプタすべてで,新しい抑制がブロックされる.
- 規則テスト(`tests/test_ast_grep_rules.py`):note の無い error 規則を検出する.main の
error 規則 28 件すべてに適用している.

## レビュー対応

- Codex,claude-review,自動セキュリティレビューの指摘は,すべてこの PR
で修正した.各スレッドにはコミットを添えて返信し,resolve した.
- 以前の返信にあるコミット ID の一部は,rebase の前のもの.
- 修正したもの
    - dsh のブロック表示.
    - 文字列からコメントへの変化.ここから,手書きの字句解析を tree-sitter に置き換えた.
    - 複数行コメント,YAML のブロックスカラー,Rust の raw string.
    - `//nolint` などのコメントの指示の判定.
    - 同じ行の 2 つ目のマーカー.
    - パッチの文脈行と配置.
    - ast-grep が無いときの判定.安全側に倒しつつ,抑制と関係のない編集は止めない.
    - ブロック全体の大きさ.
    - 拡張子をまたぐ移動.
    - 信頼判定の問い合わせ待ちと,規則が知らせずに止まる問題.
    - Rust の属性.
- CodeQL の HTML
コメントの終わり(`--!>`),ファイル単位の抑制のコメント判定,移動先で効くマーカーの判定に使う内容,断片の数え方.
    - 抑制の対象の変更(`//nolint:errcheck` → `//nolint` など)と,理由文の修正での誤検知.
    - 走査のタイムアウトの積み重ね,マーカーの多いファイルでの二乗の処理時間,属性の範囲の切り方と括弧の対応.
- ` ***` で始まる文脈行,payload の `cwd`,配置できないハンクの断片,ast-grep が無いときのインデントと
heredoc.
- CI の test ジョブの失敗:走査の期限が import の時点で決まっていたため,遅い実行では判定の外の走査が期限切れになっていた.
- 変えていないもの
    - 走査が失敗したときにブロックしない点:ADR の方針(壊れた走査でエージェントを止めない)どおり.
- この PR で入れた変更について jev-lint が出した advisory
の指摘(`command-query-naming`,`error-message-names-operation`)
- `_adds`,`_insert_change`,`_scan_within_budget` は query の名前に改め,走査の副作用は
`_scan` に寄せた.
    - `_patch_changes` は,返す値で命名した query なので当てはまらない.
    - `lint_format.py` の `TypeError` の文言は,この PR より前からある.
    - 規則そのものの扱いは #196 で記録する.

## 制限

完全な構文解析が要る理論上の抜け道で,この PR では扱わないもの.

- ast-grep
が無いか失敗したときは,行単位の推測で判定する.区切りの記号を含まない行の変更でマーカーがコメントに変わる場合(シェル以外の言語)は検出できない.ast-grep
は CI と dev shell で必須.期限切れは常に確認する.
-
指示と規則の一覧は,ツールごとの書式を正規表現で近似して切り出す.ツールが受け付けるのに正規表現が拾わない書き方で規則を足すと,理由文として扱われて見落とす.ツールの構文解析器を使えば防げるが,ツールごとの依存が増える.
- Rust の属性の範囲は,ast-grep
の文字列とコメントのノードを除いて括弧を対応づける.マクロの中の不均衡な括弧のように,tree-sitter と rustc
の解釈がずれる箇所は追わない.
- heredoc の判定は `.sh` と `.bash` に限る.他の言語の heredoc(Ruby,Perl
など)は対象の拡張子に無い.

## フォローアップ

- なし.

## ユーザーの判断事項

- 信頼できないリポジトリでも,そのリポジトリの `sgconfig.yml` にある `severity: error`
規則はブロックする.その規則の `message` と `note` は,エージェントへの指示としてそのまま渡る.
    - ユーザーの決定(プロジェクト自身の規則は従来どおり)に沿って変えていない.ただし,ブロックはこの PR で新しく入る挙動.
    - この PR の前も,同じ文言は通知として渡っていた.
    - ブロックするかどうかと,文言の扱いを信頼判定に合わせるかどうかは,ユーザーの判断事項.

## マージ後すぐ直す指摘

この PR では直さず,マージ直後のフォローアップ PR で直す(#216 と同じ扱い).

- markdown セルを code セルに変える NotebookEdit
で,比較元に旧本文が入る.元の本文にあるマーカーが変わらないものとして扱われ,確認なしで通る.
- Rust の属性で,`reason = "..."` の項目自体の追加・削除まで比較から外れる.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: furedea <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
furedea pushed a commit that referenced this pull request Nov 18, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.2.0](v0.1.4...v0.2.0)
(2026-11-18)


### Features

* add adr-check command for MADR ADRs
([#225](#225))
([138c542](138c542))
* **adr:** adopt the shared ADR checks
([#226](#226))
([5c94a78](5c94a78))
* **hooks:** block edits on static rule errors and guard ast-grep-ignore
([#203](#203))
([f5b3317](f5b3317))
* **hooks:** judge gh calls by effect through a policy table
([#201](#201))
([db7226d](db7226d))
* **hooks:** keep ask prefixes only for widening authority and promotion
([#199](#199))
([c3985f6](c3985f6))
* **hooks:** migrate TypeScript style rules to ast-grep and jev-lint
checks ([#195](#195))
([24d1a3e](24d1a3e))
* **lint:** flag Go packages under util and common with an error rule
([#202](#202))
([de25e1d](de25e1d))
* **lint:** judge ADR rationale with Jev
([#228](#228))
([cf1c0a3](cf1c0a3))
* **lint:** migrate agents/AGENTS.md rules to model rules and linters
([#191](#191))
([9e3e37d](9e3e37d))
* **lint:** migrate bash-style and github-actions-style rules to checks
([#194](#194))
([4e473ba](4e473ba))
* **lint:** migrate go-style rules to ast-grep and jev-lint rules
([#190](#190))
([296ad84](296ad84))
* **lint:** migrate rust-style prose rules to checks
([#193](#193))
([e184682](e184682))


### Bug Fixes

* **ci:** run the jev-lint model-rule tests in CI
([#218](#218))
([1919b06](1919b06))
* **deps:** pin dependencies
([#221](#221))
([5d083e4](5d083e4))
* **hooks:** deny git options that skip repository hooks
([#212](#212))
([e10e5b6](e10e5b6))
* **hooks:** judge a cell turned into code from scratch and ignore
attribute reasons
([#224](#224))
([96fb561](96fb561))
* **lint:** close blocking ast-grep rule gaps recorded in
[#196](#196)
([#216](#216))
([fa31947](fa31947))
* **skills:** drop the agent-run verify step that protected records
block ([#213](#213))
([700244d](700244d))

---
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>
furedea added a commit that referenced this pull request Nov 19, 2026
… a brief (#236)

## 概要

`herdr-delegation` の「Prepare a Self-Contained Brief」の既存の項目に,2 点を加えた.あわせて
`Scope and Dependencies` に 1 文を加えた.新しい節や仕組みは作っていない.

- **Scope and focus**: 範囲外の一覧と脅威モデル(入力の出所と,判断を誤ったときの損失)を brief
を書く時点で決める.lane は範囲外の P2・P3 の指摘にこの一覧を引いて答え,P0・P1
は常に直す(`development-cycle` の `delivery.md` と同じ).
- **Input**: 実装では方法を決める前に既存の道具(標準ライブラリ,既に入っている依存,de facto
の外部ツール)を調べ,選んだ理由(または合うものが無い理由)を brief に書く.
- **Scope and Dependencies**: 承認済みの plan の独立した lane は,それぞれ別の Herdr
worktree で順番待ちせず並行して走らせる.同じ行を変える lane
だけは例外で,順番に走らせる.並行にできる機会があるだけでは委任を許可しない,という既存の規則は残している.

#209 では範囲と脅威モデルが無く,指摘が範囲外まで広がった.#212 では既存の道具を調べずに自作して作り直しになった.

## 重複の確認

`development-cycle` には brief を書く手順の重複が無い.`delivery.md` は lane
が範囲外の指摘に答える側の規則で,brief に書く側の規則は `herdr-delegation` の 1
か所にまとまっている.`branches.md` は `herdr-delegation` へのリンクのみ.

## 確認

- `nix flake check --no-build`: 通過

## 範囲外の指摘

- 並行 lane の文を 1 つの PR に含めることへの指摘: ユーザーがこの PR
に加えるよう指示した変更で,本文の概要に記載した.lane が同じ行を変えるかは plan の lane
分割(`issue_plan.md`)で決まり,承認済みの plan の lane
だけが対象なので,「委任を推論しない」という既存の文とは矛盾しない.
- 同じ行を変える lane を 1 つにまとめる,または stacked-branch 手順を要求する指摘:
ユーザーの指示は「順番に走らせる」で,lane 分割の見直しと stacked-branch 手順は本変更の範囲外(P2).

Closes #233
Refs #169

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: furedea <[email protected]>
Co-authored-by: Claude Sonnet 5.5 <[email protected]>
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.

1 participant