Skip to content

feat(hooks): keep ask prefixes only for widening authority and promotion - #199

Merged
furedea merged 35 commits into
mainfrom
feat/narrow-ask-prefixes-to-authority-and-promotion
Nov 15, 2026
Merged

furedea merged 35 commits into
mainfrom
feat/narrow-ask-prefixes-to-authority-and-promotion

Conversation

@furedea-agent

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

Copy link
Copy Markdown
Contributor

rm の確認を provider の接頭辞からコマンドガードに移し,ワークツリーとセッションの一時ディレクトリの中だけを確認なしにする.ask 接頭辞は 48 個から 46 個(rm と,Herdr に存在しない herdr pane create を外す).
依存の変更と Herdr のペイン入力は,レビューでガードが閉じきれない抜け道が続いたため確認のまま残した.判断してほしい点は「承認済み設計との違い」.

flowchart TD
  C[rm を含むコマンド] --> L{全語がリテラルで,並ぶのはシェル組み込みだけ?}
  L -- いいえ --> ASK[確認]
  L -- はい --> P{rm とラッパーが信頼できるシステムのプログラム?}
  P -- いいえ --> ASK
  P -- はい --> R{被演算子がワークツリーかセッション一時ディレクトリの中で .git でない?}
  R -- いいえ --> ASK
  R -- はい --> OK[許可]
Loading
コマンド 変更前 変更後
rm file(ワークツリーと,provider が発行した claude-<uid> 一時ディレクトリの中) 確認 許可
rm の確認条件(hook) — .git,範囲外のパス,実行時に決まる語やブレース展開,xargs,拒否接頭辞にない再帰,シェル組み込み以外や変数の変更と並ぶ rm,コマンド内のどこかに展開がある,信頼できない rm・ラッパー(root 所有でない,ワークツリーや一時ディレクトリにある PATH 項目が先行,継承したシェル関数・BASH_ENV・LD_PRELOAD 系),root セッション,git とディスク上の .git でワークツリーが食い違う
rm -r,rm -rf など 拒否 拒否
herdr <subcommand> --help 確認 許可
herdr pane create(Herdr に存在しないコマンド) 確認 接頭辞を削除
依存の変更(uv add,uv lock --upgrade,pnpm add,cargo add/update,go get,go mod tidy,nix flake update) 確認 確認(justification を更新)
herdr pane send-text/send-keys/run,herdr agent send-keys 確認 確認(justification を更新)
その他の C・D(npx,docker run,gh pr merge,git stash drop,kill,herdr server など) 確認 確認

検証結果

  • uv run --frozen pytest:5035 passed,1 skipped
  • lefthook run pre-commit --all-files,deptry,vulture,ty:全チェック成功
  • 追加テスト:tests/hooks/test_removal_paths.py(許可と,上の確認条件ごとの確認),tests/hooks/test_herdr_terminal_input.py
  • tests/test_command_permission_sync.py:ask の集合が C・D の一覧と一致すること,rm が allow にだけ描画されることを固定
  • tests/codex/test_execpolicy.py:rm が allow,依存の変更と C・D の隣接形が prompt
  • 既存のすり抜け対策テストはすべて成功.test_direct_ask_prefixes_stay_with_the_provider の例だけ,rm が ask 接頭辞でなくなったため rm -r build を kill 1234 に置き換えた
  • 2026-11-14 の確認ログのうちこの範囲の 2 件:herdr worktree create --help は許可になった.herdr agent wait ... >/dev/null はリダイレクトで literal_words 規則から外れるためで,syntax レーンの範囲として残した
  • レビュー指摘:セキュリティ上のものはすべて修正し,各スレッドに返信して resolve した.uv add --group dev の件(非セキュリティ)だけレビュー上限で見送り
承認済み設計との違い(判断してほしい点)
  • 依存の変更は ask のまま:uv はユーザー設定で 1 週間の年齢制限が効くが,オプション・環境変数・ユーザー/システム/プロジェクト設定・PATH・同じコマンド内の書き込みなど,制限を外したり取得元を変えたりする経路をガードがすべて見ることはできなかった(レビューのたびに新しい経路が見つかった).pnpm・cargo・go・nix にはそもそも年齢制限がない.sink 側(パッケージマネージャの設定を Nix で固定し,サンドボックスで設定ファイルの書き込みを禁じる)で強制するのが筋なので,後続 Issue を推奨
  • Herdr のペイン入力 4 つは ask のまま:自分が起動したペインでも,Enter や y で子の許可ダイアログを承認できる.入力が子の終了後のシェル(サンドボックス外)に届く経路もある
  • rm の許可範囲は狭い:シェル組み込み以外と並ぶ rm(ls && rm x など)や,展開を含むコマンドは確認になる.PATH の先頭がワークツリーや一時ディレクトリにある環境,LD_LIBRARY_PATH などを継承する環境では常に確認になる
範囲・前提・影響
  • 範囲:agents/command_permissions.json,agents/hooks/rules/allowed_commands.json(herdr --help),agents/hooks/lib/{removal_paths,system_programs}.py(新規),agents/hooks/lib/herdr_ownership.py(ownership 操作の --help を除外するだけ),pyproject.toml(deptry の first-party),docs/DESIGN*.md.共有モジュールは agents/hooks/guard_command.py(全体チェックを関数にまとめて rm の判定を追加)と agents/hooks/lib/shell_inspection.py(変数の変更と前置の代入を判定する関数 2 つを追加)だけ
  • Claude Code:ask ルールは auto mode でも確認を出す(公式ドキュメント permission-modes の「Explicit ask rules still force a prompt.」).hook の ask も確認になる
  • agent-harness(変更なし):Claude は Bash(prefix:*) を allow/ask/deny に描画,Codex は execpolicy の allow/prompt/forbidden,Devin は Exec(...) の allow/ask/deny.Hermes・Pi・Dsh は接頭辞を受け取らない
  • Codex:shell allowed hook を通るので rm の判定も効く.hook の確認は拒否に変わる(ADR-0017・0018)ため,Codex では確認条件に当たる rm は拒否になる
  • 後続:uv add --group dev を --dev と同じく扱うか(レビュー上限で見送り),依存の変更を sink 側で強制する方法
  • 出典:feat(guard): judge commands by their effect and ask only to widen authority or promote #197,feat(agent-runtime): build persistent, isolated, provider-neutral agent infrastructure #181,feat(hooks): judge compound gh/herdr commands by their parts #186

Refs #197

🤖 Generated with Claude Code

@furedea

furedea commented Nov 14, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 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-15T12:32:07.192938Z b778eca 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/removal_paths.py Resolved
Comment thread agents/command_permissions.json Resolved
@github-actions

Copy link
Copy Markdown

Review summary

I posted two findings as inline comments. One of them should block the merge.

  • P1 agents/hooks/lib/removal_paths.py: rm operands are resolved against the payload cwd, and any cd, pushd or env -C earlier in the command is ignored. As a result cd .git && rm -f index runs with no prompt: Git metadata is deleted, the target is inside the worktree so the sandbox allows it, and before this PR it prompted. cd ~ && rm .bashrc and env -C / rm etc/hosts also pass the check. shell_syntax.reached_directories already tracks directory changes and could fix this. Tests for cd and env -C cases should be added.
  • P2 agents/command_permissions.json: uv add (builds sdists) and pnpm add (lifecycle scripts) still run fetched code, so allowing them doesn't match keeping npm install under ask.

I found no problems in the Herdr pane-ownership change. It requires an owned and still-live agent in the target pane plus one simple direct call, and its tests cover takeover, exited agents, run-time targets and compound forms.

This review was read-only. I couldn't run ad-hoc probes in this environment, so these findings come from reading the 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: 199bbe725a

ℹ️ 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/removal_paths.py Resolved
Comment thread agents/hooks/lib/herdr_ownership.py Resolved
@furedea

furedea commented Nov 14, 2026

Copy link
Copy Markdown
Owner

@codex review

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

Copy link
Copy Markdown

Review summary

Blocking: 1 (P1)

  • P1 agents/hooks/lib/herdr_ownership.py: pane send-keys, pane send-text and pane run are now allowed whenever an agent this session started is running in the target pane. These commands send raw terminal input, not prompts to the agent. One call can exit the agent (for example C-c C-c or a control character) and then type into Herdr's shell, which runs outside the sandbox. The ownership check only proves the agent is running when the hook runs. Details are in the inline comment.

Checked with no findings:

  • removal_paths.py handles recursive flags, including shortened --rec forms, operands known only at run time, xargs, .git reached directly or through links, links in parent directories, and commands that change the working directory or create links (cd, env -C, ln, mv and others). Wrapped forms are parsed as separate commands, so they are covered too.
  • Wrapped or absolute-path Herdr calls (for example timeout 5 herdr …) fail the single-direct-call requirement and ask, so they don't skip the ownership check.
  • The new go get, go mod tidy and --help rules, and moving the dependency-change prefixes to allow, match the categories described in the PR.
  • The new tests cover the rm and pane-ownership paths.

I couldn't run the test suite or the hooks in this environment because command execution needed approval, so everything above comes from reading the 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: a794d99b2f

ℹ️ 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/command_permissions.json Resolved
Comment thread agents/hooks/lib/removal_paths.py Resolved
Comment thread agents/command_permissions.json Resolved
@furedea

furedea commented Nov 14, 2026

Copy link
Copy Markdown
Owner

@codex review

@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: 93799ee5a8

ℹ️ 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/command_permissions.json Resolved
Comment thread agents/hooks/lib/herdr_ownership.py Resolved
@github-actions

Copy link
Copy Markdown

Review summary

Findings: 0 × P0, 0 × P1, 1 × P2, 0 × P3

  • P2 agents/hooks/lib/herdr_ownership.py: the owned-pane check runs only before the call. Raw send-keys/send-text/run input can end the owned agent in the middle of the call (C-c C-c, /exit\n). Any keys left over then reach the root pane's shell, which runs outside the sandbox. Before this PR these prefixes were provider ask.

What I checked and found sound:

  • removal_paths:
    • operand splitting, including -- and dynamic words
    • recursive detection (-fR, --rec abbreviations)
    • parent-only symlink resolution, so removing a link removes only the link
    • .git detection, case-insensitive and through links
    • tilde handling (~user/~- are dynamic, so they ask)
    • xargs operands
    • chdir and link-making companions, including wrappers peeled by shell_syntax.unwrapped
  • Codex and Devin workdir is applied to cwd before the guard runs.
  • Devin and Codex both run verification_session pre-tool-use, so the ownership check is in place wherever the prefixes became allow.
  • The --help exemption only applies to an exact ("--help",) tail.
  • The guard_command.py refactor keeps the earlier check order and short-circuit behaviour.
  • Tests cover the new allow and ask boundaries well.

🤖 Generated with Claude Code

@furedea

furedea commented Nov 14, 2026

Copy link
Copy Markdown
Owner

@codex review

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

Copy link
Copy Markdown

レビュー結果

P1(1 件):agents/hooks/lib/removal_paths.py:106 の Path(word).expanduser().シェル層が展開しない引用付きの '~zz/x' を渡すと RuntimeError が起き,guard_command.decide はこれを捕捉しない.hook は status 1 で落ち,Claude Code はこれを止めないエラーとして扱うため,新しい Bash(rm:*) の allow がそのまま通る.例:rm '~zz/x' ~/.ssh/id_ed25519 は確認なしで鍵を消す..expanduser() を外し(~ の展開は shell_words が済ませている),引用付きの ~ を使うテストを足すのを推奨.

ほかに確認した点(指摘なし):

  • rm ガードの判定:再帰,.git,リンク経由のパス,cwd の変更,同じコマンド内のリンク作成,xargs
  • Herdr のペイン所有権チェック,安全なキーとテキストの制限,--help の扱い
  • 依存変更の allow と,pnpm add -g・uv add --dev の拒否パターン

テストは書かれた範囲を十分に押さえているが,上記の 1 件はテストにない.なお,この環境ではコマンドの実行を許可されなかったため,テストスイートもこのクラッシュの再現も実行していない.RuntimeError は pathlib の既知の挙動とコードの静的な追跡に基づく.

🤖 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: 636ee90d35

ℹ️ 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 14, 2026

Copy link
Copy Markdown
Owner

@codex review

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

Copy link
Copy Markdown

Review summary

Blocking (P1): 1

  • herdr_ownership.py: allowing send-keys Enter/Up/Down and one-line text into owned agent panes lets a session approve its child agent's own permission dialogs (and use !cmd / /permissions), so every ask in the child can be approved without the user. These prefixes asked before this PR.

Non-blocking (P2): 1

  • The exit-word check looks at each call alone. send-text '/exitx' + send-keys Backspace Enter (or splitting /ex + it) still submits /exit. That ends the agent and opens the stale-listing window to the unsandboxed shell.

The rm path guard (removal_paths.py), the dependency allow changes, and the new deny patterns look correct and are well tested. I found no issues there.

🤖 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: 15a4bc290e

ℹ️ 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/herdr_ownership.py Resolved
Comment thread agents/hooks/lib/removal_paths.py Resolved
@furedea

furedea commented Nov 14, 2026

Copy link
Copy Markdown
Owner

@codex review

@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: e580cae916

ℹ️ 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/herdr_ownership.py Resolved
@furedea

furedea commented Nov 14, 2026

Copy link
Copy Markdown
Owner

@codex review

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

Copy link
Copy Markdown

Review summary

Blocking findings (P0/P1): 0

  • [P2] removal_paths.py: on macOS, the per-user temp directory (/var/folders/.../T) is treated as a session-owned root. If TMPDIR is not overridden, rm of other apps' files there runs without a prompt. Details are in the inline comment.

Areas checked with nothing to report:

  • rm guard: option permutation, -- handling, recursive short/long forms, dynamic and glob operands, xargs, symlinked parents, .git in any casing, cd/env -C/companion programs, unknown cwd
  • dependency_settings: assignments, env/export/source and wrappers trigger an ask
  • forbidden rules for pnpm add -g (all spellings) and uv add --dev in any position
  • Herdr --help exemption and ownership check
  • pane input still asks at the provider level, matching DESIGN.md

The tests cover the changed behavior well.

Note: the PR body's "後続" list and test file names (test_herdr_pane_ownership.py) look stale against the current code. The expanduser and shared /tmp P1s are already fixed, and pane input stays ask. Please update the description before merging.

@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: a682c48d63

ℹ️ 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/dependency_settings.py Resolved
@furedea

furedea commented Nov 14, 2026

Copy link
Copy Markdown
Owner

@codex review

@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: 1cbdb18bc3

ℹ️ 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/system_programs.py Resolved
…ides

- CLAUDE_TMPDIR and CLAUDE_CODE_TMPDIR name the parent a provider creates
  its session directories in, so only their claude-* children count as rm
  roots.
- An inherited LD_PRELOAD, LD_LIBRARY_PATH, LD_AUDIT, or DYLD_ variable
  injects code into every dynamically linked program, so no program counts
  as a system one while one is set.
- Tests pin that arithmetic assignments beside rm already ask.

Refs #197

Co-Authored-By: Claude Opus 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: no blocking findings (0 × P0/P1)

I read through the new rm guard (removal_paths.py), system_programs.py, the guard_command.py refactor, the Herdr --help / ownership change, and the permission changes in command_permissions.json. Things I checked and found handled:

  • Wrappers that can change the environment: env PATH=./bin rm x and sudo rm x ask, because env and sudo are not allowed as companions. Changing variables with a=1; rm x or export also asks.
  • Commands that could run before rm and change what its paths mean: cd, hash -p, printf -v, function bodies, and subshells all ask. Only listed builtins (echo, test, pwd, …) may run alongside rm.
  • Paths the guard cannot fix in advance: globs, $var, brace expansion, xargs operands, and option-looking words that are only known at run time all ask. .git paths ask in any letter case, and linked parent directories are resolved through their links.
  • Codex workdir: the provider adapter rebases cwd to it, so relative operands resolve against the right directory.
  • Herdr: ownership is skipped only when --help is the only word after the subcommand. The ask prefixes for typing into a pane are unchanged.
  • Tests: the changed behavior is well covered (test_removal_paths.py, test_herdr_terminal_input.py, execpolicy, permission sync).

Not a code problem: the PR description doesn't match the diff. The description says uv add / uv lock --upgrade become allow. It also lists dependency_settings.py, test_dependency_commands.py and forbidden_commands.json changes (deny for pnpm add -g / uv add --dev in every position and spelling). None of these are in this diff. Here, uv stays ask, which DESIGN.md and test_execpolicy.py (prompt for uv add requests) confirm. Please update the description, or the table and the 48→43 count, so reviewers approve what actually ships.

Design trade-off to be aware of (as intended, not a bug): rm inside the worktree now deletes untracked or modified files without asking, and Git cannot restore those. In Codex, any rm the hook would ask about is denied instead.

🤖 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: 56705c6588

ℹ️ 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/shell_inspection.py Resolved
Any expansion in the command, such as an arithmetic subscript or a default
assignment, can change PATH before rm runs, so rm asks whenever a word in
the command is known only at run time. Tests clear inherited loader and
shell-function variables so they model a clean session environment.

Refs #197

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

furedea commented Nov 15, 2026

Copy link
Copy Markdown
Owner

@codex review

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

Copy link
Copy Markdown

Review summary

P1 (1 finding, should block merge)

  • agents/hooks/lib/removal_paths.py:52: if the first command has an empty program name (''), the companion check and the system-program check both pass, because next() returns "", which is falsy. So '' ; cd ~ ; rm .bashrc is allowed: the guard resolves .bashrc from the payload cwd (the worktree), but Bash deletes ~/.bashrc. Since rm is now an allow prefix, this lets the new "rm next to cd" rule be bypassed. Fix it by checking whether any segment matches, and add a regression test.

Not a code problem: the PR description is out of date

  • The description says uv add and uv lock --upgrade(-package) become allow, and that dependency_settings.py, test_dependency_commands.py and forbidden_commands.json change. None of these is in the diff. In the code, uv stays ask (only the justification text changed), and the Codex test and docs/DESIGN.md also say uv add prompts. Please bring the description in line with the code before merging.

Other checks

Nothing else to report from: the wrapper layers (nice and timeout are checked on each layer), recursive-option detection, .git metadata detection through links, the temporary-directory roots, the Herdr --help ownership exclusion, and the ask-prefix changes.

🤖 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: a274270834

ℹ️ 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/removal_paths.py Resolved
An expansion anywhere in the command, a redirection target or here-string
included, can change PATH before rm runs, so rm asks unless every word of
the command is literal.

Refs #197

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

furedea commented Nov 15, 2026

Copy link
Copy Markdown
Owner

@codex review

Comment thread agents/command_permissions.json Resolved
@github-actions

Copy link
Copy Markdown

Review summary

Blocking findings (P0/P1): none.

P2 (1): The PR description says the uv dependency-change prefixes become allow and lists dependency_settings.py, forbidden_commands.json and test_dependency_commands.py. None of that is in the diff: uv stays ask, which matches docs/DESIGN.md and the tests. The ask set shrinks by 2 (rm, herdr pane create), not by 5. Details are in the inline comment.

What I checked in the rm path guard (removal_paths.py, system_programs.py):

  • Operands: I traced how they are split. Recursive detection covers bundled short options, options after operands and abbreviated --recursive. Run-time and brace-spread operands ask, and so do xargs operands.
  • Path resolution: the parent directory is resolved through links and the entry's own name is kept. Git metadata is checked on both the word as written and the resolved path.
  • Worktree root: git rev-parse and the .git found on disk must agree, so core.worktree or a planted .git cannot widen it.
  • Other commands beside rm: wrappers expand into separate commands, so the rm inside nohup/command is still checked as a system program. cd, pushd, env -C, function bodies and alias all fall outside the allowed companions and ask.
  • Variables and environment: variable assignments, arithmetic assignments and inherited shell functions, BASH_ENV, ENV and loader variables (LD_*, DYLD_*) all cause an ask.

I found no way past these checks. The herdr … --help allow regex and the ownership-check exemption for --help look fine.

Not a finding, worth confirming: Devin's hook payload has no cwd, so the adapter falls back to DEVIN_PROJECT_DIR. If Devin's exec tool keeps the working directory between calls, a relative rm operand would be resolved against the project root instead of the shell's real directory.

@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: 69c1e105b4

ℹ️ 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/system_programs.py Resolved
- An empty program name no longer hides the segments after it from the
  companion and system-program checks.
- Only the provider directory for this user, claude-<uid>, counts as a
  temporary root, not every claude-* child of a shared parent.
- rm asks when a PATH entry before the program it finds lies in the
  worktree or a session temporary directory, where a program of the same
  name could appear before the command runs.

Refs #197

Co-Authored-By: Claude Opus 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)

No findings: nothing at P0–P3.

What I checked:

  • removal_paths.objection is wired into the allowed guard for every Bash call. Codex's workdir is turned into cwd before the guard runs, so paths resolve against the directory the command really runs in.
  • Wrapped calls (command rm, nohup rm, …) are split into separate layers by shell_syntax.unwrapped. The inner rm layer still gets the system-program and prefix-assignment checks, and its raw is rebuilt so has_prefix_assignment matches correctly.
  • Operand resolution looks sound. The parent is resolved through links and the final name is kept. .git is matched case-insensitively on both the written path and the resolved path. Options after operands and -- are handled, and so are recursive short, bundled and abbreviated long forms.
  • Temporary roots are safe. A claude-<uid> root that is itself a symlink adds no reach, because operands are compared after resolving. Shared /tmp and macOS's per-user temporary directory are excluded.
  • system_programs treats an empty or relative PATH entry as untrusted. Relative program paths, root sessions and inherited loader, function or BASH_ENV overrides all make it ask.
  • The herdr … --help allow regex and the ownership skip only match an exact trailing --help.

Limitation, not filed as a finding: the guard reads the hook process's environment (PATH, TMPDIR). The shell environment the Bash tool runs commands in may set these differently. This is consistent with the documented scope.

Note: my sandbox blocked running the probe script, so these conclusions come from reading the code only.

@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: b778ecae62

ℹ️ 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/removal_paths.py Resolved
@furedea
furedea merged commit c3985f6 into main Nov 15, 2026
25 of 27 checks passed
@furedea
furedea deleted the feat/narrow-ask-prefixes-to-authority-and-promotion branch November 15, 2026 15:02
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>
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