Skip to content

実装: linked issue worktree の verified fast-forward を RTK guard で許可する - #1609

Merged
squne121 merged 6 commits into
mainfrom
worktree-issue-1589-linked-issue-worktree-verified-fast-forw
Jul 19, 2026
Merged

squne121 merged 6 commits into
mainfrom
worktree-issue-1589-linked-issue-worktree-verified-fast-forw

Conversation

@squne121

Copy link
Copy Markdown
Owner

Summary

この PR は Issue #1589 の実装です。classify_rtk_git_mutation(scripts/agent-guards/git_mutation_command_policy.py)に exact rtk git merge --ff-only <40-hex-sha> の専用 command class を追加し、既存の execute_initial_branch_create_transaction(#1449 / PR #1479)と同じ単一 trusted execution boundary パターンで execute_verified_ff_merge_transaction を実行します。検証・live remote 照会・ancestor 確認・merge 実行・事後確認をすべて一つの呼び出し内で完結させ、生の rtk git merge を別途再実行させない設計です。

Checks

  • AC1 の受け入れ検証として、正常な fast-forward の成功経路を次のテストで確認しました: uv run --locked pytest scripts/agent-guards/tests/test_rtk_ff_only_merge_policy.py::test_transaction_allows_live_verified_ancestor_target
  • AC2 の受け入れ検証として、raw command が常に deny されることを次のテストで確認しました: uv run --locked pytest scripts/agent-guards/tests/test_rtk_ff_only_merge_policy.py::test_classify_always_denies_raw_command_after_transaction
  • AC3 の受け入れ検証として、不正な形状と未検証ターゲットの拒否を次のテストで確認しました: uv run --locked pytest scripts/agent-guards/tests/test_rtk_ff_only_merge_policy.py::test_rejects_noncanonical_merge_shapes_and_unverified_targets
  • AC4 の受け入れ検証として、汚れた worktree と未解決文脈の拒否を次のテストで確認しました: uv run --locked pytest scripts/agent-guards/tests/test_rtk_ff_only_merge_policy.py::test_worktree_guard_rejects_dirty_root_and_unresolved_contexts
  • AC5 の受け入れ検証として、ローカル main と Codex 両方の flavor での拒否維持を次のテストで確認しました: uv run --locked pytest scripts/agent-guards/tests/test_rtk_ff_only_merge_policy.py::test_local_main_and_codex_flavors_keep_root_and_destructive_denies
  • AC6 の受け入れ検証として、ドキュメント記載の有無を次のコマンドで確認しました: rg -n "rtk git merge --ff-only" docs/dev/hook-boundaries.md
  • 既存テストの回帰確認も併せて実施し、いずれも全件成功しました。対象は test_git_mutation_command_policy.py(26件)、test_initial_branch_publish_policy.py(54件)、.claude/hooks/tests/test_local_main_branch_guard.py(373件)、.claude/hooks/tests/test_worktree_scope_guard.py(230件)、tests/codex/test_local_main_branch_guard.py(308件)です。

Schema Change Applicability

  • decision: not_schema_change
  • reason: 既存の GitMutationPolicyResult や WORKTREE_BOOTSTRAP_RESULT_V1 などの schema・呼び出し契約は変更していません。新しく追加した dataclass(VerifiedFfMergeTransactionResult)と関連定数は、既存の rtk git add/commit/push レーンとは独立した新しい merge 専用 command class(rtk_git_merge_ff_only)に閉じており、既存 consumer は classify_rtk_git_mutation の既存戻り値型をそのまま受け取ります。

Schema Consumer Inventory

N/A
reason: schema_change ではないため、既存 consumer(.claude/hooks/worktree_scope_guard.py および scripts/agent-guards/local_main_branch_guard.py)の before/after 差分は発生しません。両 consumer は classify_rtk_git_mutation の既存の汎用ディスパッチをそのまま利用しており、本 Issue では consumer 側のコード変更は不要でした。この点は既存回帰テストがすべて成功したことで確認済みです。

Safety Claim Matrix

Claim Implemented? Not controlled Evidence Follow-up
検証・live remote 照会・merge 実行・事後確認を単一の trusted execution boundary 内で完結させ、生の rtk git merge を別途再実行させないこと yes N/A test_classify_always_denies_raw_command_after_transaction が成功 N/A
汚れた worktree・root/default branch・issue-worktree 命名でない branch・detached HEAD・進行中の git operation は、いずれも merge 実行前に拒否されること yes N/A test_worktree_guard_rejects_dirty_root_and_unresolved_contexts が成功 N/A
ローカル main と Codex 両方の共有 guard が root 文脈でこの command class を許可しないこと yes N/A test_local_main_and_codex_flavors_keep_root_and_destructive_denies が成功 N/A
.codex/rules/default.rules は exact --ff-only prefix のみを allow とし、--ff-only を伴わない generic な rtk git merge は引き続き人間確認(prompt)のままであること yes N/A .codex/rules/default.rules の diff(exact 4-token prefix rule の追加のみ) N/A

Notes

Overlap Preflight Note

@github-actions

github-actions Bot commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Preview URL

Preview removed (PR #1609 closed).

…1589)

classify_rtk_git_mutation に exact `rtk git merge --ff-only <40-hex-sha>` の
専用 command class を追加し、execute_initial_branch_create_transaction
(#1449) と同じ単一 trusted execution boundary パターンで
execute_verified_ff_merge_transaction を実行する。verify(clean worktree /
非 default かつ issue-worktree 命名の active branch / canonical origin
binding) -> live git ls-remote probe -> ancestor 確認 -> merge 直前の
branch/HEAD 再確認 -> git merge --ff-only 実行 -> postcondition 確認
(branch 不変 / HEAD==target / clean / operation residue なし) を1呼び出し
内で完結させ、raw rtk git merge は常に deny を返す(reason_code に
transaction outcome を格納)。

.codex/rules/default.rules に exact `rtk git merge --ff-only` prefix の
allow rule を追加(--ff-only を伴わない generic merge は引き続き prompt)。
docs/dev/hook-boundaries.md に trusted transaction の内容・allow 条件・
Codex allow rule・deny 境界を記録した。

scripts/agent-guards/tests/test_rtk_ff_only_merge_policy.py に一時
git repository + bare origin fixture を使った8テストを追加(正常な
fast-forward・非fast-forward・shape不正/未検証target・dirty worktree/
root context/detached HEAD/操作残留・local main と Codex 両flavorの
root deny回帰)。既存の test_git_mutation_command_policy.py /
test_worktree_scope_guard.py / test_local_main_branch_guard.py(Claude/
Codex両方)は本変更で回帰しないことを確認済み(既存 assertion に
"merge" 前提がなかったため変更不要)。

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@squne121
squne121 force-pushed the worktree-issue-1589-linked-issue-worktree-verified-fast-forw branch from 255bec3 to 0121f8c Compare July 18, 2026 10:57

@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.

PR #1609 レビュー結果(iteration 1 / 2回目)

CI 証跡(ci_verdict_summary.py, expected_head_sha一致)

  • status: all_pass(exit 0)。failed_checks: [], pending_checks: []。
  • python-test: SUCCESS(新規 test_rtk_ff_only_merge_policy.py を含む)
  • lint: SUCCESS(ruff)
  • PR Body Japanese Check: SUCCESS
  • ci-verdict-summary: SUCCESS

Blocker 1(F401/E501)再検証

git show 0121f8cb...:scripts/agent-guards/tests/test_rtk_ff_only_merge_policy.py を独立取得して確認。MERGE_STATUS_MERGE_REJECTED / MERGE_STATUS_POSTCONDITION_VIOLATION の未使用 import は削除済み、CI lint job も SUCCESS。解消確認。

Blocker 2(Japanese Check)再検証

docs/dev/hook-boundaries.md の該当見出しを直接読み取り確認:

  • ## 12d. verified fast-forward merge lane(検証済み fast-forward merge レーン, Issue #1589)
  • ### Codex allow rule(Codex 許可ルール)
    両方とも日本語注記が追加済み。CI PR Body Japanese Check も SUCCESS。解消確認。

Blocker 3(Allowed Paths 混入)再検証

allowed_paths_review_gate.py を独立実行。結果: status: ok, changed_files_count: 4。

.codex/rules/default.rules
docs/dev/hook-boundaries.md
scripts/agent-guards/git_mutation_command_policy.py
scripts/agent-guards/tests/test_rtk_ff_only_merge_policy.py

全4ファイルが Issue #1589 の Allowed Paths 内。violations: []。#1540/#1544 由来の混入コミットは解消済みを確認。

その他確認

  • Mergeability: mergeable: MERGEABLE, mergeStateStatus: UNSTABLE(CLEAN/UNSTABLE バケット、blocker 扱いしない)
  • Closes #1589 を PR 本文に確認
  • AC1-AC6 は PR本文 ## Checks に [x] + 具体的 pytest コマンドで記載され、実ファイル内の該当 test 関数名と一致することを確認
  • Schema Change Applicability: not_schema_change(妥当)、Schema Consumer Inventory: N/A(理由あり)
  • Safety Claim Matrix: 4 claim すべて Not controlled: N/A + evidence 記載あり

結論

LOOP_VERDICT_V2:
  verdict: APPROVE
  reviewed_head_sha: "0121f8cb522e3085e2e1a560a6e9faeb87429e2c"
  merge_ready: true
  mergeability:
    mergeable: "MERGEABLE"
    merge_state_status: "UNSTABLE"
  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
    changed_files_source: "git_diff_name_status_find_renames_z"
    changed_files:
      - ".codex/rules/default.rules"
      - "docs/dev/hook-boundaries.md"
      - "scripts/agent-guards/git_mutation_command_policy.py"
      - "scripts/agent-guards/tests/test_rtk_ff_only_merge_policy.py"
    violations: []
    contract_fingerprint:
      issue_number: 1589
      contract_source_kind: "issue_comment"
      contract_source_id: "5010861220"
      base_ref: "main"
      base_sha_at_snapshot: "8e842c1e46a5e0b76621b6373a09357347eaa08e"

前回3件の blocker(ruff F401/E501, Japanese Check見出し, Allowed Paths混入)はすべて解消を独立に確認しました。CI全項目 all_pass、Allowed Paths gate ok。APPROVE / merge_ready: true。

@squne121

Copy link
Copy Markdown
Owner Author

敵対的レビュー結果

判定: REQUEST_CHANGES / マージ不可

レビュー対象は HEAD 0121f8cb522e3085e2e1a560a6e9faeb87429e2c。PR は draft、変更は4ファイル・+804/-1 です。CI は全 workflow が成功しており、既存レビュー本文も APPROVE 判定ですが、以下の実行境界・Git worktree・Codex policy の欠陥は検出されていません。

P0 Blocker — 認可より先に merge が実行される

worktree_scope_guard._decide_bash() は、active Issue、matching worktree、cwd containment を検証する前に classify_rtk_git_mutation() を呼んでいます。文脈検証は classifier 呼び出し後です。

一方、merge classifier は exact shape を認識すると、その場で execute_verified_ff_merge_transaction() を実行し、実際に git merge --ff-only を行った後で常に deny を返します。

したがって Claude hook では次の順序になります。

  1. merge を実行する
  2. status=deny を受け取る
  3. コマンドを block する
  4. Issue/worktree/cwd の認可検査には到達しない

つまり、ユーザーやエージェントには「拒否された」と表示されても、HEAD は既に移動している可能性があります。さらに transaction 自体は branch 名の正規表現しか見ておらず、active Issue 番号、expected worktree の実体パス、worktree catalog との一致を検証していません。これは AC4 の「resolved active Issue の linked worktree だけで実行」という契約違反です。

必須修正

  • classify_rtk_git_mutation() を副作用のない pure classifier に戻す。

  • worktree_scope_guard 側で以下をすべて認可してから transaction を呼ぶ。

    • active Issue が解決済み
    • matching worktree が一意
    • cwd == expected worktree
    • branch の Issue 番号が active Issue と一致
    • linked worktree であり root checkout ではない
  • transaction には自己申告文字列ではなく、認可済みの expected_worktree_realpath、Issue 番号、expected branch を渡して再検証する。

P1 Blocker — Codex の allow rule は実際には prompt のまま

追加された allow rule は次です。

["rtk", "git", "merge", "--ff-only"] -> allow

しかし直後の既存 rule は ["rtk", "git", "merge"] -> prompt にも一致します。

Codex execpolicy は「先に書かれた rule が勝つ」方式ではありません。すべての matching rule を集め、forbidden > prompt > allow の最も厳しい decision を採用します。そのため exact command も最終的には prompt です。また match は load-time の例示テストにすぎず、exact arity 制約ではありません。([GitHub]1)

このため AC5 の「exact --ff-only は allow、その他の merge は prompt」は現行 prefix-rule 言語では成立していません。新規テストも local_main_branch_guard.evaluate() を呼ぶだけで、codex execpolicy check を実行していません。

推奨修正

rtk git merge 配下で allow/prompt を分岐させず、専用 executor prefix に分離してください。

uv run --locked --no-sync python3 \
  scripts/agent-ops/verified_ff_merge_exec.py \
  --target-sha <sha>

これだけを Codex で allow とし、すべての rtk git merge は prompt のままにします。少なくとも次を CI に追加する必要があります。

codex execpolicy check --pretty \
  --rules .codex/rules/default.rules -- \
  rtk git merge --ff-only <40-hex-sha>

期待値は allow です。malformed command、追加 option、bare branch は prompt であることも検証対象です。

P1 Blocker — linked worktree の operation state を誤ったディレクトリで検査している

_has_in_progress_operation() は git rev-parse --git-common-dir を使い、その配下の MERGE_HEAD、CHERRY_PICK_HEAD、rebase-merge 等を検査しています。

しかし linked worktree では $GIT_DIR は worktree ごとの .git/worktrees/<id>、$GIT_COMMON_DIR は共通 repository dir です。HEAD や operation pseudo-ref は worktree 固有であり、Git 公式文書も git rev-parse --git-path を使うよう説明しています。(Git)

現行テストも実装と同じ誤りを複製し、MERGE_HEAD を common dir に手作業で置いています。 また fixture 自体も git init した通常 repository で、git worktree add による本物の linked worktree ではありません。

必須修正

各状態を次のように解決してください。

git rev-parse --git-path MERGE_HEAD
git rev-parse --git-path CHERRY_PICK_HEAD
git rev-parse --git-path REVERT_HEAD
git rev-parse --git-path BISECT_LOG
git rev-parse --git-path rebase-merge
git rev-parse --git-path rebase-apply

テスト fixture は main repository と git worktree add で作成した linked worktree の両方を持つ必要があります。

P1 Blocker — canonical remote の検証対象が read path と一致していない

transaction は origin の push URL が canonical repository かを検査します。

その後の live probe は URL ではなく remote 名 origin を git ls-remote に渡しています。

Git では remote.origin.url が fetch/read に使われ、remote.origin.pushurl が存在すれば push だけに使用されます。したがって以下の設定が可能です。

[remote "origin"]
    url = <別リポジトリ>
    pushurl = <canonical repository>

この場合 push URL 検査は通過しますが、live SHA は別リポジトリから取得されます。Git 公式仕様も fetch URL と push URL を別物として定義しています。(Git)

さらに同じモジュールの既存ドキュメントは、「同一 repository identity が必要なら同じ resolved URL を probe/write/readback に渡せ」と明記しているため、新規 lane は既存設計原則にも反しています。

必須修正

  • origin の effective fetch URL を一意に解決する。
  • fetch URL 自体を canonical pattern で検証する。
  • remote 名ではなく、その検証済み URL を classify_remote_branch_state() に渡す。
  • branch.<name>.remote == origin と branch.<name>.merge == refs/heads/<active-branch> も確認するか、契約から upstream binding の主張を削除する。

P1 Blocker — timeout 後の「実行済みか不明」を DENIED と誤分類する

subprocess.run(["git", "merge", ...], timeout=...) が timeout または transport exception になると、コードは MERGE_STATUS_DENIED / merge_execution_transport_error を返します。

しかし dataclass の説明では DENIED は「merge が実行されていない」状態です。実際には timeout 時点で ref と working tree が既に更新され、post-merge hook 内で停止している可能性があります。Git の post-merge hook は merge 成功後に実行され、その終了結果で merge 自体を取り消せません。(Git)

通常終了時には postcondition を検査しますが、timeout exception 経路では branch、cleanliness、operation residue を確認していません。

必須修正

例外を次のように分離し、timeout 後も無条件で readback してください。

  • spawn 前の OSError: execution_not_started
  • timeout 後に target HEAD・clean・branch 不変: transport_error_but_merged_and_verified
  • timeout 後に old HEAD・clean: transport_error_no_merge_observed
  • その他: transport_error_state_ambiguous

sleep する post-merge hook、および hook が untracked file を作るケースを実 repository でテストする必要があります。

P2 — uppercase SHA を受理している

契約とドキュメントは exact lowercase 40-hex を要求していますが、parser は入力を .lower() してから regex 検査しているため、uppercase SHA を受理します。

修正は以下です。

if not _SHA_RE.fullmatch(args[1] or ""):
    ...
target_sha = args[1]

uppercase SHA の deny test も追加してください。

テスト設計の不足

現行テストは transaction 単体と local-main guard を中心としており、最重要の「実 PreToolUse hook chain」「actual linked worktree」「Codex execpolicy」を検証できていません。特にテストコメントは worktree guard routing を検証したと主張していますが、実際には execute_verified_ff_merge_transaction() を直接呼んでいます。

最低限必要な回帰ケースは次です。

  1. active Issue なし/matching worktree 0件/複数件/cwd outside expected で、hook 実行後も HEAD 不変。
  2. actual git worktree add 環境で各 operation residue を拒否。
  3. fetch URL が非canonical、push URLだけ canonical の remote 設定を拒否。
  4. timeout 中に merge が完了したケースを正しく readback。
  5. codex execpolicy check で exact command が本当に allow。
  6. uppercase SHA、追加 suffix、shell wrapper を拒否。

関連 Issue・PR への影響

Issue #1603 は同じ policy、Codex rule、hook documentation を変更する sibling transaction で、#1589 のマージを明示的な開始条件にしています。PR #1609 を現状のままマージすると、#1603 が誤った execution/context boundary を継承するため、#1603 の実装開始も停止すべきです。

#1540 / PR #1544 の再開目的は妥当ですが、PR #1544 は現在も open draft です。unblock を急いでこの guard を取り込むより、上記 P0 を修正する方が優先です。

LOOP_VERDICT_V2:
  verdict: REQUEST_CHANGES
  reviewed_head_sha: "0121f8cb522e3085e2e1a560a6e9faeb87429e2c"
  merge_ready: false
  blockers:
    - context_authorization_happens_after_merge_side_effect
    - codex_allow_rule_is_shadowed_by_generic_prompt
    - linked_worktree_operation_state_uses_git_common_dir
    - live_remote_probe_is_not_bound_to_canonical_fetch_url
    - timeout_after_possible_merge_is_misclassified_as_not_executed
  required_before_rereview:
    - pure_classifier_and_authorized_executor_separation
    - actual_worktree_scope_guard_subprocess_tests
    - actual_git_worktree_fixture
    - codex_execpolicy_check_tests
    - canonical_fetch_url_binding
    - unconditional_timeout_readback

squne121 and others added 3 commits July 18, 2026 22:36
…low rule, per-worktree operation state

P0 Blocker: classify_rtk_git_mutation merge lane is a pure shape classifier
again (no subprocess side effect). Authorization (active Issue resolved,
matching worktree unique, cwd bound, linked worktree not root checkout)
now runs in worktree_scope_guard._decide_rtk_git_merge BEFORE calling
execute_verified_ff_merge_transaction, closing the race window where the
previous design executed the real merge as a classify side effect.

P1 Blockers:
- Codex exact rtk git merge --ff-only allow rule always resolved to prompt
  anyway (execpolicy takes the most severe decision across matching
  rules). Replaced with a dedicated executor,
  scripts/agent-ops/verified_ff_merge_exec.py, as the sole allowed shape.
- in-progress operation markers now resolved per-worktree via
  git rev-parse --git-path instead of --git-common-dir.
- canonical remote check now validates the resolved fetch url and probes
  that same url, instead of the push url or remote name.
- OSError and TimeoutExpired during git merge are classified into
  execution_not_started, transport_error_but_merged_and_verified,
  transport_error_no_merge_observed, or transport_error_state_ambiguous
  via an unconditional postcondition readback.

P2: uppercase SHA is rejected at shape-classification time.

Added real git worktree add fixtures for every transaction test, a
hook-level authorization-ordering regression test, and a codex
execpolicy check test.

Closes #1589

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

@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.

PR #1609 再レビュー結果(human REQUEST_CHANGES 対応後、iteration 2)

前回レビュー時点(head 10da40a3)で唯一残っていた blocker は Allowed Paths gate の fail_closed(新規 scripts/agent-ops/verified_ff_merge_exec.py が Issue #1589 の Allowed Paths 外)でした。この新規ファイルは OWNER の敵対的レビュー(https://github.com/squne121/loop-protocol/pull/1609#issuecomment-5011054192)自身が名指しで要求した Codex 専用 executor です。

対応として Issue #1589 本文を edit-issue skill 経由で更新し、Allowed Paths に scripts/agent-ops/verified_ff_merge_exec.py を追加する Scope Delta を追記(body_sha256: sha256:bf26464ac427a17dcd28f7f3c6add8001bad34138f5699af3cc4e227cd67f4e6)、ensure_contract_snapshot.py --mode auto --post で fresh CONTRACT_REVIEW_RESULT_V1 status: go を再取得しました(https://github.com/squne121/loop-protocol/issues/1589#issuecomment-5011793237)。

再確認結果

  • allowed_paths_review_gate.py を新しい contract snapshot にバインドして独立再実行: status: ok、violations: []。changed 7ファイル(scripts/agent-ops/verified_ff_merge_exec.py を含む)全てが Allowed Paths 内。
  • ci_verdict_summary.py --expected-head-sha 10da40a389aca84523e530d50c9cd3dc0eef7b5a: status: all_pass、failed_checks: []、pending_checks: []、stale_checks: []。
  • Mergeability: mergeable: MERGEABLE、mergeStateStatus: CLEAN。
  • P0/P1/P2 の技術的修正(authorization ordering, Codex allow rule shadowing 解消, git-path operation state, canonical fetch URL binding, timeout 4分類, uppercase SHA rejection)は前回レビューでコード直読により妥当性確認済み、本 head で変更なし。

結論

LOOP_VERDICT_V2:
  verdict: APPROVE
  reviewed_head_sha: "10da40a389aca84523e530d50c9cd3dc0eef7b5a"
  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
    changed_files_source: git_diff_name_status_find_renames_z
    changed_files_count: 7
    changed_files:
      - ".claude/hooks/tests/test_worktree_scope_guard.py"
      - ".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_ff_only_merge_policy.py"
      - "scripts/agent-ops/verified_ff_merge_exec.py"
    violations: []
    contract_fingerprint:
      issue_number: 1589
      contract_source_kind: issue_comment
      contract_source_id: "5011793237"
      contract_body_sha256: "sha256:bf26464ac427a17dcd28f7f3c6add8001bad34138f5699af3cc4e227cd67f4e6"
      base_ref: main
      base_sha_at_snapshot: "5992b2a028354c5463c1b11742143185f36c0a28"

Blocker なし、merge_ready: true。

squne121 and others added 2 commits July 19, 2026 09:24
…inked-issue-worktree-verified-fast-forw

# Conflicts:
#	.claude/hooks/worktree_scope_guard.py
#	scripts/agent-guards/git_mutation_command_policy.py

@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.

PR #1609 再レビュー結果(merge conflict 解消後)

main が2回先行し(1回目: e678fea0/be430de1 → conflict → implementation-worker が merge commit 7d844cfe で解消。2回目: 人間が GitHub UI 経由でさらに新しい main を merge → merge commit cab3818f)、現在の head は cab3818f です。

再確認結果

  • git diff origin/main...HEAD --name-only: 依然として元の7ファイルのみ。main側の新規変更(Codex legacy env削除等)との衝突なし。
  • 全996テスト PASS。
  • codex execpolicy check — rtk git merge --ff-only <sha> → prompt(変わらず)、専用 executor verified_ff_merge_exec.py → allow(変わらず)。
  • CI: ci_verdict_summary.py で status: all_pass、head_sha 一致確認。
  • allowed_paths_review_gate.py 独立再計算: status: ok、violations: []。changed 7ファイル全て Allowed Paths 内。
  • P0/P1/P2 の技術的修正(authorization ordering, Codex allow rule shadowing 解消, git-path operation state, canonical fetch URL binding, timeout 4分類, uppercase SHA rejection)はコード直読で再確認済み、regression なし。
  • Mergeability: mergeable: MERGEABLE、mergeStateStatus: CLEAN。

結論

LOOP_VERDICT_V2:
  verdict: APPROVE
  reviewed_head_sha: "cab3818fbf38eac581e70af2d83c7fd463b544bf"
  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
    changed_files_source: git_diff_name_status_find_renames_z
    changed_files:
      - ".claude/hooks/tests/test_worktree_scope_guard.py"
      - ".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_ff_only_merge_policy.py"
      - "scripts/agent-ops/verified_ff_merge_exec.py"
    violations: []
    producer_role: review_subagent
    worker_report_used_as_canonical: false
    contract_fingerprint:
      contract_source_kind: issue_comment
      contract_source_id: "5011793237"
      contract_body_sha256: "sha256:bf26464ac427a17dcd28f7f3c6add8001bad34138f5699af3cc4e227cd67f4e6"

Blocker なし、merge_ready: true。conflict 解消による regression は AC / Allowed Paths / CI いずれにもなし。

なお、今回の「APPROVE後にmainが2回先行しconflict化した」経緯を踏まえ、post-approval staleness 検知の仕組み不足を Issue #1624 として起票済みです(https://github.com/squne121/loop-protocol/issues/1624)。

@squne121
squne121 marked this pull request as ready for review July 19, 2026 00:43
@squne121
squne121 merged commit e6d9842 into main Jul 19, 2026
22 checks passed
@squne121
squne121 deleted the worktree-issue-1589-linked-issue-worktree-verified-fast-forw branch July 19, 2026 00:43
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.

実装: linked issue worktree の verified fast-forward を RTK guard で許可する

1 participant