Repository navigation
実装: Issue metadata mutation を controlled metadata executor 経由にする - #1295
Conversation
…tion Issue #1284: issue_body.update / issue_comment.publish / contract_snapshot.publish を controlled_skill_mutation_exec.py の同一 executor lane に追加し、Contract Snapshot 投稿と Issue body/comment mutation が issue-specific worktree を作らず root/default branch から実行できるようにする。stale-write 防止・marker readback・per-command input schema・namespace 統一・env binding optional-but-matching を実装。 Scope Delta: scripts/agent-guards/tests/test_controlled_skill_mutation_policy.py (Allowed Paths 外)の registry scope-pin test を、Issue #1284 の In Scope な registry 拡張と整合させるため更新した(同じ command id 集合を守る既存テストで、 拡張なしでは Issue の core ask が達成できないため)。
Preview URLPreview removed (PR #1295 closed). |
検証結果レポートIssue #1284: 実装: Issue metadata mutation を worktree ではなく controlled metadata executor 経由にする
総合判定
統計
```yaml |
squne121
left a comment
There was a problem hiding this comment.
Verdict: REQUEST_CHANGES
Mergeability
- mergeable=MERGEABLE, merge_state_status=BEHIND
Evidence Check
- AC coverage: PR本文の
## Checksに AC1-AC15 全件[x]記載あり。AC5/AC9/AC14 等の該当テスト内容を独立閲覧し、stale-write precondition・readback mismatch・duplicate marker が実ロジックで検証されていることを確認(mock はネットワーク境界のみ)。 - CI Verification:
ci_verdict_summary.py --pr 1295 --expected-head-sha f9842141bdedbb84c97215216f32c6ea09cece64→status: failed(exit 10)。branch protection required checks(typecheck/lint/test/build/python-test/validate-generated-artifact)は全て SUCCESS だが、PR Body Japanese Check(workflow: Check Japanese Content)が head 一致で FAILURE。- ログ:
.claude/skills/issue-contract-review/SKILL.mdの prose block 63件中 13件が日本語比率不足(aggregate=0.314 は閾値超えだが per-block 判定で fail)。
- ログ:
- Allowed Paths 遵守(独立再計算,
allowed_paths_review_gate.py):status: fail_closed。changed files 9件中scripts/agent-guards/tests/test_controlled_skill_mutation_policy.pyが Issue #1284 の Allowed Paths 外。PR本文の Scope Delta 節で開示・理由記載済み(既存test_only_known_command_idsの key-set pin と In-Scope registry 拡張が直接衝突するための更新)だが、Allowed Paths 自体の契約側拡張(Issue contract 再レビュー)は未実施であり、gate は merge-blocking として扱う。 .github/ci/python-test-plan.json無変更の妥当性: 検証済み。.claude/hooks/tests//.claude/skills/issue-contract-review/tests//scripts/agent-guards/tests/は既にディレクトリ単位で python-test-plan.json の target に登録されており、新規テストファイルは自動的にカバーされる(AC 要求と整合)。- 実装オラクル:
worktree_scope_guard.py::_classify_ghは action-level(issue+comment/editの sub-action)でのみ mutating 判定しフラグ非依存のため、Notes for Reviewer が要求する--delete-last/--edit-last/--web/--editor/--create-if-none/--yesの raw-path deny は既存の blanket 分類で構造的にカバーされる。executor 側もgh issue comment/gh issue editCLI を一切呼ばずgh api固定 argv のみを使うため、当該フラグの pass-through 経路が存在しない。専用テストケースは無いが、構造的に安全であるため blocker としては扱わない(non-blocker として記録)。
Blockers
ALLOWED_PATHS_GATE_RESULT_V1.status = fail_closed:scripts/agent-guards/tests/test_controlled_skill_mutation_policy.pyが Issue #1284 contract の Allowed Paths 外。修正には Issue contract 側の Allowed Paths 拡張(re-review)または当該変更の Allowed Paths 内ファイルへの再配置が必要。- CI
PR Body Japanese Checkが head f984214 で FAILURE(.claude/skills/issue-contract-review/SKILL.mdの 13 prose block が日本語比率不足)。branch protection required set には含まれないが、実際の diff 内容欠陥であり要修正。
Non-blockers
--delete-last等の gh 危険フラグの専用テストが無いが、構造的(action-level 分類 + executor の argv 固定)に安全。follow-up での明示テスト追加を推奨するのみ。- Draft PR 状態自体は blocker ではない。
LOOP_VERDICT_V2
verdict: REQUEST_CHANGES
reviewed_head_sha: "f9842141bdedbb84c97215216f32c6ea09cece64"
merge_ready: false
mergeability:
mergeable: "MERGEABLE"
merge_state_status: "BEHIND"
blockers:
- "ALLOWED_PATHS_GATE_RESULT_V1=fail_closed: scripts/agent-guards/tests/test_controlled_skill_mutation_policy.py is outside Issue #1284 Allowed Paths (Scope Delta disclosed in PR body but contract not yet extended via re-review)"
- "CI check 'PR Body Japanese Check' FAILURE at head f9842141 (.claude/skills/issue-contract-review/SKILL.md: 13/63 prose blocks below Japanese ratio threshold 0.1)"
required_auto_actions:
- kind: update_branch
executor: implementation-worker
skill: implement-issue.update_branch
blocking_merge_ready: true
mechanical: true
expected_head_sha: "f9842141bdedbb84c97215216f32c6ea09cece64"
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
status: fail_closed
producer_role: review_subagent
worker_report_used_as_canonical: false
pr_number: 1295
changed_files_count: 9
violations:
- file: "scripts/agent-guards/tests/test_controlled_skill_mutation_policy.py"
reason: "not in allowed_paths"
allowed_paths_gate_source: review_subagentissue-contract-review/SKILL.md の見出し・リスト13 block と agent-skill-boundaries.md 追加分の見出し6 block に日本語併記を追加し、 per-block 日本語比率検証を通過させる(意味論は変更しない)。
squne121
left a comment
There was a problem hiding this comment.
LOOP_VERDICT_V2
前回レビュー(iteration 0)の blocker 2件を確認した。
- allowed_paths_gate: Issue #1284 の Allowed Paths に
scripts/agent-guards/tests/test_controlled_skill_mutation_policy.pyが追加された fresh contract snapshot(body_sha256=sha256:975e9d94...、issue comment 4866359529)に対してallowed_paths_review_gate.pyを再計算した。head 60daf44 の変更ファイル9件すべてが Allowed Paths 内でstatus: ok。解消。 - Japanese Check: head 60daf44 で SKILL.md / agent-skill-boundaries.md に日本語見出し併記を追加。両ファイルの diff を確認したところ見出し・箇条書きラベルへの日本語併記のみで、手順・contract の意味論(コマンド、判定分岐、schema 定義、Allowed Paths、AC 対応)は無変更。CI「PR Body Japanese Check」も pass。解消。
CI は ci_verdict_summary.py(expected_head_sha=60daf442 一致)で全 required check green(status: all_pass, failed/pending なし)。
mergeStateStatus は BEHIND(main が先行)だが MEREGABLE であり衝突 blocker ではない。update_branch を required_auto_action とする。
verdict: APPROVE
reviewed_head_sha: "60daf44257322929c1f30d154c8b6d96c2890a1c"
merge_ready: false
mergeability:
mergeable: "MERGEABLE"
merge_state_status: "BEHIND"
blockers: []
required_auto_actions:
- kind: update_branch
executor: implementation-worker
skill: implement-issue.update_branch
blocking_merge_ready: true
mechanical: true
expected_head_sha: "60daf44257322929c1f30d154c8b6d96c2890a1c"
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
status: ok
produced_by: allowed_paths_review_gate.py
producer_role: review_subagent
worker_report_used_as_canonical: false
pr_number: 1295
base_ref: main
base_sha: "5d5df912c687e3df25e1744c490ecea59301062f"
head_sha: "60daf44257322929c1f30d154c8b6d96c2890a1c"
reviewed_head_sha: "60daf44257322929c1f30d154c8b6d96c2890a1c"
changed_files_source: git_diff_base_head
allowed_paths_source: linked_issue_contract_snapshot
changed_files_count: 9
violations: []
contract_fingerprint:
issue_number: 1284
contract_source_kind: issue_comment
contract_source_id: "4866359529"
contract_body_sha256: "sha256:975e9d943f593e4ff96c3d03b5c1651c3c16f57401d6aec790b896d4674942b5"
allowed_paths_normalized_sha256: "69e5bc55c02808ed481b44b9fb1cb943465f042240aac1db84a7c160f6225b73"
base_ref: main
base_sha_at_snapshot: "5d5df912c687e3df25e1744c490ecea59301062f"
reason: "All changed files are within allowed paths"
squne121
left a comment
There was a problem hiding this comment.
Verdict: APPROVE (再確認, update_branch 後)
Mergeability
- mergeable=MERGEABLE, merge_state_status=CLEAN(BEHIND 解消)
update_branch 後の diff 監査
- 前回 APPROVE head 60daf44 → 現 head 27b4a15 は
gh pr update-branchの merge commit(main のb196a072〈#1278〉取り込み)のみ。compare/60daf442...27b4a158の commit は main 側b196a072と merge commit の2件だけで、PR branch 独自の新規実装 commit は無い。 gh pr diff --name-only(GitHub 側の実効 PR diff, 現在の base 基準)は9ファイルで iteration 1 と同一。新規混入なし。
Allowed Paths 遵守(独立再計算)
allowed_paths_review_gate.py --base-sha <snapshot base 5d5df912>は triple-dot diff に main 側の unrelated 3ファイル(.claude/skills/issue-refinement-loop/**, #1278 由来)を含めてしまいfail_closedを返す。これは update_branch で head に main 先行 commit が merge されたことで、snapshot-time base(5d5df912)基準の triple-dot diff が stale になったことによるスクリプト側の既知の限界(fingerprint と diff-base が同一パラメータに結合されており、post-update-branch のケースを想定していない)。- 代わりに GitHub 正本の
gh pr diff --name-only(現在の base 基準、update_branch 後の実効差分)を用いて Allowed Paths 照合をやり直したところ、9ファイル全てが Issue #1284 contract snapshot(issue comment 4866359529, body_sha256=sha256:975e9d94...)の Allowed Paths 12件以内に収まることを確認した。violations なし。 --base-shaに現在の merge-base(b196a072, main tip)を与えると fingerprint 側のbase_sha_at_snapshotが snapshot 記録値(5d5df912)と不一致になりstale_snapshotを返すのも同じ既知限界(診断のみで実 violation ではない)。
CI
ci_verdict_summary.py --pr 1295 --expected-head-sha 27b4a158... → status: all_pass。failed/pending/stale なし。branch protection required checks 全 SUCCESS。
Blockers
なし。
LOOP_VERDICT_V2
verdict: APPROVE
reviewed_head_sha: "27b4a1586d5d43b7625aef223e053ed018a70ce6"
merge_ready: true
mergeability:
mergeable: "MERGEABLE"
merge_state_status: "CLEAN"
blockers: []
required_auto_actions: []
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
status: ok
produced_by: allowed_paths_review_gate.py + gh_pr_diff_cross_check
producer_role: review_subagent
worker_report_used_as_canonical: false
pr_number: 1295
base_ref: main
base_sha: "5d5df912c687e3df25e1744c490ecea59301062f"
head_sha: "27b4a1586d5d43b7625aef223e053ed018a70ce6"
reviewed_head_sha: "27b4a1586d5d43b7625aef223e053ed018a70ce6"
changed_files_source: gh_pr_diff_name_only_post_update_branch
allowed_paths_source: linked_issue_contract_snapshot
changed_files_count: 9
violations: []
contract_fingerprint:
issue_number: 1284
contract_source_kind: issue_comment
contract_source_id: "4866359529"
contract_body_sha256: "sha256:975e9d943f593e4ff96c3d03b5c1651c3c16f57401d6aec790b896d4674942b5"
allowed_paths_normalized_sha256: "69e5bc55c02808ed481b44b9fb1cb943465f042240aac1db84a7c160f6225b73"
base_ref: main
base_sha_at_snapshot: "5d5df912c687e3df25e1744c490ecea59301062f"
reason: "All 9 GitHub PR-diff files are within allowed paths; local triple-dot diff against stale snapshot base_sha included 3 unrelated main-origin files (#1278) due to update_branch merge, verified as not a scope violation via gh pr diff cross-check"
判定REQUEST_CHANGES。 Blocker 1:
|
…se successを解消 PR #1295 の人間レビュー REQUEST_CHANGES(Blocker 1-6)を反映。 - issue_body.update / issue_comment.publish: local marker を authority から cache/audit に格下げし、marker hit 時も必ず remote readback で判定する (stale_marker_remote_mismatch)。 - issue_comment.publish: POST 前に remote marker precheck を追加し、 duplicate/conflict を mutation 前に fail closed にする (remote_matches 0/1一致/1不一致/2+ の4分岐)。 - contract_snapshot.publish: CONTRACT_SNAPSHOT_PUBLISH_INPUT_V1 に target_issue_body_sha256 / expected_latest_contract_review_status / expected_contract_marker / operation_reason を必須化し、legacy publisher と同等の env sanitizer・module realpath 検証(ensure_contract_snapshot.py / run_contract_review_once.py / contract_review_result_parser.py)を追加。 - 新3 command の postcondition write root を artifacts/{issue}/issue-metadata/{command-id}/ に縮小(legacy termination_report.publish は artifacts/{issue}/ を維持)。 - gh api エラーを ensure_contract_snapshot.py と同粒度で HTTP status 分類。 - レビューが要求した最小テスト(marker/remote mismatch・pre-mutation precheck・env sanitizer・realpath deny・required field 欠落)を追加。 Issue #1284, PR #1295 iteration 2.
…ta-mutation-worktree-control' into worktree-issue-1284-issue-metadata-mutation-worktree-control
TEST_VERDICT:
result: PASS
mergeable: MERGEABLE
merge_state_status: BEHIND
branch_behind_main: true
baseline_only: false
verification_commands_pass: 49
verification_commands_fail: 0
verification_skipped_count: 0
runtime_ac_results:
- ac: AC1
command: "uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: not_required
human_review_required: false
stop_condition_triggered: false
notes: "36 passed (coverage AC1-4, AC6, AC8-11, AC13-15)"
- ac: AC5
command: "uv run --locked pytest .claude/hooks/tests/test_worktree_scope_guard_issue_metadata_executor.py -q"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: not_required
human_review_required: false
stop_condition_triggered: false
notes: "5 passed"
- ac: AC7
command: "uv run --locked pytest .claude/skills/issue-contract-review/tests/test_contract_review_no_worktree_creation.py -q"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: not_required
human_review_required: false
stop_condition_triggered: false
notes: "8 passed (coverage AC7, AC12)"SummaryAll 15 acceptance criteria verified PASS via 3 pytest test suites (49 tests total). Standard Checks
PR Status
|
squne121
left a comment
There was a problem hiding this comment.
Verdict: APPROVE(人間 Blocker 6件 再検証、iteration 2)
Mergeability
mergeable=MERGEABLE, merge_state_status=BEHIND(衝突なし、update_branch を required_auto_action とする)
Blocker 別コード検証(head 7cbb462, worker 自己申告でなく実コード・実テスト実行で確認)
issue_body.updatemarker hit → remote readback 必須:scripts/agent-guards/controlled_skill_mutation_exec.py:999-1032(_run_issue_body_update)。marker 存在時も必ず_fetch_issue_body_and_updated_at()で remote readback し、current_body_sha256 != new_body_sha256ならstale_marker_remote_mismatchで_fail(success にならない)。marker はもはや authority でなく consistency check(issue_number/repo)のみに限定。テストtest_local_marker_remote_hash_mismatch_denied(L323-347)を分離 worktree で実行し pass 確認(mock_patch.assert_not_called()相当は無いが_patch_issue_bodymock で mutation 未実行を検証)。解消。issue_comment.publishmarker hit → remote readback 必須: L1124-1149。local marker の有無に関わらず_find_marker_matches()で remote 状態を先に取得し、1件一致時のみalready_publishedで success、_write_markerは refresh のみ。0件/複数件/body不一致は local marker と無関係に判定される。テストtest_remote_marker_exists_local_marker_missing_post_not_called(L466-495)でmock_post.assert_not_called()かつrc==0を確認、実行 pass。解消。- POST 前の remote marker precheck 4分岐: L1128-1156。
_find_marker_matches()を_post_gh_comment()より前に必ず呼び、>1件→duplicate_marker_conflict_pre_mutation/1件+body不一致→remote_marker_identity_conflict_pre_mutation/1件+body一致→already_published no-op/0件→POSTの4分岐を実装。「mutation 前 deny」の要求どおり_post_gh_comment呼出前に fail する。テストtest_ac14_pre_mutation_duplicate_denied_before_post(L440-464,mock_post.assert_not_called())とtest_remote_marker_body_sha256_mismatch_conflict_before_mutation(L497-519, 同様にassert_not_called)を分離 worktree で実行し pass 確認。「副作用後に fail」の形には戻っていない。解消。 contract_snapshot.publishinput schema 必須束縛:_validate_contract_snapshot_publish_fields()(L449-468)がrepo一致に加えtarget_issue_body_sha256/expected_latest_contract_review_status/expected_contract_marker/operation_reasonの4フィールドを非空文字列として必須化。人間指摘の最小 input(schema+issue_number のみ)はtest_contract_snapshot_publish_missing_required_field_rc2(L687-703)で rc=2 拒否を確認、実行 pass。解消。- env sanitizer + realpath/import origin 検証:
_build_metadata_sanitized_env()(L183-195)がENV_SANITIZE_KEYS(editor/browser系)+PYTHONPATH/PYTHONHOME除去 +GH_PROMPT_DISABLED/GH_NO_UPDATE_NOTIFIERを設定し、_run_contract_snapshot_publish()(L1291-1296)でsubprocess.run(cmd, ..., shell=False, env=sanitized_env)として実際に渡している(env=未指定だった人間指摘は解消)。_check_contract_snapshot_module_realpaths()(L201-222)がensure_contract_snapshot.py/run_contract_review_once.py/contract_review_result_parser.pyの3モジュールを realpath/shadowing 検証し、_run_contract_snapshot_publish()の schema 検証直後(mutation 前)に呼ばれる。テストtest_metadata_sanitized_env_removes_pythonpath_pythonhome/removes_editor_browser/disables_prompts、test_contract_snapshot_publish_realpath_mismatch_deniedを実行し全 pass。解消。 - write root の command-id scoping:
_check_no_tracked_changes()(L707-747)がallowed_prefix引数を追加、新3コマンドはartifacts/{issue}/issue-metadata/{command_id}/を明示的に渡す(_run_issue_body_updateL990/1069、_run_issue_comment_publishL1103/1167、_run_contract_snapshot_publishL1279/1320)。allowed_prefix=Noneの legacytermination_report.publishは既定値artifacts/{issue}/を維持(L730-731)。解消。
- docstring 更新(non-blocker): モジュール冒頭 docstring が
termination_report.publish (legacy, Issue #1166)とissue_body.update / issue_comment.publish / contract_snapshot.publish (Issue #1284 issue metadata mutation)を併記する形に更新済み(L8-26 付近)。解消。
テスト実在検証(fresh clone + fresh worktree、self-report ではなく独立実行)
/tmp/pr1295check/repo(head 7cbb462 を fetch/checkout)で uv run pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q → 36 passed(vacuous/skip なし)。人間要求の最小テスト(stale marker mismatch / duplicate marker pre-mutation / remote-exists-local-missing no-op / contract_snapshot 必須フィールド欠落 rc=2 / env sanitize / realpath deny)はすべて実在し、mutation 前 assert(mock_post.assert_not_called() / mock_patch.assert_not_called())で「副作用後 fail」ではなく「mutation 前 deny」を検証している。
CI
ci_verdict_summary.py --pr 1295 --expected-head-sha 7cbb4628... → status: all_pass。failed/pending/stale なし。
Allowed Paths(独立再計算)
allowed_paths_review_gate.py(snapshot base 5d5df912固定・triple-dot diff)は fail_closed(5 violations)を返すが、これは前回 iteration と同一の既知限界(BEHIND による update_branch 未実施時点の snapshot-base diff に main 側の unrelated commit が混入するため)。gh pr diff --name-only(GitHub 正本の実効 PR diff)で cross-check したところ 9 ファイル全てが Issue #1284 contract snapshot(issue comment 4866359529, body_sha256=sha256:975e9d94...、allowed_paths_normalized_sha256=69e5bc55... 一致)の Allowed Paths 12件以内。violations なし。status: ok(gh_pr_diff cross-check 経由)。
Blockers
なし。
LOOP_VERDICT_V2
verdict: APPROVE
reviewed_head_sha: "7cbb462892651af6f85cd5e57bdedd52ce81025d"
merge_ready: false
mergeability:
mergeable: "MERGEABLE"
merge_state_status: "BEHIND"
blockers: []
required_auto_actions:
- kind: update_branch
executor: implementation-worker
skill: implement-issue.update_branch
blocking_merge_ready: true
mechanical: true
expected_head_sha: "7cbb462892651af6f85cd5e57bdedd52ce81025d"
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
status: ok
produced_by: allowed_paths_review_gate.py + gh_pr_diff_name_only_cross_check
producer_role: review_subagent
worker_report_used_as_canonical: false
pr_number: 1295
base_ref: main
base_sha: "5d5df912c687e3df25e1744c490ecea59301062f"
head_sha: "7cbb462892651af6f85cd5e57bdedd52ce81025d"
reviewed_head_sha: "7cbb462892651af6f85cd5e57bdedd52ce81025d"
changed_files_source: gh_pr_diff_name_only
allowed_paths_source: linked_issue_contract_snapshot
changed_files_count: 9
violations: []
contract_fingerprint:
issue_number: 1284
contract_source_kind: issue_comment
contract_source_id: "4866359529"
contract_body_sha256: "sha256:975e9d943f593e4ff96c3d03b5c1651c3c16f57401d6aec790b896d4674942b5"
allowed_paths_normalized_sha256: "69e5bc55c02808ed481b44b9fb1cb943465f042240aac1db84a7c160f6225b73"
base_ref: main
base_sha_at_snapshot: "5d5df912c687e3df25e1744c490ecea59301062f"
reason: "gh pr diff --name-only (9 files) all within allowed paths; local snapshot-base triple-dot diff stale due to BEHIND state, same known limitation as prior iteration"
allowed_paths_gate_source: review_subagent
squne121
left a comment
There was a problem hiding this comment.
LOOP_VERDICT_V2
verdict: APPROVE(update_branch 後の確定レビュー、iteration 2 完了)
LOOP_VERDICT_V2:
verdict: APPROVE
reviewed_head_sha: "26b5cda57391a273d675884486b14758516eb015"
merge_ready: true
mergeability:
mergeable: "MERGEABLE"
merge_state_status: "CLEAN"
blockers: []
required_auto_actions: []
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
schema: ALLOWED_PATHS_GATE_RESULT_V1
producer_role: review_subagent
worker_report_used_as_canonical: false
status: ok
changed_files_source: gh_pr_diff_name_only_cross_check
notes: "全9ファイルがcontract Allowed Pathsに完全一致。update_branch由来の混入なし。"確認結果
- 差分確認: head 26b5cda は 7cbb462 に main の merge commit(#1293由来の1コミット d4894b4 + merge commit 26b5cda5自体)を取り込んだのみ。
gh pr diff --name-onlyで得た PR 自体の changed files は 9 ファイルで、7cbb4628 時点の実装変更と同一。新規実装変更なし。 - Allowed Paths gate:
gh pr diff --name-onlyの 9 ファイル全てが Issue #1284 contract の Allowed Paths と完全一致。逸脱なし(status: ok)。 - CI:
ci_verdict_summary.py --expected-head-sha 26b5cda5...でstatus: all_pass, exit 0。全 required check(ci/typecheck, lint, test, build, e2e, python-test, node-backed-hook-tests, actionlint, check-hook-integrity, PR Body Japanese Check, validate-generated-artifact, deploy-pr)SUCCESS。head_sha 一致(stale なし)。 - Mergeability:
mergeable: MERGEABLE,mergeStateStatus: CLEAN(BEHIND 解消)。よってrequired_auto_actions: [],merge_ready: true。
iteration 2 の APPROVE(review 4621394565)で確認済みの人間 Blocker 6件解消・AC15項目・Safety Claim Matrix・Schema Consumer Inventory は再変更なしのため再確定。blocker なし。
Summary
Issue #1284 の実装: Issue metadata mutation(Contract Snapshot 投稿・Issue body 更新・Issue comment 投稿)を issue-specific worktree ではなく
scripts/agent-guards/controlled_skill_mutation_exec.pyの controlled executor lane から root/default branch で実行できるようにする。controlled_skill_mutation_policy.py(Issue #1166)のCONTROLLED_SKILL_MUTATION_COMMAND_POLICYに 3 command id(issue_body.update/issue_comment.publish/contract_snapshot.publish)を追加し、controlled_skill_mutation_exec.pyに対応する実行経路(stale-write 防止 / marker readback / per-command input schema / namespace 統一artifacts/{issue_number}/issue-metadata/{command-id}// env binding optional-but-matching)を実装した。contract_snapshot.publishの publisher authority は.claude/skills/impl-review-loop/scripts/ensure_contract_snapshot.pyに固定し、shell=Falseargv-list で呼び出す。worktree_scope_guard.pyの既存 exact-command-class allow(is_controlled_skill_mutation_exec_command)は executor script identity + argv 形状のみを検証するため、新 3 command id は追加の allowlist entry なしで同じ allow 経路に乗る(rawgh issue edit/gh issue commentは引き続き block)。issue-contract-review/SKILL.mdを controlled executor lane 明記に更新した。Checks
test_ac1_contract_snapshot_publish_from_root: 合格test_ac2_input_file_outside_artifacts_subtree_fails_closed: 合格test_ac3_binding_violations_rejected_before_mutation: 合格test_ac4_readback_mismatch_not_success: 合格test_ac5_raw_gh_issue_mutation_still_blocked/test_ac5_new_command_ids_allowed_via_executor_no_matching_worktree: PASS(実 PreToolUse hook 経路)test_ac6_tracked_diff_fails_executor: 合格test_skill_md_mentions_controlled_executor_lane/test_no_worktree_add_command_in_skill_md: 合格test_ac8_contract_snapshot_publisher_authority_fixed/test_ac8_publisher_invoked_argv_list_shell_false/test_no_direct_post_flag_invocation_in_scripts: 合格test_ac9_issue_body_update_stale_write_prevented/test_ac9_partial_match_not_success: 合格test_ac10_per_command_input_schema_enforced: 合格test_ac11_input_namespace_unified_to_artifacts: 合格test_no_raw_gh_issue_edit_in_scripts/test_no_raw_gh_issue_comment_in_scripts/test_skill_md_does_not_cite_local_main_branch_guard_as_authorization: 合格test_ac13_argv_only_shell_false_enforced: 合格test_ac14_duplicate_marker_not_success他: 検証合格test_ac15_env_binding_optional_but_must_match他: 検証合格scripts/agent-guards/tests/(397件)/.claude/hooks/tests//.claude/skills/issue-contract-review//.claude/skills/impl-review-loop/tests/(合計 2097 passed, 1 skipped, 2 xfailed)pnpm typecheck/pnpm lint/pnpm test(1303 tests)/pnpm build: 合格uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py: 21 passedSchema Change Applicability
docs/schemas/配下の変更なし。CONTROLLED_SKILL_MUTATION_COMMAND_POLICY(Python dict、内部契約)への command id 追加のみ。Schema Consumer Inventory
N/A(schema 変更なし。
CONTROLLED_SKILL_MUTATION_COMMAND_POLICYの既存 consumer(worktree_scope_guard.py/local_main_branch_guard.py)は command-id 値に依存しない共有関数を使うため無変更で動作する)Safety Claim Matrix
本 PR は
.claude/hooks/および.claude/skills/配下を変更するため safety-sensitive パスパターンに該当する。以下の表に、各安全性主張・実装状況・未制御事項・裏付けとなるテスト証跡・追加対応の要否を日本語で説明し、fail-closed 境界が退行していないことを示す。gh issue edit/gh issue commentは active issue + no-matching-worktree 状態で引き続き block される.claude/hooks/tests/test_worktree_scope_guard_issue_metadata_executor.py(実 PreToolUse hook 経路、5 tests 合格)issue_body.updateは stale-write 防止(previous_body_sha256/previous_updated_at 不一致で mutation しない、片側一致も success にしない)scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py::TestIssueBodyUpdate(3 tests 合格)contract_snapshot.publishの publisher authority はensure_contract_snapshot.pyに固定され、executor はshell=Falseargv-list でのみ呼び出す。issue-contract-review production path に direct--postは存在しないtest_ac8_contract_snapshot_publisher_authority_fixed/test_ac8_publisher_invoked_argv_list_shell_false/test_no_direct_post_flag_invocation_in_scriptstest_ac4_readback_mismatch_not_success/test_ac14_duplicate_marker_not_successNotes
変更ファイル(Allowed Paths)
scripts/agent-guards/controlled_skill_mutation_policy.py: 3 command id 追加(issue_body.update/issue_comment.publish/contract_snapshot.publish)、namespace/schema/env-binding 定義追加scripts/agent-guards/controlled_skill_mutation_exec.py: command_id dispatch を追加(legacytermination_report.publishは無変更のロジックを関数分離しただけ)、新 3 command id 用ハンドラ・readback/mutation ヘルパー追加scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py: 新規、23 tests(AC1-AC15 カバー).claude/hooks/worktree_scope_guard.py: ドキュメントコメント追加のみ(機能変更なし、既存の共有 policy 関数が新 command id を自動的にカバーするため).claude/hooks/tests/test_worktree_scope_guard_issue_metadata_executor.py: 新規、5 tests(AC5、実 PreToolUse hook 経路).claude/skills/issue-contract-review/SKILL.md: Contract Snapshot 投稿手順を controlled executor lane に明記、Guardrails に metadata mutation lane を追記.claude/skills/issue-contract-review/tests/test_contract_review_no_worktree_creation.py: 新規、8 tests(AC7/AC12).claude/skills/impl-review-loop/scripts/ensure_contract_snapshot.py: 無変更(既にgh apiargv-list で mutation しており publisher authority の要件を満たしていたため)docs/dev/agent-skill-boundaries.md: Issue metadata mutation executor lane セクションを追加.github/ci/python-test-plan.json: 無変更(既存のscripts/agent-guards/tests//.claude/hooks/tests//.claude/skills/issue-contract-review/tests/ディレクトリ target が新規テストを自動カバー)Allowed Paths 外の変更(Scope Delta)
scripts/agent-guards/tests/test_controlled_skill_mutation_policy.py(Allowed Paths 外):TestRegistryScope::test_only_known_command_idsが registry の key set を厳密固定するテストであり、Issue 実装: Issue metadata mutation を worktree ではなく controlled metadata executor 経由にする #1284 の In Scope な registry 拡張(同ファイル内の同一 registry への command id 追加)と直接衝突したため、known_ids に新 3 command id を追加した。これは Issue 自身が明示的に要求する拡張の直接帰結であり、Allowed Paths を再確認いただきたい。既知の制約
issue_body.update/issue_comment.publishの GitHub mutation 経路(gh api --method PATCH/POST)は unit test で mock 化して検証しており、実 GitHub API に対する integration test は行っていない(既存termination_report.publishの readback パターンを踏襲)。Closes #1284(Issue #1284 をクローズします)
🤖 Claude Code で自動生成されました / Generated with Claude Code