Skip to content

fix: raw issue metadata mutation を controlled executor に一本化 - #1298

Merged
squne121 merged 5 commits into
mainfrom
worktree-issue-1291-local-main-guard-gh-mutation
Jul 3, 2026
Merged

squne121 merged 5 commits into
mainfrom
worktree-issue-1291-local-main-guard-gh-mutation

Conversation

@squne121

@squne121 squne121 commented Jul 2, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • local_main_branch_guard.py から raw gh issue edit / raw gh issue comment の許可経路を外し、Issue metadata mutation を controlled executor lane に一本化しました。
  • .claude/hooks/tests/test_local_main_branch_guard.py と tests/codex/test_local_main_branch_guard.py の parity を更新し、raw Issue mutation の must-block、controlled executor metadata command の must-allow、repair hint の非推奨経路排除を固定しました。
  • 実変更は Allowed Paths 内の 3 ファイルに限定し、Issue contract で許可されている guard 実装とテストの範囲だけを更新しました。

Checks

  • Issue 実装: local_main_branch_guard の raw gh issue edit/comment allowlist を controlled executor lane へ移行して deprecate する #1291 の Verification Commands を contract 記載順のまま実行し、すべて成功しました。
  • rg -n "issue_edit_deprecated" .claude/hooks/tests/test_local_main_branch_guard.py
  • rg -n "issue_create_still_allowed" .claude/hooks/tests/test_local_main_branch_guard.py
  • rg -n "issue_comment_deprecated" .claude/hooks/tests/test_local_main_branch_guard.py
  • rg -n "remote_ops_still_allowed" .claude/hooks/tests/test_local_main_branch_guard.py
  • rg -n "must_block_raw_issue_" .claude/hooks/tests/test_local_main_branch_guard.py
  • rg -n "must_allow_controlled_executor_metadata_commands" .claude/hooks/tests/test_local_main_branch_guard.py
  • uv run --locked pytest .claude/hooks/tests/test_local_main_branch_guard.py
  • rg -n "issue_metadata_mutation_parity" tests/codex/test_local_main_branch_guard.py
  • rg -n "repair_hint_does_not_suggest_raw_issue_mutation" .claude/hooks/tests/test_local_main_branch_guard.py
  • rg -n "post_merge_cleanup_does_not_use_raw_issue_body_or_comment_mutation" .claude/hooks/tests/test_local_main_branch_guard.py
  • uv run --locked pytest .claude/hooks/tests/test_local_main_branch_guard.py tests/codex/test_local_main_branch_guard.py

Schema Change Applicability

  • decision: not_schema_change
  • reason: 変更対象は Python の guard 実装とテストのみで、machine-readable schema や contract schema の producer/consumer 境界は変更していません。

Schema Consumer Inventory

変更対象 schema: N/A

before/after 差分:

# before
# N/A

# after
# N/A

Consumer 列挙(rg コマンド例と結果):

rg -l "issue_body.update|issue_comment.publish|contract_snapshot.publish|issue_edit_deprecated|issue_metadata_mutation_parity" .
.claude/hooks/tests/test_local_main_branch_guard.py
scripts/agent-guards/local_main_branch_guard.py
tests/codex/test_local_main_branch_guard.py

Consumer 更新状況:

Consumer ファイル 更新有無 備考
.claude/hooks/tests/test_local_main_branch_guard.py 更新済み raw Issue mutation の must-block / must-allow matrix と repair hint 検証を更新
scripts/agent-guards/local_main_branch_guard.py 更新済み raw gh issue edit / raw gh issue comment allowlist を縮退し controlled executor lane に一本化
tests/codex/test_local_main_branch_guard.py 更新済み Claude 側と同じ metadata mutation parity matrix を追加

Compatibility Decision / 互換性判断

  • change_type: N/A
  • compatibility: N/A
  • migration_required: N/A
  • migration_or_followup: N/A
  • reason: not_schema_change のため schema migration や consumer 互換性判断は不要です。

Safety Claim Matrix

Claim Implemented? Not controlled Evidence Follow-up
local main から raw gh issue edit / raw gh issue comment を許可しない yes none uv run --locked pytest .claude/hooks/tests/test_local_main_branch_guard.py tests/codex/test_local_main_branch_guard.py なし
controlled executor の issue_body.update / issue_comment.publish / contract_snapshot.publish は引き続き allow される yes none must-allow parity test と real hook subprocess harness なし
block 時の repair hint が raw Issue mutation や tmp/<body>.md を approved path として再案内しない yes none rg -n "repair_hint_does_not_suggest_raw_issue_mutation" .claude/hooks/tests/test_local_main_branch_guard.py なし

Notes

@github-actions

github-actions Bot commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Preview URL

✅ verified live assets: https://squne121.github.io/loop-protocol/pr-1298/

The preview will be removed when this PR is closed.

@squne121

squne121 commented Jul 2, 2026

Copy link
Copy Markdown
Owner Author
TEST_VERDICT:
  result: FAIL
  mergeable: MERGEABLE
  merge_state_status: BEHIND
  branch_behind_main: true
  baseline_only: false
  verification_commands_pass: 2
  verification_commands_fail: 9
  verification_skipped_count: 0
  runtime_ac_results:
    - ac: AC1
      command: 'rg -n "issue_edit_deprecated" .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 1
      status: fail
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '一致なし'
    - ac: AC2
      command: 'rg -n "issue_create_still_allowed" .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 1
      status: fail
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '一致なし'
    - ac: AC3
      command: 'rg -n "issue_comment_deprecated" .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 1
      status: fail
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '一致なし'
    - ac: AC4
      command: 'rg -n "remote_ops_still_allowed" .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 1
      status: fail
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '一致なし'
    - ac: AC5
      command: 'rg -n "must_block_raw_issue_" .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 1
      status: fail
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '一致なし'
    - ac: AC6
      command: 'rg -n "must_allow_controlled_executor_metadata_commands" .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 1
      status: fail
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '一致なし'
    - ac: AC7
      command: 'uv run --locked pytest .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '268 passed'
    - ac: AC8
      command: 'rg -n "issue_metadata_mutation_parity" tests/codex/test_local_main_branch_guard.py'
      exit_code: 1
      status: fail
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '一致なし'
    - ac: AC9
      command: 'rg -n "repair_hint_does_not_suggest_raw_issue_mutation" .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 1
      status: fail
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '一致なし'
    - ac: AC10
      command: 'rg -n "post_merge_cleanup_does_not_use_raw_issue_body_or_comment_mutation" .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 1
      status: fail
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '一致なし'
    - ac: AC11
      command: 'uv run --locked pytest .claude/hooks/tests/test_local_main_branch_guard.py tests/codex/test_local_main_branch_guard.py'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '.github/ci/python-test-plan.json は .claude/hooks/tests/ を target に含み、tests/codex/test_local_main_branch_guard.py は secondary coverage で対象化されている'

@squne121

squne121 commented Jul 2, 2026

Copy link
Copy Markdown
Owner Author
TEST_VERDICT:
  result: PASS
  mergeable: MERGEABLE
  merge_state_status: BEHIND
  branch_behind_main: true
  baseline_only: false
  verification_commands_pass: 11
  verification_commands_fail: 0
  verification_skipped_count: 0
  runtime_ac_results:
    - ac: VC1
      command: 'rg -n "issue_edit_deprecated" .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'matched at line 1582'
    - ac: VC2
      command: 'rg -n "issue_create_still_allowed" .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'matched at line 1593'
    - ac: VC3
      command: 'rg -n "issue_comment_deprecated" .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'matched at line 1893'
    - ac: VC4
      command: 'rg -n "remote_ops_still_allowed" .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'matched at line 1907'
    - ac: VC5
      command: 'rg -n "must_block_raw_issue_" .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'matched at line 1913'
    - ac: VC6
      command: 'rg -n "must_allow_controlled_executor_metadata_commands" .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'matched at line 1924'
    - ac: VC7
      command: 'uv run --locked pytest .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '294 passed in 7.58s'
    - ac: VC8
      command: 'rg -n "issue_metadata_mutation_parity" tests/codex/test_local_main_branch_guard.py'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'matched at line 958'
    - ac: VC9
      command: 'rg -n "repair_hint_does_not_suggest_raw_issue_mutation" .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'matched at line 1946'
    - ac: VC10
      command: 'rg -n "post_merge_cleanup_does_not_use_raw_issue_body_or_comment_mutation" .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'matched at line 1962'
    - ac: VC11
      command: 'uv run --locked pytest .claude/hooks/tests/test_local_main_branch_guard.py tests/codex/test_local_main_branch_guard.py'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '524 passed in 12.96s'

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Mergeability

  • mergeable=MERGEABLE, merge_state_status=BEHIND

Evidence Check

  • AC coverage: 差分は #1291 の raw issue edit/comment 廃止、Claude/Codex parity、repair hint 修正、post-merge-cleanup 静的監査を満たしています。
  • Allowed Paths: 変更ファイル 3 件は contract snapshot の Allowed Paths 内です。
  • CI Verification: ci_verdict_summary.py が head 8275ae8 で all_pass を返しました。
  • 検証コマンド結果: 最新 TEST_VERDICT_MACHINE は 11/11 VC pass です。

Blockers

  • なし

Non-blockers

  • PR は current head でレビュー可能ですが、merge_ready になる前に branch update と PR body section 補完が必要です。
  • Spark risk flags では parity、repair hint の非推奨経路排除、post-merge-cleanup 静的監査を確認しました。

LOOP_VERDICT_V2

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Mergeability

  • mergeable=MERGEABLE, merge_state_status=BEHIND

Evidence Check

  • AC coverage: 差分は #1291 の raw issue edit/comment 廃止、Claude/Codex parity、repair hint 修正、post-merge-cleanup 静的監査を満たしています。
  • Allowed Paths: 変更ファイル 3 件は contract snapshot の Allowed Paths 内です。
  • CI Verification: ci_verdict_summary.py が head 8275ae8 で all_pass を返しました。
  • 検証コマンド結果: 最新 TEST_VERDICT_MACHINE は 11/11 VC pass です。

Blockers

  • なし

Non-blockers

  • PR は current head でレビュー可能ですが、merge_ready になる前に branch update と PR body section 補完が必要です。
  • Spark risk flags では parity、repair hint の非推奨経路排除、post-merge-cleanup 静的監査を確認しました。

LOOP_VERDICT_V2

verdict: APPROVE
reviewed_head_sha: "8275ae86c4b3e3a74297a6ab3c5fce7fcbef9857"
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: "8275ae86c4b3e3a74297a6ab3c5fce7fcbef9857"
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
  status: ok
allowed_paths_gate_source: review_subagent

@squne121

squne121 commented Jul 2, 2026

Copy link
Copy Markdown
Owner Author
TEST_VERDICT:
  result: FAIL
  mergeable: MERGEABLE
  merge_state_status: BLOCKED
  branch_behind_main: false
  baseline_only: false
  verification_commands_pass: 11
  verification_commands_fail: 0
  verification_skipped_count: 0
  runtime_ac_results:
    - ac: AC1
      command: rg -n "issue_edit_deprecated" .claude/hooks/tests/test_local_main_branch_guard.py
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: matched at line 1582
    - ac: AC2
      command: rg -n "issue_create_still_allowed" .claude/hooks/tests/test_local_main_branch_guard.py
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: matched at line 1593
    - ac: AC3
      command: rg -n "issue_comment_deprecated" .claude/hooks/tests/test_local_main_branch_guard.py
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: matched at line 1893
    - ac: AC4
      command: rg -n "remote_ops_still_allowed" .claude/hooks/tests/test_local_main_branch_guard.py
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: matched at line 1907
    - ac: AC5
      command: rg -n "must_block_raw_issue_" .claude/hooks/tests/test_local_main_branch_guard.py
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: matched at line 1913
    - ac: AC6
      command: rg -n "must_allow_controlled_executor_metadata_commands" .claude/hooks/tests/test_local_main_branch_guard.py
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: matched at line 1924
    - ac: AC7
      command: uv run --locked pytest .claude/hooks/tests/test_local_main_branch_guard.py
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 294 passed in 7.98s
    - ac: AC8
      command: rg -n "issue_metadata_mutation_parity" tests/codex/test_local_main_branch_guard.py
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: matched at line 958
    - ac: AC9
      command: rg -n "repair_hint_does_not_suggest_raw_issue_mutation" .claude/hooks/tests/test_local_main_branch_guard.py
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: matched at line 1946
    - ac: AC10
      command: rg -n "post_merge_cleanup_does_not_use_raw_issue_body_or_comment_mutation" .claude/hooks/tests/test_local_main_branch_guard.py
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: matched at line 1962
    - ac: AC11
      command: uv run --locked pytest .claude/hooks/tests/test_local_main_branch_guard.py tests/codex/test_local_main_branch_guard.py
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 524 passed in 13.87s

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Mergeability

  • mergeable=MERGEABLE, merge_state_status=CLEAN
  • Draft 状態そのものは blocker ではありません。merge_ready が false なのは PR 本文に ## 受け入れ条件の達成状況 / ## 検証コマンド結果 / ## Allowed Paths 遵守 / ## Runtime Verification Evidence の review gate 必須セクションが未整備なためです。

Evidence Check

  • AC / VC evidence: current head 8145a7819e9545de334c2032b701f8c97d7ffaf2 に対する TEST_VERDICT_MACHINE で 11/11 PASS、skip/fallback なしを確認
  • Allowed Paths: allowed_paths_review_gate.py が status: ok(changed files 3 件すべて contract snapshot 内)
  • CI Verification: ci_verdict_summary.py が current head で status: all_pass

Blockers

  • なし

Non-blockers

  • PR body hygiene の機械修正が未反映です。mergeability は CLEAN なので、本文を template shape に揃えれば merge_ready 判定へ進めます。

LOOP_VERDICT_V2

verdict: APPROVE
reviewed_head_sha: "8145a7819e9545de334c2032b701f8c97d7ffaf2"
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
allowed_paths_gate_source: review_subagent

@squne121
squne121 marked this pull request as ready for review July 2, 2026 23:32

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Mergeability

  • mergeable=MERGEABLE, merge_state_status=CLEAN

Evidence Check

  • AC coverage: linked issue #1291 の AC/VC に対応する 11/11 PASS の current-head TEST_VERDICT_MACHINE を確認しました。
  • Allowed Paths: changed files 3 件は contract snapshot の Allowed Paths 内です。
  • CI Verification: required checks 自体は current head で success ですが、merge_ready 判定は PR body hygiene 完了後の最終 current-head review に留めます。
  • 検証コマンド結果: PR 本文 ## Checks と current-head TEST_VERDICT_MACHINE が一致しています。

Blockers

  • なし

Non-blockers

  • live PR body には review gate 必須セクション ## 受け入れ条件の達成状況 / ## 検証コマンド結果 / ## Allowed Paths 遵守 / ## Runtime Verification Evidence がまだ存在しないため、update_pr_body_hygiene が current head でも未解消です。

LOOP_VERDICT_V2

verdict: APPROVE
reviewed_head_sha: "8145a7819e9545de334c2032b701f8c97d7ffaf2"
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
allowed_paths_gate_source: review_subagent

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Mergeability

  • mergeable=MERGEABLE, merge_state_status=CLEAN

Evidence Check

  • AC coverage: #1291 の scope どおり、raw gh issue edit / raw gh issue comment の廃止、controlled executor lane 維持、Claude/Codex parity、repair hint 修正、post-merge-cleanup 静的監査が差分に入っています。
  • Allowed Paths: allowed_paths_review_gate.py を current head 8145a7819e9545de334c2032b701f8c97d7ffaf2 で再実行し、status: ok を確認しました。
  • 検証コマンド結果: reviewed head の一時 worktree /tmp/loop-protocol-pr1298-review で #1291 の 11 VC を再実行し、294 passed in 7.96s と 524 passed in 14.07s を含め 11/11 PASS を確認しました。
  • PR body: validate_pr_body.py は current PR body に対して status: pass, errors: [] でした。Closes #1291 と Summary / Checks / Schema Change Applicability / Schema Consumer Inventory / Safety Claim Matrix / Notes も live body に存在します。
  • CI Verification: current head の live required checks は success で、PR は non-draft かつ mergeable=MERGEABLE, mergeStateStatus=CLEAN です。

Blockers

  • なし

Non-blockers

  • ci_verdict_summary.py は PR Body Japanese Check の skipped aggregation で exit 10 を返しましたが、current head の live required check 状態および validator pass と矛盾するため、ここでは merge blocker と扱いません。

LOOP_VERDICT_V2

verdict: APPROVE
reviewed_head_sha: "8145a7819e9545de334c2032b701f8c97d7ffaf2"
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
allowed_paths_gate_source: review_subagent

@squne121

squne121 commented Jul 3, 2026

Copy link
Copy Markdown
Owner Author

敵対的レビュー結果

判定: REQUEST_CHANGES。
実装方針自体は #1291 の契約に沿っています。gh issue comment の raw allow 分岐は消えており、gh issue edit は is_github_issue_mutation_command() の allow 対象から外れています。CI も current head 8145a781... に対して主要 workflow が success です。

ただし、security-sensitive な hook allowlist 変更としては、テストゲートに false-green 余地があります。 とくに AC6 の「controlled executor 経由コマンドが allow される」検証が、実際に controlled_skill_mutation ルートで allow されたことを証明していません。merge 前にここを潰すべきです。

ローカル clone / pytest 再実行は、この実行環境の DNS 制約で GitHub host 解決ができず未実施です。以下は GitHub connector で取得したPR/Issue/差分/コメント/CI情報と、公式Web資料の照合に基づくレビューです。


参照範囲

PR #1298 は open / non-draft / mergeable で、base は main、head は 8145a7819e9545de334c2032b701f8c97d7ffaf2、変更は3ファイル・+292/-84です。

関連として、#1284 / PR #1295 の controlled metadata executor 実装、#1291 の raw issue metadata mutation deprecate 契約、#1287 の edit-issue transaction、#1289 / PR #1299 の PreToolUse fast-path/reason-code 分離を確認しました。PR #1299 は #1291 完了を前提にしており、local_main_branch_guard.py の controlled executor allow reason を controlled_skill_mutation_executor に分離する後続変更です。


良い点

is_github_remote_ops_command() は gh issue close / gh issue reopen を維持しつつ、gh issue comment を allow 対象から外しています。gh pr comment / gh pr edit は従来の post-merge-cleanup 用 remote ops として残っています。これは #1291 の「Issue body/comment mutation だけ controlled executor lane に寄せる」意図と整合します。

is_github_issue_mutation_command() は gh issue create のみを対象にし、gh issue edit は subcommand != "create" で即 False になります。gh issue create については --title、trusted repo、safe tmp/ body file の条件を維持しています。

REASON_GH_MUTATION の repair hint は raw gh issue edit ... --body-file tmp/<body>.md ではなく、controlled_skill_mutation_exec.py --command-id issue_body.update ... --dry-run を案内する形に変更されています。Claude Code hook では stderr がClaudeへ返され、PreToolUse の exit code 2 は tool call をブロックするため、修復ヒントの正確性は単なる文言品質ではなく実運用上の安全性に直結します。 ([Claude Platform Docs]1)

#1284 で入った controlled metadata executor 側には issue_body.update / issue_comment.publish / contract_snapshot.publish の command id があり、policy registry 上も issue body update の stale-write precondition、comment publish の marker readback、contract snapshot publisher authority が定義されています。


Blocker 1: AC6 の controlled executor allow テストが false-green になり得る

追加テスト test_must_allow_controlled_executor_metadata_commands は、hook wrapper に controlled executor 形式のコマンドを渡して returncode == 0 と stderr == "" だけを見ています。

問題は、local_main_branch_guard.evaluate() の末尾が unknown non-branch command を allow する設計になっている点です。Step 13.6 の controlled executor 判定に失敗しても、コマンドが branch mutation や gh mutation と判定されなければ、最終的に unknown_non_branch_command_allowed で allow され得ます。

つまり現状のAC6テストは、「controlled executor exact class として allow された」ことではなく、「何らかの理由でブロックされなかった」ことしか証明していません。これは hook allowlist の回帰テストとして弱いです。is_controlled_skill_mutation_exec_command() 自体は canonical executor path と argv shape を検証する設計ですが、policy関数の semantic comment どおり repo slug / file existence などは executor本体側に委ねられています。だからこそ、guard側テストでは少なくとも parser stage / rule id / reason code を検証する必要があります。

要求修正:

run_claude_hook_script() の exit code テストに加えて、eval_in_local_root() または JSON判定モードで以下を固定してください。

result = eval_in_local_root(cmd, str(tmp_git_repo))
assert result["status"] == "allow"
assert result["local_parser_stage"] == "controlled_skill_mutation"
assert result["local_rule_id"] == "controlled_skill_mutation"

現時点の reason code は REASON_DETERMINISTIC_CHECKER なので、#1289 が入るまではそこも固定するか、#1299 の rebase 後に controlled_skill_mutation_executor へ更新してください。#1299 はこの分離を明示的に実装対象にしています。


High 1: gh issue edit の敵対的マトリクスが body 系に偏りすぎ

PRの raw issue edit テストは次の2件だけです。

"gh issue edit 123 --repo squne121/loop-protocol --body-file tmp/foo.md"
"gh issue edit 123 --repo squne121/loop-protocol --body rewritten"

実装上は subcommand != "create" で gh issue edit 全体が allow から外れるため、現コードはおそらく --title や label 系も block します。ただし、このIssueの主語は Issue metadata mutation であり、公式CLI上の gh issue edit は body だけでなく title、labels、assignees、projects、milestone、sub-issue、blocking relationship などを変更できます。([GitHub CLI]2)

GitHub REST の Update issue も title/body/state/milestone/labels/assignees/field values/type などを受ける広い mutation surface です。body-only executor lane を安全境界にする設計なら、テストも body-only ではなく metadata flags を明示的に攻めるべきです。([GitHub Docs]3)

要求修正:

Claude/Codex両方の raw edit matrix に最低限これを追加してください。

"gh issue edit 123 --repo squne121/loop-protocol --title new"
"gh issue edit 123 --repo squne121/loop-protocol --add-label bug"
"gh issue edit 123 --repo squne121/loop-protocol --remove-label bug"
"gh issue edit 123 --repo squne121/loop-protocol --add-assignee @me"
"gh issue edit 123 --repo squne121/loop-protocol --milestone v1"
"gh issue edit 123 --repo squne121/loop-protocol --remove-milestone"
"gh issue edit 123 --repo squne121/loop-protocol --add-project Roadmap"
"gh issue edit 123 --repo squne121/loop-protocol --add-sub-issue 124"
"gh issue edit 123 --repo squne121/loop-protocol --add-blocked-by 200"
"gh issue edit 123 --repo squne121/loop-protocol --add-blocking 300"

gh issue comment 側は --body、--body-file、-F、stdin、editor/web、edit/delete/create-if-none を概ね押さえています。公式CLIでもこれらは comment 作成・編集・削除・interactive browser/editor を含むため、raw issue comment mutation として block する判断は妥当です。 ([GitHub CLI]4)


Medium 1: post-merge-cleanup 静的監査テストが抜け道を許す

test_post_merge_cleanup_does_not_use_raw_issue_body_or_comment_mutation は、対象ファイル内に forbidden string があれば、その周辺120文字に allowed context token があるかだけを見ています。さらに content.index(needle) を使うため、同じ forbidden string が複数回ある場合も最初の出現箇所しか見ません。

これは「禁止コマンドが存在しない」監査ではなく、「禁止文字列が許可語の近くに出てくるなら通す」監査です。例えば説明文や近接する fallback 文に issue_comment.publish があれば、raw gh issue comment 実行行が同じ近傍にあるケースを見逃し得ます。

要求修正:

少なくとも次に変えてください。

for lineno, line in enumerate(content.splitlines(), start=1):
    if "gh issue edit" in line or "gh issue comment" in line:
        assert "issue_comment.publish" not in line  # 例外条件ではなく別行で明示判定
        assert line.lstrip().startswith(("#", "//")) or "forbidden example" in line

より良いのは、shell-like command行だけを抽出して、gh issue close / gh issue reopen / controlled executor invocation 以外を deny する line-based allowlist です。


Low 1: 実装コメントが現在の挙動とズレている

is_github_issue_mutation_command() の docstring に「gh issue comment/close/reopen remain handled by is_github_remote_ops_command」と残っています。しかし現在の is_github_remote_ops_command() は gh issue close / gh issue reopen のみを issue 側で allow し、gh issue comment は扱いません。

ここは将来のallowlist再導入を誘発しやすいコメントです。以下のように変えるべきです。

Note: gh issue close/reopen remain handled by is_github_remote_ops_command.
Raw gh issue comment intentionally falls through to gh_mutation_denied.

統合リスク: #1299 との順序

PR #1299 は open draft で、#1291 完了を前提に exact executor fast-path と reason-code 分離を入れます。#1298が入る前に #1299 を進めると、local_main_branch_guard.py 周辺で競合または検証語彙のズレが起きやすいです。#1298を先に hardening 修正込みでmergeし、#1299をrebaseして controlled_skill_mutation_executor reason code に合わせる順序が自然です。


最終所見

core implementation は正しい方向です。raw gh issue edit/comment の production path を消し、issue_body.update / issue_comment.publish / contract_snapshot.publish に寄せる設計は、GitHub CLI/RESTの広いmutation surfaceに対して妥当です。

ただし、このPRは hook allowlist の安全境界を変更しています。「allowされた」だけでは不十分で、「期待した classifier で allow された」ことを証明する必要があります。 その観点で、AC6テストは現状のままではmerge gateとして弱いです。まず Blocker 1 を修正し、合わせて gh issue edit のmetadata flag matrixを追加すれば、#1291の契約に対する敵対的耐性はかなり上がります。

@squne121

squne121 commented Jul 3, 2026 •

Copy link
Copy Markdown
Owner Author
TEST_VERDICT:
  result: PASS
  mergeable: MERGEABLE
  merge_state_status: CLEAN
  branch_behind_main: false
  baseline_only: false
  verification_commands_pass: 11
  verification_commands_fail: 0
  verification_skipped_count: 0
  runtime_ac_results:
    - ac: 1
      command: 'rg -n "issue_edit_deprecated" .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '1592:    def test_issue_edit_deprecated(self, tmp_git_repo: Path, cmd: str):'
    - ac: 2
      command: 'rg -n "issue_create_still_allowed" .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '1603:    def test_issue_create_still_allowed(self, tmp_git_repo: Path, cmd: str):'
    - ac: 3
      command: 'rg -n "issue_comment_deprecated" .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '1903:    def test_issue_comment_deprecated(self, tmp_git_repo: Path, cmd: str):'
    - ac: 4
      command: 'rg -n "remote_ops_still_allowed" .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '1917:    def test_remote_ops_still_allowed(self, tmp_git_repo: Path, cmd: str):'
    - ac: 5
      command: 'rg -n "must_block_raw_issue_" .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '1923:    def test_must_block_raw_issue_metadata_commands_via_real_hook(self, tmp_git_repo: Path, cmd: str):'
    - ac: 6
      command: 'rg -n "must_allow_controlled_executor_metadata_commands" .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '1934:    def test_must_allow_controlled_executor_metadata_commands('
    - ac: 7
      command: 'uv run --locked pytest .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '314 passed in 10.72s'
    - ac: 8
      command: 'rg -n "issue_metadata_mutation_parity" tests/codex/test_local_main_branch_guard.py'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '968:    def test_issue_metadata_mutation_parity(self, tmp_git_repo: Path, cmd: str):'
    - ac: 9
      command: 'rg -n "repair_hint_does_not_suggest_raw_issue_mutation" .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '1961:    def test_repair_hint_does_not_suggest_raw_issue_mutation(self, capsys):'
    - ac: 10
      command: 'rg -n "post_merge_cleanup_does_not_use_raw_issue_body_or_comment_mutation" .claude/hooks/tests/test_local_main_branch_guard.py'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '1977:    def test_post_merge_cleanup_does_not_use_raw_issue_body_or_comment_mutation(self):'
    - ac: 11
      command: 'uv run --locked pytest .claude/hooks/tests/test_local_main_branch_guard.py tests/codex/test_local_main_branch_guard.py'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '564 passed in 18.39s'

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOOP_VERDICT_V2

verdict: APPROVE
reviewed_head_sha: "6f27d5148871d0cf1e017942d99f8c975ba03f64"
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
allowed_paths_gate_source: review_subagent

@squne121
squne121 merged commit 01b518a into main Jul 3, 2026
22 checks passed
@squne121
squne121 deleted the worktree-issue-1291-local-main-guard-gh-mutation branch July 3, 2026 10:40
squne121 added a commit that referenced this pull request Jul 3, 2026
…(Issue #1289)

#1298 (raw issue metadata mutation の controlled executor 一本化) をマージした際、
#1289/#1299 で導入した controlled_skill_mutation_exec.py 専用の
reason_code 分離(REASON_CONTROLLED_SKILL_MUTATION_EXECUTOR)を #1298 側の
新規テスト(TestIssue1291IssueMetadataMutationClaude / ...Codex の
test_must_allow_controlled_executor_metadata_commands)が知らないまま
REASON_DETERMINISTIC_CHECKER を期待していたため 3 件ずつ(Claude/Codex 両フレーバー)
失敗した。

期待値を REASON_CONTROLLED_SKILL_MUTATION_EXECUTOR に更新し、両者の変更が
共存するよう調整した。parser_stage/rule_id は変更なし
(controlled_skill_mutation のまま)。pretool_fastpath_classifier は
controlled_skill_mutation_exec.py / skill_runtime_exec.py の exact shape
のみを判定対象とし、raw gh issue edit / gh issue comment はそもそも
一致し得ない構造のため、#1298 が追加した新しい raw allowlist コマンド形状
(--add-sub-issue 等)についても追加テストは不要と確認した。
squne121 added a commit that referenced this pull request Jul 3, 2026
… を追加 (#1289) (#1299)

* 実装: PreToolUse hook に read-only / exact-executor fast-path classifier を追加 (#1289)

pretool_fastpath_classifier.py を新規追加し、local_main_branch_guard と
worktree_scope_guard の read-only 判定の交差集合、および
controlled_skill_mutation_exec.py / skill_runtime_exec.py への exact 呼び出しの
authorized 条件(command_id membership・repo binding・namespace shape・
stable policy_hash)を検証したうえで、read-only 操作の telemetry を
bounded summary で dedupe する。独立 PreToolUse hook としては登録せず、
既存 guard から共有ライブラリとして import する(AC6)。

local_main_branch_guard.py の controlled skill mutation executor allow を
REASON_DETERMINISTIC_CHECKER から独立 reason_code
controlled_skill_mutation_executor に分離(AC8)。

hook boundary manifest(docs/dev/hook-boundaries.md・.codex/hooks.json)に
fast-path の classification / fail policy / stdout-stderr contract を追記し、
check_hook_boundaries.py の検証対象に .codex/hooks.json での
classifier 独立登録チェックを追加した。

Closes #1289

Co-Authored-By: Claude Fable 5 <[email protected]>

* fix: Ruff F401 未使用 import を削除 (#1289)

Co-Authored-By: Claude Fable 5 <[email protected]>

* fix: hook-boundaries.md 新設見出しに日本語併記を追加 (#1289)

PR Body Japanese Check の per-block 検査に対応。

Co-Authored-By: Claude Fable 5 <[email protected]>

* fix: PR #1299 レビュー指摘の fix_delta を適用(Issue #1289)

- Blocker 1: local_main_branch_guard.py の pretool_fastpath_classifier import を
  lazy import 化し、循環 import 順序に依存せず fastpath 有効化を保証
- Blocker 2: --input-file の path traversal / backslash / NUL / stdin marker /
  絶対パス / ネストサブディレクトリを fail-closed で拒否し
  mutation_or_unknown に倒す
- Blocker 3: readonly_display summary を固定ラベル語彙(git:status /
  gh:issue:view / search / file-display 等)から構成し、raw token 由来の
  クエリ・パス・secret-like 値の telemetry 漏洩を防止
- Major: .codex/hooks.json PreToolUse topology を固定期待値と fail-closed で
  比較する check_codex_hooks_pretool_topology() を追加

Co-Authored-By: Claude Fable 5 <[email protected]>

* fix: main merge後の reason_code 分離テストを #1298 の raw allowlist 一本化と整合させる (Issue #1289)

#1298 (raw issue metadata mutation の controlled executor 一本化) をマージした際、
#1289/#1299 で導入した controlled_skill_mutation_exec.py 専用の
reason_code 分離(REASON_CONTROLLED_SKILL_MUTATION_EXECUTOR)を #1298 側の
新規テスト(TestIssue1291IssueMetadataMutationClaude / ...Codex の
test_must_allow_controlled_executor_metadata_commands)が知らないまま
REASON_DETERMINISTIC_CHECKER を期待していたため 3 件ずつ(Claude/Codex 両フレーバー)
失敗した。

期待値を REASON_CONTROLLED_SKILL_MUTATION_EXECUTOR に更新し、両者の変更が
共存するよう調整した。parser_stage/rule_id は変更なし
(controlled_skill_mutation のまま)。pretool_fastpath_classifier は
controlled_skill_mutation_exec.py / skill_runtime_exec.py の exact shape
のみを判定対象とし、raw gh issue edit / gh issue comment はそもそも
一致し得ない構造のため、#1298 が追加した新しい raw allowlist コマンド形状
(--add-sub-issue 等)についても追加テストは不要と確認した。

---------

Co-authored-by: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

実装: local_main_branch_guard の raw gh issue edit/comment allowlist を controlled executor lane へ移行して deprecate する

1 participant