Repository navigation
feat: PreToolUse remote_write_requires_approval を publish lane 証跡で通過可能にする - #1442
Conversation
…能にする (#1408) `scripts/session-recording/codex-hook-adapter.mjs` の PreToolUse remote write 判定に、`rtk git push origin HEAD:refs/heads/<active-branch>` かつ検証済み publish lane 証跡(expected/current/local/verified/declared head、 allowed_paths_gate_status)が揃っている場合だけ generic `remote_write_requires_approval` deny を経由しない経路を追加した。 安全判定ロジックは `scripts/agent-guards/git_mutation_command_policy.py` の `classify_rtk_git_mutation` を CLI 経由で再利用し(`--boundary-layer` 引数を 追加して呼び出し元を区別)、hook adapter 側には別実装の安全判定を増やして いない。head 不一致・allowed_paths_gate 失敗は `PUBLISH_SAFETY_STOP_REPORT_V1` 相当の構造化 reason で deny し、 force/tag/all/delete/mirror push・直接 `git push`・`git -C <dir> push`・ wrapper bypass は引き続き deny する。 docs/dev/session-recording-policy.md に #360 の destination guard と本 Issue の publish lane approval bridge の責務差分を追記した。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Preview URLPreview removed (PR #1442 closed). |
|
$ vitest run --exclude 'tests/e2e/' --exclude '.claude/worktrees/' RUN v4.1.6 /home/squne/projects/LOOP_PROTOCOL/.claude/worktrees/agent-a38a02b130b3fe1ff Test Files 92 passed (92) |
|
PASS |
Verification Result (test-runner)TEST_VERDICT:
result: PASS
mergeable: MERGEABLE
merge_state_status: CLEAN
branch_behind_main: false
baseline_only: true
verification_commands_pass: 6
verification_commands_fail: 0
verification_skipped_count: 0
human_review_required: falseAC 検証結果
補足: 全体 pytest で観測された 5 件の失敗について
本 PR が新規追加した6テスト(AC1-AC4 各lane)は全て実 entrypoint ( CI全18 required checks SUCCESS。mergeStateStatus: CLEAN。 |
Verdict: APPROVEMergeability
Evidence Check
Blockers
Non-blockers
注記: local root checkout の hook policy により gh pr review の formal approve/request-changes 投稿がこの実行環境からは不可(gh_mutation_denied)。本コメントは gh pr comment 経由で LOOP_VERDICT_V2 を代替投稿する。 LOOP_VERDICT_V2verdict: APPROVE
reviewed_head_sha: "0d6b32b16e18d66b84dfce180dd953866352a4bd"
merge_ready: false
mergeability:
mergeable: "MERGEABLE"
merge_state_status: "CLEAN"
blockers: []
required_auto_actions:
- kind: update_pr_body_hygiene
executor: implementation-worker
skill: open-pr.update_pr
blocking_merge_ready: true
mechanical: true
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
status: ok
changed_files_source: git_diff_name_status_find_renames_z
changed_files:
- docs/dev/session-recording-policy.md
- scripts/agent-guards/git_mutation_command_policy.py
- scripts/session-recording/codex-hook-adapter.mjs
- tests/session_recording/codex/test_hook_adapter.py
changed_file_records:
- path: docs/dev/session-recording-policy.md
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: scripts/agent-guards/git_mutation_command_policy.py
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: scripts/session-recording/codex-hook-adapter.mjs
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: tests/session_recording/codex/test_hook_adapter.py
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
audited_paths:
- path: docs/dev/session-recording-policy.md
path_role: filename
source_record_index: 0
- path: scripts/agent-guards/git_mutation_command_policy.py
path_role: filename
source_record_index: 1
- path: scripts/session-recording/codex-hook-adapter.mjs
path_role: filename
source_record_index: 2
- path: tests/session_recording/codex/test_hook_adapter.py
path_role: filename
source_record_index: 3
violations: []
allowed_paths_gate_source: review_subagent |
|
(補足: 直前の同種コメントは template placeholder のバグで PIPE の文字化けがあったため、本コメントが正としてsupersedeします。) Verdict: APPROVEMergeability
Evidence Check
Blockers
Non-blockers
注記: local root checkout の hook policy により gh pr review の formal approve/request-changes 投稿がこの実行環境からは不可(gh_mutation_denied)。本コメントは gh pr comment 経由で LOOP_VERDICT_V2 を代替投稿する。 LOOP_VERDICT_V2verdict: APPROVE
reviewed_head_sha: "0d6b32b16e18d66b84dfce180dd953866352a4bd"
merge_ready: false
mergeability:
mergeable: "MERGEABLE"
merge_state_status: "CLEAN"
blockers: []
required_auto_actions:
- kind: update_pr_body_hygiene
executor: implementation-worker
skill: open-pr.update_pr
blocking_merge_ready: true
mechanical: true
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
status: ok
changed_files_source: git_diff_name_status_find_renames_z
changed_files:
- docs/dev/session-recording-policy.md
- scripts/agent-guards/git_mutation_command_policy.py
- scripts/session-recording/codex-hook-adapter.mjs
- tests/session_recording/codex/test_hook_adapter.py
changed_file_records:
- path: docs/dev/session-recording-policy.md
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: scripts/agent-guards/git_mutation_command_policy.py
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: scripts/session-recording/codex-hook-adapter.mjs
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: tests/session_recording/codex/test_hook_adapter.py
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
audited_paths:
- path: docs/dev/session-recording-policy.md
path_role: filename
source_record_index: 0
- path: scripts/agent-guards/git_mutation_command_policy.py
path_role: filename
source_record_index: 1
- path: scripts/session-recording/codex-hook-adapter.mjs
path_role: filename
source_record_index: 2
- path: tests/session_recording/codex/test_hook_adapter.py
path_role: filename
source_record_index: 3
violations: []
allowed_paths_gate_source: review_subagent |
|
test comment single line |
|
line1 |
|
test with (parens) and colon: text |
|
test with escaped backtick |
Verdict: APPROVE (re-review after PR body hygiene fix)前回 verdict(https://github.com/squne121/loop-protocol/pull/1442#issuecomment-4941545299)は APPROVE / 再確認した内容
Blockers
Non-blockers
注記: local root checkout の hook policy により LOOP_VERDICT_V2verdict: APPROVE
reviewed_head_sha: "0d6b32b16e18d66b84dfce180dd953866352a4bd"
merge_ready: true
mergeability:
mergeable: "MERGEABLE"
merge_state_status: "CLEAN"
blockers: []
required_auto_actions: []
auto_fix_applied:
- kind: update_pr_body_hygiene
executor: implementation-worker
result: applied
evidence: "PR body に 受け入れ条件の達成状況 / 検証コマンド結果 / Allowed Paths 遵守 の3見出しを追加(body-only, head_sha不変)"
follow_up_issue_requests: []
allowed_paths_gate:
status: ok
changed_files_source: git_diff_name_status_find_renames_z
changed_files:
- docs/dev/session-recording-policy.md
- scripts/agent-guards/git_mutation_command_policy.py
- scripts/session-recording/codex-hook-adapter.mjs
- tests/session_recording/codex/test_hook_adapter.py
changed_file_records:
- path: docs/dev/session-recording-policy.md
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: scripts/agent-guards/git_mutation_command_policy.py
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: scripts/session-recording/codex-hook-adapter.mjs
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: tests/session_recording/codex/test_hook_adapter.py
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
audited_paths:
- path: docs/dev/session-recording-policy.md
path_role: filename
source_record_index: 0
- path: scripts/agent-guards/git_mutation_command_policy.py
path_role: filename
source_record_index: 1
- path: scripts/session-recording/codex-hook-adapter.mjs
path_role: filename
source_record_index: 2
- path: tests/session_recording/codex/test_hook_adapter.py
path_role: filename
source_record_index: 3
violations: []
allowed_paths_gate_source: review_subagent |
|
レビュー結果です。現状は PR #1442 敵対的レビューVerdict: REQUEST_CHANGESこのPRは、コマンド形状の制限、Python policyへの判定集約、policy障害時のfail-closedという点では改善されています。一方で、generic denyを解除するための証跡の真正性・初回publishの状態表現・認可コード自体の信頼境界が確立されていません。 Draftであることを差し引いても、以下3件はmerge blockerです。 [P1 / Blocker]
|
…indings (#1408) - Restrict remote_readback_source to ls_remote only; github_branch_api and fetch_then_show_ref never actually re-read the remote and are now denied as publish_guard_context_invalid. - Explicitly deny remote_branch_absent_not_supported when git ls-remote --exit-code confirms the target branch does not exist on origin yet. New-branch initial publish is out of scope for this bridge (see #1449). - Verify the actual origin push URL resolves to the canonical repository identity (squne121/loop-protocol) before allowing a push; deny origin_remote_identity_mismatch otherwise. - Add a policy-internal destination guard denying push_target_is_default_branch for main/master/trunk (and resolved origin/HEAD / LOOP_DEFAULT_BRANCH), independent of the #360 hook-level destination guard. - Bind the Allowed Paths gate ok status to issue_number / base_sha (expected_remote_head) / head_sha (actual local HEAD); deny allowed_paths_gate_binding_mismatch when they diverge, preventing replay of a stale gate result from a different head or issue. - Update scripts/agent-guards/tests/test_git_mutation_command_policy.py and tests/session_recording/codex/test_hook_adapter.py to exercise the new checks and the ls_remote-only readback path. - Document the scope reduction and new deny reasons in docs/dev/session-recording-policy.md. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Verification Result (test-runner, iteration 2)TEST_VERDICT:
result: FAIL
mergeable: MERGEABLE
merge_state_status: BLOCKED
branch_behind_main: false
verification_commands_pass: 6
verification_commands_fail: 1
human_review_required: false検証環境
実行結果
FAIL の詳細
local 再現コマンド: uv run --locked ruff check --select E,F --ignore E402 .claude/scripts scripts schemas .claude/skills→ 同一の F841 エラーが この Ruff 失敗により 結論
|
test_rtk_git_push_classifies_fast_forward_remote_drift 内で未使用のまま だった current 変数を _current にリネームし、Ruff F841 を解消する。 CI の python-test job が Ruff check で fail していたための最小修正 (scripts/agent-guards/tests/test_git_mutation_command_policy.py:495)。
iteration-2 で `git_mutation_command_policy.py` の `_load_publish_guard_context()` が `remote_readback_source` を `ls_remote` のみに制限し、Allowed Paths gate の issue/base/head binding フィールド (`LOOP_PUBLISH_ALLOWED_PATHS_GATE_ISSUE_NUMBER` / `_BASE_SHA` / `_HEAD_SHA`) を必須化した一方、`test_worktree_scope_guard.py` の publish lane テスト 2 件は旧 `fetch_then_show_ref` を指定し、上記 3 フィールドを渡していな かったため `decision_inputs_complete` が false になり `publish_guard_context_invalid` で誤って deny されていた(CI failing)。 `worktree_scope_guard.sh` / `worktree_scope_guard.py` の scope guard 本体 ロジックは変更していない。テスト側を、実際に `git ls-remote` で読める ローカル bare origin remote を用意し、新しい必須フィールドを渡す形に 更新した。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Verification Result (test-runner, iteration 4, post worktree_scope_guard fix)CI(required checks)は全て 実行結果
TEST_VERDICT:
result: PASS
mergeable: MERGEABLE
merge_state_status: BEHIND
branch_behind_main: true
verification_commands_pass: 5
verification_commands_fail: 0
human_review_required: false |
|
test |
|
line one |
|
line one (parens) colon: here |
|
line one key: valueend |
|
(直前の2件の "test" 系コメントは gh pr comment の疎通確認用の誤投稿です。無視してください。本コメントが正式な review verdict です。) Verdict: APPROVE (iteration 4 re-review)Mergeability
CI (再確認)
AC1〜AC7 独立再検証(fresh isolated worktree, node_modules symlink 補完)
worktree_scope_guard.sh 本体の非変更確認
人間敵対的レビュー P1/P2 指摘の反映確認(diff直接確認)
Allowed Paths gate 独立再計算(拡張後)review_subagent が issue #1408 の現在の contract(Scope Delta 反映後、Allowed Paths 12件)に対し、fresh に取得した issue body / 現在の main tip base / PR head で再計算した。changed files 6件全てが Allowed Paths 内、violations なし。status: ok。 注: 本 gate は今回 review 時点の issue body(Scope Delta 反映後)を snapshot として self-bootstrap 的に fingerprint bind したもの(過去の contract-review コメント body_sha256=sha256:bdcc41a7... は Scope Delta 反映前の issue body に対するもので、現在の issue body とは一致しない=stale)。値そのもの(Allowed Paths 12件・changed files 6件・violations 0件)は現在の contract と整合しており status: ok の実体は確認済み。 PR body hygiene(non-blocker、hygiene 欠陥)PR 本文が iteration4 の Scope Delta / AC7 追加を反映しておらずstale:
内容面では検証済みの実装がAC7を満たしていることを独立確認できているため blocker とはしないが、本文更新を required_auto_action とする。 Blockers
Non-blockers
LOOP_VERDICT_V2verdict: APPROVE
reviewed_head_sha: "9af29811df246591665bad558de1e8e1e02372de"
merge_ready: false
mergeability:
mergeable: "MERGEABLE"
merge_state_status: "BEHIND"
blockers: []
required_auto_actions:
- kind: update_pr_body_hygiene
executor: implementation-worker
skill: open-pr.update_pr
blocking_merge_ready: true
mechanical: true
- kind: update_branch
executor: implementation-worker
skill: implement-issue.update_branch
blocking_merge_ready: true
mechanical: true
expected_head_sha: "9af29811df246591665bad558de1e8e1e02372de"
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
status: ok
changed_files_source: git_diff_name_status_find_renames_z
changed_files:
- .claude/hooks/tests/test_worktree_scope_guard.py
- docs/dev/session-recording-policy.md
- scripts/agent-guards/git_mutation_command_policy.py
- scripts/agent-guards/tests/test_git_mutation_command_policy.py
- scripts/session-recording/codex-hook-adapter.mjs
- tests/session_recording/codex/test_hook_adapter.py
changed_file_records:
- path: .claude/hooks/tests/test_worktree_scope_guard.py
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: docs/dev/session-recording-policy.md
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: scripts/agent-guards/git_mutation_command_policy.py
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: scripts/agent-guards/tests/test_git_mutation_command_policy.py
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: scripts/session-recording/codex-hook-adapter.mjs
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: tests/session_recording/codex/test_hook_adapter.py
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
audited_paths:
- path: .claude/hooks/tests/test_worktree_scope_guard.py
path_role: filename
source_record_index: 0
- path: docs/dev/session-recording-policy.md
path_role: filename
source_record_index: 1
- path: scripts/agent-guards/git_mutation_command_policy.py
path_role: filename
source_record_index: 2
- path: scripts/agent-guards/tests/test_git_mutation_command_policy.py
path_role: filename
source_record_index: 3
- path: scripts/session-recording/codex-hook-adapter.mjs
path_role: filename
source_record_index: 4
- path: tests/session_recording/codex/test_hook_adapter.py
path_role: filename
source_record_index: 5
violations: []
allowed_paths_gate_source: review_subagent注記: local root checkout の hook policy により gh pr review の formal approve/request-changes 投稿がこの実行環境からは不可(gh_mutation_denied)。本コメントは gh pr comment 経由で LOOP_VERDICT_V2 を代替投稿する(self-authored PR のため元々 --comment 相当の扱い)。 |
Merge origin/main (#1428 shell command structure classification) into worktree-issue-1408-publish-lane-approval-bridge. Conflicts resolved: - docs/dev/session-recording-policy.md: kept both the #1408 publish lane approval bridge section and the #1428 command structure classification / #1408 responsibility-split section (additive, non-overlapping content). - scripts/session-recording/codex-hook-adapter.mjs: kept the #1408 getCommand/getCwd helpers (getCwd is used by the publish-lane bounded policy classification). - tests/session_recording/codex/test_hook_adapter.py: kept both the #1408 publish-lane fixture tests and the #1428 command-structure classification fixture tests. Updated #1408 publish-lane test payloads to include "tool_name": "Bash" (required by the stricter event/tool boundary check added by PR #1441 Blocker 5, now merged into this branch). Updated test_pre_tool_use_remote_write_rtk_git_push_blocked (#1428) to reflect that #1408's publish-lane bridge now intercepts `rtk git push` and denies with a structured publish_lane_safety_stop reason (instead of the generic remote_write_requires_approval) when no valid publish-lane context is present.
test_analyzer_does_not_change_git_mutation_command_policy_api が classify_rtk_git_mutation() の旧シグネチャを期待しており CI で fail していた。 iteration2 で意図的に追加した boundary_layer パラメータを期待値に反映する。 analyzer 本体・classify_rtk_git_mutation() のロジックは変更しない。
Verification Result (test-runner, iteration 6, post AC8 contract test fix)CI (required checks) は
TEST_VERDICT:
result: PASS
mergeable: MERGEABLE
merge_state_status: CLEAN
branch_behind_main: false
verification_commands_pass: 5
verification_commands_fail: 0
human_review_required: false |
|
test |
|
line1 |
|
test with (parens) and colon: text and dashes -- here |
Verdict: APPROVE (iteration 6 re-review, post AC8 contract-test fix)Mergeability
CI(独立再確認)ci_verdict_summary.py --expected-head-sha 1682131 で status: all_pass。head_sha一致。failed/pending/staleなし。required checks(build/typecheck/lint/test/python-test/e2e/node-backed-hook-tests/actionlint/validate-generated-artifact/check-hook-integrity/ci-verdict-summary/PR Body Japanese Check)全てSUCCESS。 AC1〜AC8 独立再検証(専用worktree issue-1408-publish-lane-approval-bridge、head完全一致確認済み)
補足: 検証序盤で git fetch origin main により FETCH_HEAD を上書きしてしまい、一瞬 test_shell_command_analysis.py の契約テストが旧3引数期待のままに見えたが、これはレビュー環境側の参照取り違えであり、PR明示SHA(1682131...)と専用worktree実体を使って再確認した結果、契約テストの期待値は正しく4引数(boundary_layer込み)へ更新済みであることを独立確認した。 Stop Conditions境界の非違反確認(diff直接検査)
mainとのconflict resolveマージの正当性確認
人間敵対的レビューP1/P2指摘の反映確認(diff直接検査)
Allowed Paths gate(review_subagent独立再計算)gh pr view --json files で取得した変更ファイル7件全てが、Issue #1408現行contract(Scope Delta 2回反映後、Allowed Paths 13エントリ)のリテラルパスと完全一致。renameなし、violationsなし。status: ok。 PR body hygiene(non-blocker)PR本文がiteration6のAC8追加を反映しておらずstale:
内容面ではAC8実装・テスト証跡を独立確認できているため blocker とはしないが、本文更新を required_auto_action とする。 Blockers
Non-blockers
注記: local root checkoutのhook policyにより gh pr review のformal approve/request-changes投稿がこの実行環境からは不可(gh_mutation_denied)。本コメントは gh pr comment 経由でLOOP_VERDICT_V2を代替投稿する(self-authored PRのため元々 --comment 相当の扱い)。 LOOP_VERDICT_V2verdict: APPROVE
reviewed_head_sha: "168213117b530d0b827a35e9d50b63e0ae6a4189"
merge_ready: false
mergeability:
mergeable: "MERGEABLE"
merge_state_status: "CLEAN"
blockers: []
required_auto_actions:
- kind: update_pr_body_hygiene
executor: implementation-worker
skill: open-pr.update_pr
blocking_merge_ready: true
mechanical: true
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
status: ok
changed_files_source: git_diff_name_status_find_renames_z
changed_files:
- .claude/hooks/tests/test_worktree_scope_guard.py
- docs/dev/session-recording-policy.md
- scripts/agent-guards/git_mutation_command_policy.py
- scripts/agent-guards/tests/test_git_mutation_command_policy.py
- scripts/agent-guards/tests/test_shell_command_analysis.py
- scripts/session-recording/codex-hook-adapter.mjs
- tests/session_recording/codex/test_hook_adapter.py
changed_file_records:
- path: .claude/hooks/tests/test_worktree_scope_guard.py
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: docs/dev/session-recording-policy.md
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: scripts/agent-guards/git_mutation_command_policy.py
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: scripts/agent-guards/tests/test_git_mutation_command_policy.py
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: scripts/agent-guards/tests/test_shell_command_analysis.py
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: scripts/session-recording/codex-hook-adapter.mjs
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: tests/session_recording/codex/test_hook_adapter.py
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
audited_paths:
- path: .claude/hooks/tests/test_worktree_scope_guard.py
path_role: filename
source_record_index: 0
- path: docs/dev/session-recording-policy.md
path_role: filename
source_record_index: 1
- path: scripts/agent-guards/git_mutation_command_policy.py
path_role: filename
source_record_index: 2
- path: scripts/agent-guards/tests/test_git_mutation_command_policy.py
path_role: filename
source_record_index: 3
- path: scripts/agent-guards/tests/test_shell_command_analysis.py
path_role: filename
source_record_index: 4
- path: scripts/session-recording/codex-hook-adapter.mjs
path_role: filename
source_record_index: 5
- path: tests/session_recording/codex/test_hook_adapter.py
path_role: filename
source_record_index: 6
violations: []
producer_role: review_subagent
worker_report_used_as_canonical: false
allowed_paths_gate_source: review_subagent |
Verdict: APPROVE (iteration 7 re-review, post PR body hygiene fix)iteration6 verdict: APPROVE / 再確認した内容
Blockers
Non-blockers
注記: self-authored PRのため gh pr comment で投稿する。 LOOP_VERDICT_V2verdict: APPROVE
reviewed_head_sha: "168213117b530d0b827a35e9d50b63e0ae6a4189"
merge_ready: true
mergeability:
mergeable: "MERGEABLE"
merge_state_status: "CLEAN"
blockers: []
required_auto_actions: []
auto_fix_applied:
- kind: update_pr_body_hygiene
executor: implementation-worker
result: applied
evidence: "PR body hygiene updated to AC1-8 / 7 files (body-only, head_sha unchanged)"
follow_up_issue_requests: []
allowed_paths_gate:
status: ok
changed_files_source: git_diff_name_status_find_renames_z
changed_files:
- .claude/hooks/tests/test_worktree_scope_guard.py
- docs/dev/session-recording-policy.md
- scripts/agent-guards/git_mutation_command_policy.py
- scripts/agent-guards/tests/test_git_mutation_command_policy.py
- scripts/agent-guards/tests/test_shell_command_analysis.py
- scripts/session-recording/codex-hook-adapter.mjs
- tests/session_recording/codex/test_hook_adapter.py
changed_file_records:
- path: .claude/hooks/tests/test_worktree_scope_guard.py
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: docs/dev/session-recording-policy.md
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: scripts/agent-guards/git_mutation_command_policy.py
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: scripts/agent-guards/tests/test_git_mutation_command_policy.py
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: scripts/agent-guards/tests/test_shell_command_analysis.py
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: scripts/session-recording/codex-hook-adapter.mjs
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
- path: tests/session_recording/codex/test_hook_adapter.py
status: modified
previous_path: null
source: git_diff_name_status_find_renames_z
provenance_complete: true
audited_paths:
- path: .claude/hooks/tests/test_worktree_scope_guard.py
path_role: filename
source_record_index: 0
- path: docs/dev/session-recording-policy.md
path_role: filename
source_record_index: 1
- path: scripts/agent-guards/git_mutation_command_policy.py
path_role: filename
source_record_index: 2
- path: scripts/agent-guards/tests/test_git_mutation_command_policy.py
path_role: filename
source_record_index: 3
- path: scripts/agent-guards/tests/test_shell_command_analysis.py
path_role: filename
source_record_index: 4
- path: scripts/session-recording/codex-hook-adapter.mjs
path_role: filename
source_record_index: 5
- path: tests/session_recording/codex/test_hook_adapter.py
path_role: filename
source_record_index: 6
violations: []
producer_role: review_subagent
worker_report_used_as_canonical: false
allowed_paths_gate_source: review_subagent |
) Issue #1454(Phase A, PR #1457 merged)で導入された external trust root 一式は、それを配線する予定だった Issue #1450(Phase B)と Issue #1468 (追加ハードニング)がいずれも個人開発の脅威モデルに対して過剰と判断され not planned でクローズされたため、恒久的に未配線の不使用コードとなった。 - scripts/trust-root/ ディレクトリ全体(trusted_hook_launcher.py / manifest_schema.py / install_trust_root.sh / tests/ 配下 2 ファイル)を削除 - .github/ci/python-test-plan.json から該当テストの targets 登録と trust_root_tests_registration note を削除 - docs/dev/hook-boundaries.md の該当節(## 12)を、Issue #1454/#1450/#1468 の経緯を記録する短い historical note に置き換え 現行の publish lane 保護は Issue #1408(PR #1442 merged)と main branch protection(Issue #360)のみで構成される。 Co-authored-by: Claude Sonnet 5 <[email protected]>
Summary
Issue #1408 の実装。
scripts/session-recording/codex-hook-adapter.mjsのPreToolUse remote write 判定に、
rtk git push origin HEAD:refs/heads/<active-branch>かつ検証済み publish lane 証跡(expected/current/local/verified/declared
head、
LOOP_PUBLISH_ALLOWED_PATHS_GATE_STATUS)が揃っている場合だけ genericremote_write_requires_approvaldeny を経由しない経路を追加した。安全判定ロジックは
scripts/agent-guards/git_mutation_command_policy.pyのclassify_rtk_git_mutationを CLI 経由で再利用し(--command/--cwd/--boundary-layer引数を追加)、hook adapter 側には別実装の安全判定を増やしていない。head 不一致・allowed_paths_gate 失敗は
PUBLISH_SAFETY_STOP_REPORT_V1相当の構造化 reason(
boundary_layer/reason_code/ head 比較値 /required_decisions)で deny する。force/tag/all/delete/mirror push、直接git push、git -C <dir> push、wrapper bypass は引き続き deny される(AC2/AC4)。
docs/dev/session-recording-policy.mdに #360 の destination guard と本 Issue の publish lane approval bridge の責務差分を追記した(AC6)。
Scope Delta 対応(発生理由1)として、
scripts/agent-guards/git_mutation_command_policy.pyの publish lane 判定変更が
.claude/hooks/tests/test_worktree_scope_guard.pyの既存 publish lane 回帰テストと整合するよう、remote readback を
ls_remoteのみに縮小し、origin push URL の canonical repo identity 照合、push target の default branch 判定、Allowed Paths gate の issue/head
binding、新規 branch 初回 publish の明示 deny を追加した(AC7)。
worktree_scope_guard.sh本体(scope guard 判定ロジック)そのものは本 Issue の対象範囲外のため変更していない。
Scope Delta 対応(発生理由2)として、iteration5(main との conflict resolve)後、
classify_rtk_git_mutation()へのboundary_layerパラメータ追加(発生理由1の fix_delta で追加済み)と
scripts/agent-guards/tests/test_shell_command_analysis.pyの API 契約テスト(
test_analyzer_does_not_change_git_mutation_command_policy_api)が衝突して fail することが判明したため、当該契約テストの期待シグネチャを
command/cwd/require_active_branch_push/boundary_layerの4引数(keyword-only、
boundary_layerはデフォルト値worktree_scope_guard_denied)に更新した(AC8)。
test_shell_command_analysis.pyが検証する analyzer 本体のロジックは変更していない。
受け入れ条件の達成状況
AC1〜AC8 はすべて実装済み(yes)。各 AC の個別実装根拠とテスト証跡は下記
## Safety Claim Matrixの表を正本として参照する(本セクションは重複記載を避けるための要約のみ)。
検証コマンド結果
検証コマンドとその実行結果の一覧は下記
## Checksを正本として参照する(本セクションは重複記載を避けるための要約のみ)。全コマンドが PASS している。
Allowed Paths 遵守
本 PR の変更は Allowed Paths 内の 7 ファイルのみに限定されている:
docs/dev/session-recording-policy.md、scripts/agent-guards/git_mutation_command_policy.py、scripts/agent-guards/tests/test_git_mutation_command_policy.py、scripts/agent-guards/tests/test_shell_command_analysis.py(Scope Delta発生理由2で追加)、
scripts/session-recording/codex-hook-adapter.mjs、tests/session_recording/codex/test_hook_adapter.py、.claude/hooks/tests/test_worktree_scope_guard.py(Scope Delta 発生理由1で追加)。
詳細は下記
## Notesを参照。Checks
python3 -m pytest tests/session_recording/codex/test_hook_adapter.py— 95 passed(AC1/AC2/AC3/AC5)python3 -m pytest scripts/agent-guards/tests/test_git_mutation_command_policy.py— 26 passed(AC4・既存回帰なし)rg -n "publish lane approval bridge" docs/dev/session-recording-policy.md docs/dev/agent-runtime-ops.md docs/dev/hook-boundaries.md docs/dev/workflow.md docs/dev/agent-skill-boundaries.md— 一致あり(AC6)python3 -m pytest .claude/hooks/tests/test_worktree_scope_guard.py— 209 passed(AC7・既存publish lane回帰含め全件pass)python3 -m pytest scripts/agent-guards/tests/test_shell_command_analysis.py— 68 passed(AC8・test_analyzer_does_not_change_git_mutation_command_policy_apiの期待シグネチャをboundary_layer込みへ更新済み)pnpm typecheck— PASSpnpm lint— PASSpnpm test— 1575 passedpnpm build— PASSpython3 -m pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py— 21 passedSchema Change Applicability
Schema Consumer Inventory
N/A
reason: not_schema_change のため対象外。
Safety Claim Matrix
rtk git push origin HEAD:refs/heads/<active-branch>は generic deny されない(AC1)test_pre_tool_use_rtk_git_push_allowed_with_validated_publish_lanegit push/git -C <dir> push/ wrapper bypass は引き続き deny(AC2)test_pre_tool_use_guard_blocks_bypass_variants,test_pre_tool_use_remote_write_git_push_dash_c,test_pre_tool_use_raw_git_push_still_denied_generic_reasontest_pre_tool_use_rtk_git_push_denied_without_publish_lane_context,test_pre_tool_use_rtk_git_push_head_mismatch_denied,test_pre_tool_use_rtk_git_push_allowed_paths_gate_not_ok_deniedtest_pre_tool_use_rtk_git_push_force_flag_denied_even_with_lane_evidence(test_git_mutation_command_policy.py26 passed の既存 DENIED_PUSH_FLAGS 回帰と合わせて)node codex-hook-adapter.mjs --event PreToolUseを subprocess 実行docs/dev/session-recording-policy.mdの### publish lane approval bridge(#1408・#360 との責務差分).claude/hooks/tests/test_worktree_scope_guard.pyの既存 publish lane 回帰テストが全て pass(AC7)python3 -m pytest .claude/hooks/tests/test_worktree_scope_guard.py209 passed(remote readback のls_remote限定化・origin push URL の canonical repo identity 照合・push target default branch 判定・Allowed Paths gate の issue/head binding・新規 branch 初回 publish 明示 deny を追加し既存回帰と整合)scripts/agent-guards/tests/test_shell_command_analysis.pyが全て pass(AC8)python3 -m pytest scripts/agent-guards/tests/test_shell_command_analysis.py68 passed(test_analyzer_does_not_change_git_mutation_command_policy_apiはcommand/cwd/require_active_branch_push/boundary_layerの4引数を期待するよう更新し実シグネチャと一致することを確認)Notes
scripts/agent-guards/git_mutation_command_policy.pyにclassify_rtk_git_mutationの CLI wrapper(_main、--json相当の stdout)を追加した。既存の.claude/hooks/worktree_scope_guard.pyからの呼び出しはboundary_layer省略時デフォルト(worktree_scope_guard_denied)で後方互換。.claude/hooks/tests/test_worktree_scope_guard.py、発生理由2でscripts/agent-guards/tests/test_shell_command_analysis.pyを追加)。.claude/hooks/worktree_scope_guard.sh本体(scope guard 判定ロジック)は変更していない。scripts/agent-guards/shell_command_analysis.py(analyzer 本体ロジック)は変更していない。test_shell_command_analysis.pyの変更は契約テストの期待シグネチャ更新のみ。