Repository navigation
test(rules): audit wrapper inner commands and close three review findings (#107) - #114
Conversation
…hey run An allow prefix that is a process wrapper, such as xargs, hands its tail to the hooks as a command, so the scoped rules of that command apply to it. find_overlaps took only the wrapper name and skipped those rules. For a wrapper prefix it now drops the begins-within-the-prefix constraint and intersects the inner command's rule language, honoring programs and exceptions. command -v is excluded because it does not run the command. The thirteen xargs overlaps it reports are listed apart from the reviewed ones, awaiting confirmation. Refs #107 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…le gap The strict xfail for the rules whose exceptions and programs the generator drops had no raises, so a Z3 TimeoutError counted as the known gap too. Restrict it to AssertionError and pin that in a test. Refs #107 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… change test_the_generated_claude_rules_decide_like_the_source reads the generated permissions, but agents/claude/settings.json did not map to tests/test_generated_rules.py, so a change that only touched its Bash(...) entries ran no comparison. Add the mapping and a selection test for it. Refs #107 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
claude_rules skipped an entry named Bash, so a generated allow-all entry would have passed the equivalence comparison unseen. Treat it as an unrecognized Bash entry and raise ValueError; add it to the unknown-shape tests. Refs #107 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
Codex Review Summary: ❌ FailedThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Review summary (read-only) No P0–P3 findings. What I checked:
Note: I could not run the test suite in this environment (command approval was not granted), so this review comes from reading the code only. 🤖 Generated with Claude Code |
…r can meet Restricting the xfail to AssertionError exposed that the largest real rule needs about 20 s of the 30 s Z3 limit on an idle machine and timed out on a loaded CI runner, which the broad xfail had hidden. Raise the limit for the denial comparison to 180 s; an undecided language still raises. Refs #107 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
レビュー結果ブロッキングな指摘はありません(P0/P1:0 件,P2/P3:0 件). 確認した点:
補足(指摘ではありません): |
The user confirmed on 2026-11-10 that the thirteen xargs overlaps are safe: the hooks unwrap xargs and deny the inner command, the same structure as git add and git add . Move them into the reviewed list and drop the unconfirmed marker. Refs #107 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
|
||
| sys.path.insert(0, str(REPO_ROOT / "agents/hooks/lib")) | ||
|
|
||
| from shell_wrappers import COMMAND_LOOKUP as GUARD_COMMAND_LOOKUP, WRAPPERS |
There was a problem hiding this comment.
P2 — This test now depends on agents/hooks/lib/shell_wrappers.py (WRAPPERS decides which allow prefixes get the wrapper check, and COMMAND_LOOKUP is pinned by test_the_command_lookup_options_match_the_guard). But .agents/hooks/rules/related_test_extensions.json has no entry for agents/hooks/lib/shell_wrappers.py, so a change to that file won't pick this test.
Example: someone adds nice to WRAPPERS while nice is an allow prefix, or edits COMMAND_LOOKUP. The REVIEWED set or the pin test would then fail, but selective verification never runs tests/test_forbidden_overlap.py, so nothing catches it until a full run. Suggest mapping agents/hooks/lib/shell_wrappers.py → tests/test_forbidden_overlap.py and adding a selection case in tests/test_related_test_extensions.py. You already do this for agents/claude/settings.json in this PR.
There was a problem hiding this comment.
Not changed. An unmapped hook lib module falls back to the full suite, which is pinned by test_an_unmapped_hook_module_keeps_its_full_suite_fallback; with the mapping I tried locally, selected_tests("agents/hooks/lib/shell_wrappers.py") returned no narrowed test list, so a change to that file already runs every test, including tests/test_forbidden_overlap.py. Adding a mapping would replace that fallback with a narrower selection, which is the opposite of what the finding wants.
Review summaryNo blocking findings (P0/P1: 0).
What I checked and found fine:
🤖 Generated with Claude Code |
## 概要 agent-harness の入力を 0.9.10 から 0.9.11 相当へ更新し,既知の差分として置いていた xfail を外す. | 項目 | 変更前 | 変更後 | | --------------------------------- | ------------------------------------------------------- | -------------------------------------------------------- | | `flake.lock` の agent-harness | `6c60666`(v0.9.10) | `757abca`(v0.9.11 に CI のみの 1 commit が載った main) | | `tests/test_denial_difference.py` | `exceptions` と `programs` を持つ rule は xfail(strict) | 全 rule が通常のテスト | - 0.9.11 で `generate-forbidden-commands` が `exceptions` と `programs` を残すようになった(furedea/agent-harness#203). - 生成された rule はソースの rule と完全に一致するので,形のテストは rule 全体を比較する. - xfail に付随していた `DROPPED_FIELDS`,`DROPS_FIELDS`,#114 の `raises=AssertionError` を確認するテストを削除した.これらは既知の差分のためだけに存在した. - `tests/test_generated_rules.py` と `tests/test_forbidden_overlap.py` に xfail はなく,変更していない. Refs furedea/agent-harness#203 ## 検証 - `nix develop --command pytest tests -q`: 4478 passed, 1 skipped(#114 を取り込んだ origin/main への rebase 後). - rebase で #114 と `tests/test_denial_difference.py` が衝突したので,xfail 関連を全て削除する側で解決した. ## 計画からの変更 なし. --------- Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
概要
#107 のうち 1・4・5・6 番目の項目を,項目ごとのコミットで対応する.2・3 番目(UTF-8 の大小文字,deny 性質)は範囲外.
Refs #107
計画:#107 (comment)
変更
find_overlaps(prefixes, rules, wrappers).wrapper の prefix は「語の範囲内から始まる」制約を外し,内側コマンドの規則言語(programs・exceptionsを含む)との共通部分を取る.command -v/-Vは除外.wrapper 名はガードのWRAPPERSを使うraises=AssertionErrorを追加し,テストで固定.agents/hooks/rules/related_test_extensions.jsonのagents/claude/settings.jsonにtests/test_generated_rules.pyを追加し,選択テストを追加Bashclaude_rulesがValueErrorで拒否し,未知の形のテストに追加新規の重なり(ユーザーが 2026-11-10 に確認済み)
新しいチェックが報告した
xargsの重なり 13 件は,ユーザーが 2026-11-10 に安全と確認した(hook がxargsを外して内側のコマンドを拒否する.git addとgit add .と同じ構造).REVIEWEDに入れてある.allow prefix のうち wrapper で新たに重なるのはxargsだけだった..venv/bin/pythonxargs .venv/bin/pythongit addの広い形(^あり・なし)xargs git add .git commitの--no-verify/-n(^あり・なし)xargs git commit -npython -m pip/ensurepipxargs python -mpipfind -delete/-exec/-fprintfなどxargs find -fprintfherdr agent start ... --xargs herdr agent start --cargo mutants --in-placexargs cargo mutants --in-placepnpm exec stryker --inPlacexargs pnpm exec stryker --inPlaceuv run ... mutmut applyxargs uv run mutmut apply(#102 の指摘)(file|chrome):xargs agent-browser file:xargs agent-desktop パスワードいずれも「provider は
xargsを許可し,hook が内側のコマンドを拒否する」形で,git addとgit add .と同じ構造.検証
tests/test_forbidden_overlap.py・tests/test_denial_difference.py・tests/test_generated_rules.py・tests/test_related_test_extensions.py:成功(xfail 4 件は想定どおり)Bash).4 はraisesを付けた後にマーカーを固定するテストを足したverification_session.py verifyはローカルで pytest が 8 件失敗した.原因は PATH 上のagent-harnessが lock の 0.9.9 より新しく,xfail が XPASS(strict) になるため.flake の dev shell では成功し,本変更とは無関係計画からの変更
なし.
🤖 Generated with Claude Code