Skip to content

実装: issue-reviewer SubAgent 内で reviewer_claim_replay.py を co-locate 実行する - #1473

Merged
squne121 merged 2 commits into
mainfrom
worktree-issue-1472-reviewer-claim-replay-colocate
Jul 11, 2026
Merged

squne121 merged 2 commits into
mainfrom
worktree-issue-1472-reviewer-claim-replay-colocate

Conversation

@squne121

@squne121 squne121 commented Jul 11, 2026 •

Copy link
Copy Markdown
Owner

概要 (Summary)

対象Issueと関連Issueへの参照:

isolation worktree 環境で issue-refinement-loop orchestrator が子 worktree の raw compact_review_result_v1 artifact を直接 open/read できない問題(#1465 採用方針 (e))に対応する。issue-reviewer SubAgent が VERDICT: needs-fix を返す場合に、同一 SubAgent 実行境界内で reviewer_claim_replay.py(Step 2a arbitration)を co-locate 実行し、REVIEWER_CLAIM_REPLAY_V1 相当のフィールド(REPLAY_VERDICT / REPLAY_ROUTING / REPLAY_SHOULD_CONSUME / REPLAY_BODY_SHA256 / REPLAY_ARTIFACT_DIGEST)を stdout に追記するよう変更した。

  • .claude/agents/issue-reviewer.md: needs-fix 時に reviewer_claim_replay.py を co-locate 実行し REPLAY_* フィールドを stdout に追記する手順を追加(OUTPUT_BUDGET_V1 2048 UTF-8 byte を維持)
  • .codex/agents/issue-reviewer.toml: 同じ契約を反映し tests/test_agent_parity.py の Claude/Codex parity を維持
  • .claude/skills/issue-refinement-loop/SKILL.md Step 2a: orchestrator が artifact パス経由で reviewer_claim_replay.py を呼ぶ設計から、issue-reviewer SubAgent stdout の compact な arbitration 結果(REPLAY_*)をそのまま consume する設計へ書き換え
  • .claude/skills/issue-refinement-loop/tests/test_reviewer_claim_replay.py: session/issue番号 binding の negative test(tamper / symlink / wrong session / wrong issue number / wrong body hash / oversize / stale artifact)を追加

reviewer_claim_replay.py 本体(判定ロジック・taxonomy テーブル)は変更していない(Issue #1472 Out of Scope)。

CI テストパフォーマンス判定 (CI_TEST_PERFORMANCE_DECISION_V1)

CI/テストレーン関連パスの変更が検出されたため、以下の判定結果を証跡として記録する。

CI_TEST_PERFORMANCE_DECISION_V1:
  schema: CI_TEST_PERFORMANCE_DECISION_V1
  issue_number: 1472
  pr_number: null
  decision_scope: review_only
  changed_paths:
    - .claude/agents/issue-reviewer.md
    - .codex/agents/issue-reviewer.toml
    - .claude/skills/issue-refinement-loop/SKILL.md
    - .claude/skills/issue-refinement-loop/tests/test_reviewer_claim_replay.py
  lane_classification:
    fast_static: false
    python_unit: true
    contract_artifact: false
    integration: false
  notes: "既存 python_unit lane の既存テストファイルへ7件の negative test を追加したのみ。CI workflow / python-test-plan.json / pytest 実行対象の変更なし。新規 CI target 追加不要。"

Verification Commands(実行結果)

$ rg -n "reviewer_claim_replay" .claude/agents/issue-reviewer.md
exit=0 (matches found)
$ rg -n "SubAgent stdout の compact な arbitration" .claude/skills/issue-refinement-loop/SKILL.md
exit=0 (matches found)
$ rg -n "reviewer_claim_replay" .codex/agents/issue-reviewer.toml
exit=0 (matches found)
$ rg -n "wrong_body_hash" .claude/skills/issue-refinement-loop/tests/test_reviewer_claim_replay.py
exit=0 (matches found)
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/ -q
1258 passed
exit=0
$ uv run --locked pytest tests/test_agent_parity.py -q
# preflight-scope: pr_review_only
1 failed, 48 passed
exit=1 (pre-existing failure: `.claude/agents/web-researcher.md: expected route token 'grounded_research_or_direct_web' not found` -- unrelated to this PR's Allowed Paths; issue-reviewer/-toml parity subset passes: `pytest tests/test_agent_parity.py -k "issue_reviewer" -q` => 1 passed)

受け入れ条件の達成状況

各 AC の Verification Commands を実行し、以下のとおり結果を確認済み。

  • AC1 VC 実行済み
  • AC2 VC 実行済み
  • AC3 VC 実行済み
  • AC4 VC 実行済み
  • AC5 VC 実行済み(issue-refinement-loop の既存テストスイート全体が green)
  • AC6 VC 実行済み(pr_review_only scope。既存の無関係な web-researcher.md 起因の失敗のみで新規failureなし)

検証コマンド結果

上記「Verification Commands(実行結果)」セクションを参照。全AC PASS済み。

Safety Claim Matrix

.claude/skills/** および .claude/agents/** 配下の変更を含むため、安全性主張を明記する。

観点 主張 根拠
判定ロジックの不変性 reviewer_claim_replay.py 本体(analyze() のtaxonomy/routing判定)は一切変更していない Allowed Paths に reviewer_claim_replay.py を含めていない。Issue #1472 Out of Scope に明記
出力契約の後方互換性 VERDICT: approve 時の既存stdout契約(STATUS/VERDICT/SUMMARY/BLOCKERS/NEXT_ACTION/EVIDENCE/ARTIFACT)は変更していない。REPLAY_* フィールドは VERDICT: needs-fix 時のみ追記される追加フィールド .claude/agents/issue-reviewer.md diff参照。既存 .claude/skills/issue-refinement-loop/tests/ 全1258テストが green
OUTPUT_BUDGET_V1 遵守 stdout 2048 UTF-8 byte 上限を維持する設計とした(REPLAY_* フィールドはcompactな1行ずつの値のみ) .claude/agents/issue-reviewer.md の追加section本文に明記
Claude/Codex parity .codex/agents/issue-reviewer.toml に同じ契約を反映済み pytest tests/test_agent_parity.py -k "issue_reviewer" -q => 1 passed
Allowed Paths 遵守 変更ファイルは Issue #1472 Allowed Paths(8エントリ)の範囲内のみ(4ファイル) 下記 ALLOWED_PATHS_GATE_RESULT_V1 参照(status: ok, violations: [])

Allowed Paths 遵守

allowed_paths_review_gate.py を実行し、決定論的に確認した(review時点の canonical head: 88455cb2c1f424d54ac2979586258172d16757e0、base: main@b567c709c5baa1663d06338c7637a5b60a9c02a1)。

ALLOWED_PATHS_GATE_RESULT_V1:
  status: ok
  pr_number: 1473
  base_ref: main
  base_sha: b567c709c5baa1663d06338c7637a5b60a9c02a1
  head_sha: 88455cb2c1f424d54ac2979586258172d16757e0
  changed_files_count: 4
  changed_files:
    - .claude/agents/issue-reviewer.md
    - .claude/skills/issue-refinement-loop/SKILL.md
    - .claude/skills/issue-refinement-loop/tests/test_reviewer_claim_replay.py
    - .codex/agents/issue-reviewer.toml
  violations: []
  contract_fingerprint:
    issue_number: 1472
    contract_source_kind: issue_comment
    contract_source_id: "4947281049"
    contract_body_sha256: "sha256:479fe86f7ef7339f7798fb9bd51add694fd61c61b66ac85f7d5222c91f93a4b1"
    base_ref: main
    base_sha_at_snapshot: b567c709c5baa1663d06338c7637a5b60a9c02a1
    allowed_paths_normalized_sha256: d4ee4b3c83dee6df08003f6516951f5568ad8b0fe314f4dddc50f8f8e0fa888d
  reason: "All changed files are within allowed paths"

参照した contract snapshot(status: go のコメント): #1472 (comment)

🤖 本PRは Claude Code により生成された。Generated with Claude Code

isolation worktree 環境で orchestrator が子 worktree の raw compact_review_result
artifact を直接 open/read できない問題(#1465 採用方針 (e))に対応するため、
issue-reviewer SubAgent が VERDICT: needs-fix の場合に同一実行境界内で
reviewer_claim_replay.py を追加実行し、REPLAY_VERDICT / REPLAY_ROUTING /
REPLAY_SHOULD_CONSUME / REPLAY_BODY_SHA256 / REPLAY_ARTIFACT_DIGEST を stdout に
追記する。issue-refinement-loop SKILL.md Step 2a を「orchestrator が artifact
パス経由で呼ぶ」設計から「SubAgent stdout の compact な arbitration 結果を
consume する」設計へ書き換え、.codex/agents/issue-reviewer.toml で Claude/Codex
parity を維持した。

session/issue番号 binding の negative test(tamper / symlink / wrong session /
wrong issue number / wrong body hash / oversize / stale artifact)を
test_reviewer_claim_replay.py に追加。reviewer_claim_replay.py の判定ロジック
本体は変更していない(Out of Scope)。

Closes #1472
Refs #1465

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@github-actions

github-actions Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Preview URL

Preview removed (PR #1473 closed).

見出し・短い技術行を日本語併記にし、CI の per-block Japanese ratio check を通過させる。
意味・AC検証対象の文字列は変更しない。

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

Mergeability

  • mergeable=MERGEABLE, merge_state_status=CLEAN, isDraft=true(Draft自体はblockerではない)

Evidence Check

  • CI: ci_verdict_summary.py exit=0(all_pass、13/13 required checks head一致)
  • AC1: rg -n "reviewer_claim_replay" .claude/agents/issue-reviewer.md を実 checkout(pull/1473/head fetch)で実行し exit=0 で確認。needs-fix 時の co-locate 実行手順・REPLAY_* フィールド追記が明記されている
  • AC2: rg -n "SubAgent stdout の compact な arbitration" .claude/skills/issue-refinement-loop/SKILL.md exit=0。Step 2a が「orchestrator が artifact パス経由で呼ぶ」設計から「SubAgent stdout consume」設計へ書き換わっていることを diff hunk で確認済み
  • AC3: rg -n "reviewer_claim_replay" .codex/agents/issue-reviewer.toml exit=0。Claude/Codex parity 契約が同期されている
  • AC4: rg -n "wrong_body_hash" .claude/skills/issue-refinement-loop/tests/test_reviewer_claim_replay.py exit=0。tamper / symlink / wrong session(cross-issue state 分離) / wrong issue number pairing / oversize / stale artifact replay の7 negative test が新規追加されている(diff で + 行として確認、変更前に存在しなかったことも diff から明白)
  • AC5: uv run --locked pytest .claude/skills/issue-refinement-loop/tests/ -q → 1258 passed(0 failed)
  • AC6: uv run --locked pytest tests/test_agent_parity.py -q → 1 failed, 48 passed。失敗は web-researcher.md: expected route token 'grounded_research_or_direct_web' not found のみで PR本文の申告と一致。origin/main 側でも同一コマンドを独立した detached worktree で実行し、同一の1件failureが baseline から既に存在することを確認済み(本PRによる新規劣化なし)。pytest tests/test_agent_parity.py -k "issue_reviewer" -q は 1 passed, 48 deselected で PASS
  • Out of Scope遵守: git diff --name-only で変更ファイルは .claude/agents/issue-reviewer.md / .claude/skills/issue-refinement-loop/SKILL.md / .claude/skills/issue-refinement-loop/tests/test_reviewer_claim_replay.py / .codex/agents/issue-reviewer.toml の4件のみ。reviewer_claim_replay.py 本体(analyze() の taxonomy/routing)への変更は無く、Issue #1472 Out of Scope を遵守している
  • Allowed Paths: 上記4ファイルは Issue #1472 の Allowed Paths(8エントリ)のうち literal exact match の4件で、glob/rename 曖昧性なし。PR本文の Closes #1472 / Refs #1465 も記載済み
  • PR body hygiene: ## 受け入れ条件の達成状況 / ## 検証コマンド結果 / ## Allowed Paths 遵守 の必須見出しが本文に存在しない(## 検証計画 (Test plan) チェックリストと ## Verification Commands(実行結果) は存在するが、見出し文言が契約と不一致)

Blockers

  1. Safety Claim Matrix 欠落: 変更ファイルに .claude/agents/issue-reviewer.md / .claude/skills/issue-refinement-loop/SKILL.md / .claude/skills/issue-refinement-loop/tests/ が含まれ、.claude/skills/** パスは safety-sensitive 判定に該当する(Step 2a のロジック本体は移動していないが、SubAgent 実行境界内での co-locate 実行という「同一実行境界」に依存した安全性主張を含む変更のため)。Safety Claim Matrix(Claim / Implemented / Not controlled / Evidence / Follow-up)が PR本文に存在しない
  2. allowed_paths_gate: indeterminate(canonical script 未実行): Issue #1472 の Contract Review Result snapshot(body_sha256=479fe86f...)に contract_source_kind / contract_source_id / expected_contract_fingerprint の binding フィールドが含まれておらず、allowed_paths_review_gate.py の必須引数(--expected-contract-fingerprint 等)を満たせないため canonical gate script を実行できなかった。補助的に、fresh に取得した現在の issue body(gh api 直接取得、timeline 上 edit event 0件)と gh pr diff --name-only の live 比較では Allowed Paths 逸脱は確認されなかった(手動監査は ok 相当)が、fail-closed policy 上 canonical binding 欠落は indeterminate として merge-blocking 扱いとする

Non-blockers

  • PR body hygiene(必須見出し欠落)は update_pr_body_hygiene として機械的に修正可能

LOOP_VERDICT_V2

verdict: REQUEST_CHANGES
reviewed_head_sha: "88455cb2c1f424d54ac2979586258172d16757e0"
merge_ready: false
mergeability:
  mergeable: MERGEABLE
  merge_state_status: CLEAN
blockers:
  - "Safety Claim Matrix missing despite safety-sensitive changed paths (.claude/agents/issue-reviewer.md, .claude/skills/issue-refinement-loop/SKILL.md, .claude/skills/issue-refinement-loop/tests/, .codex/agents/issue-reviewer.toml)"
  - "allowed_paths_gate indeterminate: issue #1472 contract-review snapshot lacks contract_source_kind/contract_source_id/expected_contract_fingerprint binding required by allowed_paths_review_gate.py; manual live audit (gh api issue body + gh pr diff --name-only) found no Allowed Paths violation, but canonical fail-closed binding could not be verified"
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:
  - description: "issue-contract-review / ensure_contract_snapshot の CONTRACT_REVIEW_RESULT_V1 出力に contract_source_kind/contract_source_id/expected_contract_fingerprint を追加し、pr-review-judge の allowed_paths_review_gate.py が canonical に binding できるようにする"
    blocking_merge_ready: false
allowed_paths_gate:
  status: indeterminate
  changed_files_source: gh_pr_diff_name_only
  changed_files:
    - .claude/agents/issue-reviewer.md
    - .claude/skills/issue-refinement-loop/SKILL.md
    - .claude/skills/issue-refinement-loop/tests/test_reviewer_claim_replay.py
    - .codex/agents/issue-reviewer.toml
  reason: "expected_contract_fingerprint/contract_source_kind/contract_source_id missing from issue #1472 contract-review snapshot; canonical script could not run"
  producer_role: review_subagent
  worker_report_used_as_canonical: false
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.

再レビュー結果 (Re-review)

前回 REQUEST_CHANGES の2ブロッカーはいずれも解消を独立検証済み。

  1. Safety Claim Matrix: PR body に存在確認済み(## Safety Claim Matrix 見出し、.claude/agents/**/.claude/skills/** 変更に対する判定ロジック不変性・出力契約後方互換性・OUTPUT_BUDGET_V1・Claude/Codex parity・Allowed Paths遵守の5項目)。## 受け入れ条件の達成状況 / ## 検証コマンド結果 / ## Allowed Paths 遵守 も存在確認済み。
  2. Allowed Paths Gate: --contract-source-kind issue_comment / --contract-source-id 4947281049 を PR body記載の値ではなく、Issue #1472 go判定コメント(https://github.com/squne121/loop-protocol/issues/1472#issuecomment-4947281049)から自分で特定。`--expected-contract-fingerprint` は AllowedPathsGateEvaluator.compute_contract_fingerprint() を自分で呼び出して算出し(d4ee4b3c83dee6df08003f6516951f5568ad8b0fe314f4dddc50f8f8e0fa888d)、PR body記載値と一致することを確認。--contract-body-sha256 も現在のIssue #1472本文から独立再計算し(sha256:479fe86f...)、go判定コメント記載値と一致。allowed_paths_review_gate.py を実行し status: ok, violations: [](exit 0)を独立取得(4 changed files、全て Allowed Paths 8エントリ内)。

追加確認: PR最新コミット(88455cb2、前回レビュー後に追加)は heading の日本語併記化のみで、AC1-AC3のVC対象文字列(reviewer_claim_replay / SubAgent stdout の compact な arbitration)は変更前後で完全一致することを diff で確認済み。実装ロジック(AC4-AC6対象ファイル)は前回レビュー時から不変。

CI: gh pr checks 1473 は 14 passed / 0 failed。ci_verdict_summary.py は "PR Body Japanese Check" を failed として exit 10 報告したが、個別 job 調査の結果、これは pull_request_review イベントでトリガーされた旧runでは当該jobが条件付きでskipされ(head_sha=null)、それとは別の pull_request イベントの新run(同一 head_sha 88455cb2)では同jobが成功していることによる false positive と判断(duplicate run 由来、実際の CI regression ではない)。

LOOP_VERDICT_V2

verdict: APPROVE
reviewed_head_sha: "88455cb2c1f424d54ac2979586258172d16757e0"
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
producer_role: review_subagent
worker_report_used_as_canonical: false
pr_number: 1473
base_ref: main
diff_base_sha: "b567c709c5baa1663d06338c7637a5b60a9c02a1"
base_sha: "b567c709c5baa1663d06338c7637a5b60a9c02a1"
head_sha: "88455cb2c1f424d54ac2979586258172d16757e0"
reviewed_head_sha: "88455cb2c1f424d54ac2979586258172d16757e0"
changed_files_source: git_diff_name_status_find_renames_z
changed_files_count: 4
changed_files:
- .claude/agents/issue-reviewer.md
- .claude/skills/issue-refinement-loop/SKILL.md
- .claude/skills/issue-refinement-loop/tests/test_reviewer_claim_replay.py
- .codex/agents/issue-reviewer.toml
violations: []
contract_fingerprint:
issue_number: 1472
contract_source_kind: issue_comment
contract_source_id: "4947281049"
contract_body_sha256: "sha256:479fe86f7ef7339f7798fb9bd51add694fd61c61b66ac85f7d5222c91f93a4b1"
allowed_paths_normalized_sha256: "d4ee4b3c83dee6df08003f6516951f5568ad8b0fe314f4dddc50f8f8e0fa888d"
base_ref: main
base_sha_at_snapshot: "b567c709c5baa1663d06338c7637a5b60a9c02a1"

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.

実装: issue-reviewer SubAgent 内に Step 2a arbitration を co-locate し親の raw artifact 直接読み契約を廃止する

1 participant