Repository navigation
Closed
4 / 44 of 4 issues completed
Copy link
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "#1402"
goal_ref: "Issue #1402 の agent publish lane で、検証済み publish 証跡が揃っている `rtk git push origin HEAD:refs/heads/<active-branch>` が PreToolUse の generic deny で止まらないようにする"
change_kind: workflowParent Issue
Parent Goal Ref
- Goal: agent publish lane の手動介入依存を解消し、実装ブランチ publish までを bounded safety gate 内で進められるようにする
- Desired Destination: Issue 実装: agent publish lane の手動介入依存を解消する #1402 の publish lane で
PUBLISH_LANE_DECISION_V1 status: allow_retry相当の証跡が揃ったとき、agent が PR 作成前の branch publish を完了できる状態
Current Validated Scope
scripts/session-recording/codex-hook-adapter.mjsの PreToolUse remote write 判定は、現状git pushを一律remote_write_requires_approvalとして deny するscripts/agent-guards/git_mutation_command_policy.pyにはclassify_rtk_git_mutation等の rtk git mutation 分類関数が存在するが、publish lane の expected/current/local/verified/declared head と allowed paths gate を比較する bounded policy は現状のコードベースには実装されていない(この head 比較 bounded policy は Issue 実装: agent publish lane の手動介入依存を解消する #1402 で仕様定義されているのみで、本 Issue 実装前時点では未実装)- 環境変数
LOOP_PUBLISH_EXPECTED_REMOTE_HEAD/LOOP_PUBLISH_DECLARED_PUBLISH_HEAD/LOOP_PUBLISH_VERIFIED_HEAD/LOOP_PUBLISH_ALLOWED_PATHS_GATE_STATUSは Issue 実装: agent publish lane の手動介入依存を解消する #1402 で仕様化されているが、現状のコードベースには実在しない(本 Issue の In Scope 実装で初めて具体化される想定の入力) tests/session_recording/codex/test_hook_adapter.pyにはremote_write_requires_approvalの PreToolUse fixture が存在するため、実 hook entrypoint の挙動を回帰テストできる- Issue 実装: agent publish lane の手動介入依存を解消する #1402 の実装 worktree では
rtk git push origin HEAD:refs/heads/worktree-issue-1402-agent-publish-laneがPreToolUse: remote_write_requires_approval [command_kind=git_push]で止まり、PR 起票に進めなかった .claude/hooks/worktree_scope_guard.shはscripts/agent-guards/git_mutation_command_policy.pyの publish lane 分類ロジックに依存しており、.claude/hooks/tests/test_worktree_scope_guard.pyに同一 env 変数群(LOOP_PUBLISH_EXPECTED_REMOTE_HEAD等)を使う回帰テストが既に存在する(本 Issue の実装 PR レビューで、policy 変更がこのテストを壊すことが判明した)scripts/agent-guards/tests/test_shell_command_analysis.pyにはclassify_rtk_git_mutation()のシグネチャが(command, cwd, require_active_branch_push)のまま変わらないことを保証する契約テスト(test_analyzer_does_not_change_git_mutation_command_policy_api)が存在する(本 Issue のboundary_layerパラメータ追加により、この契約テストの期待値更新が必要と判明した)
Remaining Parent Gaps
- 実装: agent publish lane の手動介入依存を解消する #1402 側の現在の実装コミットを remote branch へ publish して Draft PR を起票する作業は、本 Issue では扱わない
- feat: implementation-worker SubAgent に push destination guard hook を追加する #360 の main/master destination guard そのものは別 Issue として維持し、本 Issue では汎用 destination guard の作り直しをしない
- 実装: agent publish lane の手動介入依存を解消する #1402 で仕様化された head 比較 bounded policy と関連環境変数(
LOOP_PUBLISH_EXPECTED_REMOTE_HEAD等)は本 Issue の In Scope 実装によって初めてscripts/agent-guards/git_mutation_command_policy.pyに具体化される - 新規 branch の初回 publish(remote branch 不在)用の atomic create lane の設計・実装は本 Issue では扱わない(実装: publish laneに新規branch初回publish用のatomicなbranch作成laneを追加する #1449 で扱う)
- publish lane 認可コード(policy/adapter)を candidate worktree 外の信頼境界へ移す設計・実装は本 Issue では扱わない(実装: publish laneのauthorization code(policy/adapter)の信頼境界をhash pinningでcandidate worktree外に確立する #1450 で扱う)
Outcome
scripts/session-recording/codex-hook-adapter.mjs と関連 policy/tests が更新され、Issue worktree 内の検証済み publish lane に限って rtk git push origin HEAD:refs/heads/<active-branch> が generic remote_write_requires_approval で止まらず、危険・不一致・直接 git push は引き続き deny されることをテストで確認できる状態。あわせて .claude/hooks/worktree_scope_guard.sh の既存 publish lane 回帰テストと、classify_rtk_git_mutation() の API 契約テスト(test_shell_command_analysis.py)との整合性が保たれている状態。
In Scope
- PreToolUse hook entrypoint が
rtk git push origin HEAD:refs/heads/<active-branch>を識別し、publish lane 証跡が揃っている場合だけ deny しない経路を追加する - publish lane 証跡は
LOOP_PUBLISH_EXPECTED_REMOTE_HEAD/LOOP_PUBLISH_DECLARED_PUBLISH_HEAD/LOOP_PUBLISH_VERIFIED_HEAD/LOOP_PUBLISH_ALLOWED_PATHS_GATE_STATUS、または既存 policy と同等の構造化入力から取得する - publish lane 判定は
scripts/agent-guards/git_mutation_command_policy.pyの bounded policy を再利用または同一条件へ集約し、PreToolUse hook adapter 側に別実装の安全判定を増やさない - stale remote head、local head mismatch、mixed head contamination、allowed paths gate failure は
PUBLISH_SAFETY_STOP_REPORT_V1相当の structured reason を返して deny する git push直接実行、git -C <dir> push、force/tag/all/delete/mirror push は deny を維持する- hook adapter / policy / docs の境界を更新し、feat: implementation-worker SubAgent に push destination guard hook を追加する #360 の destination guard と本 Issue の publish lane approval bridge の責務差分を明記する
- 実 hook entrypoint を通る regression test を追加・更新する
scripts/agent-guards/git_mutation_command_policy.pyの publish lane 判定ロジック変更が.claude/hooks/worktree_scope_guard.shの既存 publish lane 回帰テスト(.claude/hooks/tests/test_worktree_scope_guard.py)と整合するよう、必要な範囲でworktree_scope_guard.sh側を修正するclassify_rtk_git_mutation()へのboundary_layerパラメータ追加を、scripts/agent-guards/tests/test_shell_command_analysis.py::test_analyzer_does_not_change_git_mutation_command_policy_apiの期待シグネチャに反映する(意図した API 拡張であることを契約テストの期待値更新として明示する。この関数のシグネチャ以外の契約・呼び出し側ロジックは変更しない)
Out of Scope
- GitHub credential / OAuth / token scope の変更
- force push、tag push、mirror push、delete push の許可
git push直接実行の許可- main/master branch destination guard feat: implementation-worker SubAgent に push destination guard hook を追加する #360 の置き換え
- Issue 実装: agent publish lane の手動介入依存を解消する #1402 の実装 PR の merge または remote branch publish 作業そのもの
- Codex runtime 本体の approval policy 変更
- 新規 branch 初回 publish 用の atomic create lane(実装: publish laneに新規branch初回publish用のatomicなbranch作成laneを追加する #1449)
- publish lane 認可コードの信頼境界外部化(実装: publish laneのauthorization code(policy/adapter)の信頼境界をhash pinningでcandidate worktree外に確立する #1450)
worktree_scope_guard.shの publish lane 以外の機能(scope guard 本体のロジック)の変更classify_rtk_git_mutation()以外のscripts/agent-guards/tests/test_shell_command_analysis.pyの対象範囲(analyzer本体ロジック)の変更
Runtime Verification Applicability
- decision: not_applicable
- reason: 本 Issue の検証は
scripts/session-recording/codex-hook-adapter.mjsの PreToolUse 判定ロジックとscripts/agent-guards/git_mutation_command_policy.pyの bounded policy、.claude/hooks/worktree_scope_guard.sh、およびscripts/agent-guards/tests/test_shell_command_analysis.pyの API 契約テストに対する pytest ユニットテスト(tests/session_recording/codex/test_hook_adapter.py/scripts/agent-guards/tests/test_git_mutation_command_policy.py/.claude/hooks/tests/test_worktree_scope_guard.py/scripts/agent-guards/tests/test_shell_command_analysis.py)と docs 記述確認(rg)のみで完結し、実プロセス起動・実ネットワーク通信・実 GitHub remote への実際の push 実行を伴わない。したがって静的検証(unit test / lint 相当)のみで AC を検証でき、runtime-verification: trueタグ付き動作検証 AC は不要と判定する。
Acceptance Criteria
- AC1:
rtk git push origin HEAD:refs/heads/<active-branch>かつ publish lane 証跡が一致する PreToolUse payload では、hook adapter が genericremote_write_requires_approvaldeny を返さない - AC2: 直接
git push/git -C <dir> push/ wrapper bypass は引き続き deny され、理由にdirect_bypass_requires_rtkまたはremote_write_requires_approval相当の機械可読 reason が残る - AC3: expected/current/local/verified/declared head の不一致、または
LOOP_PUBLISH_ALLOWED_PATHS_GATE_STATUS != okでは deny され、PUBLISH_SAFETY_STOP_REPORT_V1相当の reason にboundary_layer/reason_code/ head 比較値 / required decision が含まれる - AC4: force/tag/all/delete/mirror push は publish lane 証跡があっても deny される
- AC5:
scripts/session-recording/codex-hook-adapter.mjsの実 entrypoint を通る tests が positive lane と negative lane の両方を検証する - AC6: docs は feat: implementation-worker SubAgent に push destination guard hook を追加する #360 の destination guard と本 Issue の publish lane approval bridge の責務差分を、"publish lane approval bridge" という語句で明記する
- AC7:
.claude/hooks/tests/test_worktree_scope_guard.pyの既存 publish lane 回帰テストが全て pass する - AC8:
scripts/agent-guards/tests/test_shell_command_analysis.pyが全て pass する(classify_rtk_git_mutation()の期待シグネチャにboundary_layerを含めて更新済み)
Verification Commands
# baseline-expect: pass
$ python3 -m pytest tests/session_recording/codex/test_hook_adapter.py # AC1
# baseline-expect: pass
$ python3 -m pytest tests/session_recording/codex/test_hook_adapter.py # AC2
# baseline-expect: pass
$ python3 -m pytest tests/session_recording/codex/test_hook_adapter.py # AC3
# baseline-expect: pass
$ python3 -m pytest scripts/agent-guards/tests/test_git_mutation_command_policy.py # AC4
# baseline-expect: pass
$ python3 -m pytest tests/session_recording/codex/test_hook_adapter.py # AC5
$ rg -n "publish lane approval bridge" docs/dev/session-recording-policy.md docs/dev/agent-runtime-ops.md docs/dev/hook-boundaries.md docs/dev/workflow.md docs/dev/agent-skill-boundaries.md # AC6
# baseline-expect: pass
$ python3 -m pytest .claude/hooks/tests/test_worktree_scope_guard.py # AC7
# baseline-expect: pass
$ python3 -m pytest scripts/agent-guards/tests/test_shell_command_analysis.py # AC8Allowed Paths
scripts/session-recording/codex-hook-adapter.mjstests/session_recording/codex/test_hook_adapter.pyscripts/agent-guards/git_mutation_command_policy.pyscripts/agent-guards/tests/test_git_mutation_command_policy.pyscripts/agent-guards/hook_repair_hints.pydocs/dev/session-recording-policy.mddocs/dev/agent-runtime-ops.mddocs/dev/hook-boundaries.mddocs/dev/workflow.mddocs/dev/agent-skill-boundaries.md.claude/hooks/worktree_scope_guard.sh.claude/hooks/tests/test_worktree_scope_guard.pyscripts/agent-guards/tests/test_shell_command_analysis.py
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合(ただし
classify_rtk_git_mutation()へのboundary_layer追加とそれに伴う契約テスト期待値更新は本 Scope Delta で明示的に許可済み) - 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- Codex runtime 本体の承認モデル変更が必要と判明した場合
rtk git push origin HEAD:refs/heads/<active-branch>以外の remote write 許可が必要と判明した場合worktree_scope_guard.shの scope guard 本体ロジック(publish lane 判定以外)の変更が必要と判明した場合test_shell_command_analysis.pyの analyzer 本体ロジック(classify_rtk_git_mutationAPI契約以外)の変更が必要と判明した場合
Required Skills
- JavaScript / Node.js hook adapter
- Python / pytest
- Git refspec と publish safety policy
- Bash hook script (worktree_scope_guard.sh)
Required Design References
docs/dev/session-recording-policy.mddocs/dev/agent-runtime-ops.mddocs/dev/hook-boundaries.mddocs/dev/workflow.mddocs/dev/agent-skill-boundaries.md- Issue 実装: agent publish lane の手動介入依存を解消する #1402 の publish blocker comment / implementation result
- Issue feat: implementation-worker SubAgent に push destination guard hook を追加する #360 の push destination guard contract
- PR feat: PreToolUse remote_write_requires_approval を publish lane 証跡で通過可能にする #1442 の人間によるアドバーサリアルレビュー(https://github.com/squne121/loop-protocol/pull/1442#issuecomment-4941989903)
Delivery Rule
1 Issue = 1 PR- Dedicated worktree を作成して実装する
- Draft PR 既定
- 実装: agent publish lane の手動介入依存を解消する #1402 の branch publish blocker 解消を目的とする follow-up として扱い、実装: agent publish lane の手動介入依存を解消する #1402 の実装差分をこの Issue に混ぜない
Scope Delta(任意)
- 発生理由1: PR feat: PreToolUse remote_write_requires_approval を publish lane 証跡で通過可能にする #1442 の人間によるアドバーサリアルセキュリティレビュー(P1/P2指摘、コメントURL: https://github.com/squne121/loop-protocol/pull/1442#issuecomment-4941989903)への fix_delta 対応(
scripts/agent-guards/git_mutation_command_policy.pyの publish lane 判定変更)が、CI上で.claude/hooks/tests/test_worktree_scope_guard.pyの既存 publish lane 回帰テスト2件を破壊することが判明した。- 追加された Allowed Paths:
.claude/hooks/worktree_scope_guard.sh,.claude/hooks/tests/test_worktree_scope_guard.py - 追加された AC: AC7(
.claude/hooks/tests/test_worktree_scope_guard.py全pass) - 追加された Verification Commands: AC7 用の
pytest .claude/hooks/tests/test_worktree_scope_guard.py - スコープ境界:
worktree_scope_guard.shの scope guard 本体ロジック(publish lane 判定以外の部分)は変更しない。あくまで policy 側の変更に追従させる整合性修正のみ。
- 追加された Allowed Paths:
- 発生理由2: iteration5(main との conflict resolve)後、CI上で
scripts/agent-guards/tests/test_shell_command_analysis.py::test_analyzer_does_not_change_git_mutation_command_policy_apiが、classify_rtk_git_mutation()へのboundary_layerパラメータ追加(発生理由1の fix_delta で追加済み)と衝突して fail することが判明した。- 追加された Allowed Paths:
scripts/agent-guards/tests/test_shell_command_analysis.py - 追加された AC: AC8(
scripts/agent-guards/tests/test_shell_command_analysis.py全pass) - 追加された Verification Commands: AC8 用の
pytest scripts/agent-guards/tests/test_shell_command_analysis.py - スコープ境界:
classify_rtk_git_mutation()の API シグネチャ変更(boundary_layer追加)は意図した拡張として契約テストの期待値のみ更新する。test_shell_command_analysis.pyが検証する analyzer 本体のロジックは変更しない。
- 追加された Allowed Paths:
Sub-issues
Collapse Sub-issuesSub-issues
Loading 4 sub-issues
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Activity
squne121 commentedon Jul 9, 2026
判定: REQUEST_CHANGES
#1408 は必要な方向です。現状の
codex-hook-adapter.mjsはgit pushをremote_write_requires_approvalとして一律分類し、PreToolUseではno_decision相当の結果も実際には deny として返すため、rtk git push origin HEAD:refs/heads/<active-branch>も止まります。#1408 の目的自体はこの実装実態と整合しています。ただし、Issue 本文のまま実装すると「generic deny の穴あけ」になりやすい。既存の共有
rtk gitpolicy は、push についてorigin、HEAD:refs/heads/<branch>、禁止 flag、active branch 一致までは見る一方、#1402 で要求されている remote head drift、local/declared/reviewed head mismatch、Allowed Paths gate、post-push readback は見ていません。最大の問題は、#1408 が「PreToolUse の deny を通過可能にする」Issueであるのに、実際に必要なのは「publish lane 用の条件付き remote write authorization」です。これは分類の例外ではなく、安全性を証明できる narrow mutation lane です。
確認した関連資産
#1408 は #1402 の子 Issue で、#1402 は #1399 の publish 失敗・remote head drift・manual branch update を背景にしています。#1408 本文も、
LOOP_PUBLISH_EXPECTED_REMOTE_HEAD、LOOP_PUBLISH_DECLARED_PUBLISH_HEAD、LOOP_PUBLISH_VERIFIED_HEAD、LOOP_PUBLISH_ALLOWED_PATHS_GATE_STATUS相当の証跡が揃った場合のみrtk git push origin HEAD:refs/heads/<active-branch>を通す、という要求を書いています。#360 は別系統の destination guard で、main/master への push を防ぐ防御層です。#1408 はこれを置き換えてはいけません。#360 の目的は、過去に
git push origin mainが実行され main に直 push された事故を受け、main/master destination を block することです。リポジトリ文書上も、Codex の同一 event に対する複数 hook は concurrent に起動され、実行順序や short-circuit は保証されないため、各 handler が独立して fail-closed 判定を返す必要があります。つまり「worktree_scope_guard が後で守るから session-recording 側は雑に allow」は不可です。
Blocker 1: adapter 側に JS regex で publish allow を直実装してはいけない
現在の adapter は
\bgit ... push\bの regex で remote write を検出します。この regex はrtk git push ...内のgit pushにも反応します。ここに
if command.includes("rtk git push") && envOK then allowのような実装を足すと、既存のshlexベース policy と split-brain になります。既存のgit_mutation_command_policy.pyは意図的に narrow policy としてrtk git add/commit/pushだけを認識する設計なので、publish lane もこの Python policy 側に寄せるべきです。修正要求:
codex-hook-adapter.mjsは policy decision consumer に留める。判定本体はscripts/agent-guards/git_mutation_command_policy.pyまたは同ディレクトリの専用 policy module に集約し、Node から JSON stdin で呼び出す。判定不能・policy 実行失敗・証跡不足はすべて既存のremote_write_requires_approvaldeny にフォールバックする。Blocker 2: 既存 bounded push policy は publish lane の安全条件を満たしていない
既存 push policy は、禁止 flag、
origin、refspec shape、branch 名 regex、active branch 一致を見ます。これは「危険な push shape を絞る」には有効ですが、「この push が #1402/#1408 の verified publish lane である」ことは証明しません。Git の
pushは remote ref を更新する操作で、refspec の+は--forceと同義、空 src は remote ref delete、--allは全 branch、--mirrorは refs 全体の mirror/force/delete を含みます。したがって publish lane は exact argv だけでなく、refspec の破壊的形も明示的に deny すべきです。([Git]1)また Git は branch destination では fast-forward update のみを通常許可し、non-fast-forward は履歴喪失になりうるため拒否します。
--forceはその安全チェックを無効化し remote repository の commit 喪失を起こし得るため、#1408 の lane では--force,+refspec,--force-with-leaseも含めて不許可に固定すべきです。([Git]1) ([Git]1)修正要求: publish lane policy の allow 条件は最低限これです。
Blocker 3: remote head は env だけではなく fresh read が必要
#1408 は env key または structured input を許容していますが、
current_remote_headを env で渡すだけだと stale です。#1402 の失敗背景は remote head drift なので、通過直前に remote を読み直す必要があります。git ls-remoteは remote repository の refs と対応 commit ID を表示するコマンドで、branch ref の現値確認に使えます。([Git]2)GitHub REST API の
Get a branchでも branch のcommit.shaは取得できますが、hook 内で GitHub API を使う場合は gh CLI の-f/--fieldが payload parameter 追加時に POST に切り替わる仕様に注意が必要です。read-only のつもりでgh api -f ...を使うと write-method になり得るため、remote read はgit ls-remote --exit-code origin refs/heads/<branch>を第一候補にするのが安全です。([GitHub Docs]3) ([GitHub Docs]3) ([GitHub CLI]4)修正要求: policy は
expected_remote_headと freshcurrent_remote_headを比較する。fresh read 不可はcurrent_remote_head_unavailableで safety stop。env のLOOP_PUBLISH_EXPECTED_REMOTE_HEADは「期待値」であって「現値」ではない、という扱いにする。Blocker 4: post-push readback がないと「許可」は完結しない
PreToolUse は push 実行前の gate です。push 後に remote branch が本当に
local_headへ進んだことは、PreToolUse だけでは確認できません。Git push output には machine-readable な--porcelain形式があり、push status は成功・強制更新・delete・reject などを区別できますが、最終的な remote ref の証明には push 後の remote readback が必要です。([Git]1)修正要求: #1408 の完了条件に次を追加する。
PreToolUse 内で postcondition を実行できないなら、
PUBLISH_LANE_DECISION_V1にrequired_postconditionを出し、実際の publish workflow 側で readback を必須化する。readback が別 Issue に逃げる場合、#1408 は「allow bridge のみ」であり「publish lane 完成」とは言えません。Blocker 5: Hook output / boundary_layer の taxonomy が足りない
remote_write_requires_approvalは現在、PreToolUse では deny、PermissionRequest では no output/no_decision というイベント別挙動になっています。#1408 で追加する reason は、単なる
remote_write_requires_approvalの変種ではなく、少なくともboundary_layerを持つべきです。Claude hook の仕様でも、PreToolUse の blocking は exit code 2 / hook output により tool call を止める性質を持つため、どの layer が止めたのかを診断できないと agent が誤復旧します。([Claude Platform Docs]5)推奨 schema:
Blocker 6: repair hint が危険に弱い
hook_repair_hints.pyのpush_refspec_requires_active_branchは、rtk git push origin HEAD:refs/heads/<active-branch>とgit branch --show-currentしか示しません。これは #1241 の bounded shape 修復には十分でも、#1402/#1408 の stale remote head / mixed contamination には不十分です。
git branch --show-currentだけでは remote head drift も Allowed Paths provenance も検出できません。修正要求: #1408 では
push_refspec_requires_active_branchを再利用して publish stop を表現しない。新 reason を追加する。Blocker 7: open-pr は publish lane ではない
open-prskill は PR body validator、linked issue state、idempotency、gh pr createを担当します。branch publish そのものは実装しておらず、gh pr createfailure 時はE_GH_FAILUREを返すだけです。したがって #1408 の docs で open-pr を publish lane の主体に見せると責務境界が崩れます。必要なら
open_pr.pyではなく、publish lane 専用 wrapper / policy / workflow step を作るべきです。実装案
最小で安全にするなら、次の 3 層に分けるべきです。
Policy layer:
scripts/agent-guards/git_mutation_command_policy.pyにclassify_publish_lane_push(...)を追加する。ここで exact argv、禁止 refspec、active branch、destination guard、fresh remote head、local/declared/verified head、Allowed Paths gate を判定する。Python のsubprocessは shell を暗黙起動せず、argv sequence を渡せば shell metacharacter を shell 解釈させないので、policy 内のgit呼び出しは必ずsubprocess.run([...], shell=False, timeout=...)にする。([Python documentation]6)Codex adapter layer:
codex-hook-adapter.mjsは remote write 分類の直前に policy executable を呼ぶ。結果がallowなら stdout 無しで通過、safety_stopなら PreToolUse deny。policy error / timeout / malformed result は genericremote_write_requires_approvaldeny に戻す。execFileSyncを使う場合も shell string にせず、process.execPathと script argv の配列呼び出しに限定する。Workflow/postcondition layer: push 後に
git ls-remote --exit-code origin refs/heads/<branch>を再実行し、remote head がlocal_headと一致することをPUBLISH_POST_PUSH_READBACK_V1として残す。PreToolUse だけで publish 成功を主張しない。最小テストマトリクス
tests/session_recording/codex/test_hook_adapter.pyには、actual Node entrypoint を叩くrun_adapterが既にあるため、#1408 の AC5 はここで満たすべきです。追加すべきテスト:
既存 tests は direct
git pushとgit -C ... pushの deny を確認していますが、positive publish lane と mismatch safety stop は未実装です。Definition of Done
#1408 を通してよい条件は次です。
codex-hook-adapter.mjsに独自 JS allowlist を作らず、共有 policy の JSON decision を消費するだけにする。rtk git push origin HEAD:refs/heads/<active-branch>以外はすべて deny。main/master/ force / tags / all / mirror / delete /+refspec / wrapper / direct git は deny。git ls-remote等で取得し、expected_remote_head == current_remote_headを必須化する。local_head == declared_publish_head == verified_headとallowed_paths_gate_status == okを必須化する。PUBLISH_LANE_DECISION_V1とPUBLISH_SAFETY_STOP_REPORT_V1を machine-readable に出す。現状の #1408 は「実装すべきだが、Issue 本文をもう一段強くしないと危険」です。特に fresh remote head と post-push readback が入らない実装は、#1402 で問題になった remote drift / mixed contamination を再発させます。
squne121 commentedon Jul 10, 2026
Refinement Loop: Human Escalation Required
The loop has terminated and requires human review. Cause: human judgment required
human_escalationhuman_judgment_requiredBlockers
squne121 commentedon Jul 10, 2026
妥当
squne121 commentedon Jul 10, 2026
注意: これはエージェントによる代理投稿です。
以下は OWNER
squne121が #1408 (comment) (本文: 「妥当」、投稿時刻: 2026-07-10T11:53:20Z、authorAssociation: OWNER。Claude Code control-plane 自身のgh認証で直接取得・検証済み)で示した scope 拡張の承認意思表示を、issue-refinement-loopのANCHOR_SCOPE_REFRAME_V1スキーマに従って機械可読形式で記録するものです。この投稿自体は squne121 本人が書いたものではなく、Claude Code エージェントが承認内容を構造化形式で転記した代理記録です。squne121 commentedon Jul 10, 2026
Refinement Loop: Approved
The issue has been approved and is ready for implementation.
approvedsqune121 commentedon Jul 11, 2026
Contract Review Result
fix: session-recording-policy.md の #1428 見出しに日本語補足を追加
fix: harden publish lane approval bridge against adversarial review f…
fix: F841 未使用変数を除去 (#1408)
fix: publish lane テストを ls_remote 限定 policy に整合させる (#1408)
fix: PreToolUse remote write classifier を command structure 解析ベースに置き換…
merge: resolve conflicts with main for PR #1442
feat: PreToolUse remote_write_requires_approval を publish lane 証跡で通過可…
chore: 未配線の external trust root(scripts/trust-root/)を削除する (#1469) (#1471