Skip to content

実装: agent publish lane の手動介入依存を解消する #1402

Closed
1 of 1 issue completed
Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#1395"
goal_ref: "agent の branch publish 操作が hook / approval 境界または remote head drift で止まったとき、手動 remote 更新へ暗黙フォールバックせず deterministic な publish lane 判定または safety stop へ誘導する"
implementation_mode: docs_and_policy_only
change_kind: workflow
preflight_scope: implementation
runtime_verification:
  required: true
  mode: immediate
  evidence_type: hook-policy-tests

Parent Issue

#1395

Parent Goal Ref

Current Validated Scope

  • branch publish 失敗時の boundary_layer、reason_code、repair hint、publish lane 判定、safety stop report を扱う。
  • impl-review-loop / open-pr / hook docs から、手動 remote 更新へ暗黙フォールバックしない運用を明文化する。
  • remote head drift、local head mismatch、reviewed head mismatch、mixed head contamination を検出した場合は、自動 force update せず safety stop に倒す。
  • docs_and_policy_only として reason_code alignment、repair hint alignment、hook policy regression、safety stop report schema を実装する。

Remaining Parent Gaps

Outcome

agent が branch publish で止まった場合、CI pass/fail だけで安全扱いせず、expected_remote_head / current_remote_head / local_head / verified_head / allowed_paths_gate_status を比較して PUBLISH_LANE_DECISION_V1 を出す。条件が揃う場合だけ bounded publish lane を案内し、remote head に unrelated commit が混入した場合や head provenance が不明な場合は PUBLISH_SAFETY_STOP_REPORT_V1 を残して停止する。

In Scope

  • publish failure reason を boundary_layer と reason_code に分離し、docs / tests / hook stderr の machine-readable block で一致させる。
  • impl-review-loop の publish 失敗後手順に、fetch/readback、expected/current/local head comparison、allowed publish lane decision、post-publish readback、safety stop report の順序を明記する。
  • open-pr の正本に、PR 作成失敗時の branch publish preflight / failure report の参照先を明記する。
  • hook policy tests で、raw remote write、unsafe wrapper route、wrong remote、wrong branch、force route、stale remote head、mixed head contamination が block されることを固定する。
  • allowed publish lane は remote / branch / expected head / local head / reviewed head が一致する場合にだけ案内する。
  • publish 用 repair hint は push_refspec_requires_active_branch をそのまま流用せず、remote head 照合を要求する reason_code / safe_action / stop_condition を持つ。
  • human intervention が必要な場合の監査メモ形式に redacted_command、boundary_layer、reason_code、expected_remote_head、current_remote_head、local_head、required_decision を含める。

Out of Scope

Acceptance Criteria

  • AC1: publish failure reason は boundary_layer と reason_code を分離し、docs / tests / hook stderr の machine-readable block で一致している。
  • AC2: impl-review-loop は publish failure 後に fetch/readback、expected/current/local head comparison、allowed publish lane decision、post-publish readback、safety stop report の順序を明記している。
  • AC3: raw remote write、force route、unsafe wrapper、wrong remote、wrong branch は Claude/Codex parity hook tests で block される。
  • AC4: allowed publish lane は remote == origin、active_branch == target_branch、expected_remote_head == current_remote_head、local_head == declared_publish_head、local_head == reviewed_head の全条件が満たされた場合だけ allowed_command を出す。
  • AC5: current remote head に unrelated commit が混入した場合は force update も reset も実行せず、PUBLISH_SAFETY_STOP_REPORT_V1 を出す。
  • AC6: human intervention audit memo は redacted_command、boundary_layer、reason_code、expected_remote_head、current_remote_head、local_head、verified_head、required_decision を含む。
  • AC7: open-pr 側の記述は実在する SKILL.md / open_pr.py 正本に揃い、存在しない step file を前提にしない。

Publish Lane Decision Schema

PUBLISH_LANE_DECISION_V1:
  status: allow_retry | safety_stop
  publish_failure_reason:
    boundary_layer:
      - claude_pretooluse_exit2
      - codex_pretooluse_deny
      - codex_permission_request_no_decision
      - worktree_scope_guard_denied
      - git_remote_rejected
    reason_code:
      - remote_write_requires_approval
      - hook_policy_denied
      - permission_request_no_decision
      - branch_mismatch
      - stale_remote_head
      - local_head_mismatch
      - mixed_head_contamination
      - unsafe_wrapper_route
  issue_number: 1402
  pr_number: "<number>"
  branch: "<branch>"
  remote: origin
  expected_remote_head: "<sha>"
  current_remote_head: "<sha>"
  local_head: "<sha>"
  verified_head: "<sha>"
  declared_publish_head: "<sha>"
  allowed_paths_gate_status: ok | fail_closed | indeterminate
  allowed_command: null | "rtk git push origin HEAD:refs/heads/<branch>"
  postcondition: "remote branch head == local_head"
  required_human_decision: []

Safety Stop Report Schema

PUBLISH_SAFETY_STOP_REPORT_V1:
  status: safety_stop
  issue_number: 1402
  pr_number: "<number>"
  redacted_command: "<command>"
  boundary_layer: "<layer>"
  reason_code: "<reason>"
  expected_remote_head: "<sha>"
  current_remote_head: "<sha>"
  local_head: "<sha>"
  verified_head: "<sha>"
  allowed_paths_gate_status: ok | fail_closed | indeterminate
  required_decision:
    - "PR branch を linked issue 専用 head へ戻す"
    - "混入 commit を別 PR / 別 branch へ退避する"

Runtime Verification Applicability

runtime_verification_applicability:
  decision: immediate
  reason: "hook policy / skill workflow の allow/block/reason_code/repair hint はローカルテストと docs grep で即時検証できる"
  applicable_acs:
    - AC1
    - AC2
    - AC3
    - AC4
    - AC5
    - AC6
    - AC7
  execution_environment: "local WSL2 Ubuntu 24.04 / repo hook tests"
  skip_conditions:
    - "ローカル依存関係が欠落し、hook test harness 自体が起動できない場合"
    - "Stop Conditions に該当する GitHub credential policy 変更が必要と判明した場合"
  fallback_policy: "publish lane の自動化が権限境界変更または dispatch 実装を要求する場合は停止し、別 Issue に分離する"
  artifact_requirements:
    - "hook policy test output"
    - "skill docs grep output"
    - "repair hint assertion"
    - "publish lane decision fixture"

Verification Commands

# AC1
$ rg -n "publish_failure_reason" .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md docs/dev/hook-boundaries.md docs/dev/agent-skill-boundaries.md scripts/agent-guards/hook_repair_hints.py
$ rg -n "boundary_layer" .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md docs/dev/hook-boundaries.md docs/dev/agent-skill-boundaries.md scripts/agent-guards/hook_repair_hints.py
$ rg -n "worktree_scope_guard_denied" .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md .claude/hooks/worktree_scope_guard.py docs/dev/hook-boundaries.md scripts/agent-guards/hook_repair_hints.py

# AC2
$ rg -n "expected_remote_head" .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md docs/dev/hook-boundaries.md docs/dev/workflow.md
$ rg -n "PUBLISH_LANE_DECISION_V1" .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md docs/dev/hook-boundaries.md docs/dev/workflow.md

# AC3
$ rg -n "unsafe_wrapper_route" .claude/hooks/worktree_scope_guard.py .claude/hooks/tests/test_worktree_scope_guard.py tests/codex/test_local_main_branch_guard.py scripts/agent-guards/git_mutation_command_policy.py scripts/agent-guards/tests/test_git_mutation_command_policy.py
$ rg -n "stale_remote_head" .claude/hooks/worktree_scope_guard.py .claude/hooks/tests/test_worktree_scope_guard.py tests/codex/test_local_main_branch_guard.py scripts/agent-guards/git_mutation_command_policy.py scripts/agent-guards/tests/test_git_mutation_command_policy.py
$ rg -n "mixed_head_contamination" .claude/hooks/worktree_scope_guard.py .claude/hooks/tests/test_worktree_scope_guard.py tests/codex/test_local_main_branch_guard.py scripts/agent-guards/git_mutation_command_policy.py scripts/agent-guards/tests/test_git_mutation_command_policy.py

# AC4
$ rg -n "declared_publish_head" .claude/hooks/worktree_scope_guard.py .claude/hooks/tests/test_worktree_scope_guard.py tests/codex/test_local_main_branch_guard.py scripts/agent-guards/git_mutation_command_policy.py scripts/agent-guards/tests/test_git_mutation_command_policy.py
$ rg -n "allowed_command" .claude/hooks/worktree_scope_guard.py .claude/hooks/tests/test_worktree_scope_guard.py tests/codex/test_local_main_branch_guard.py scripts/agent-guards/git_mutation_command_policy.py scripts/agent-guards/tests/test_git_mutation_command_policy.py

# AC5
$ rg -n "PUBLISH_SAFETY_STOP_REPORT_V1" .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md docs/dev/hook-boundaries.md docs/dev/agent-skill-boundaries.md scripts/agent-guards/git_mutation_command_policy.py scripts/agent-guards/tests/test_git_mutation_command_policy.py
$ rg -n "mixed_head_contamination" .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md docs/dev/hook-boundaries.md docs/dev/agent-skill-boundaries.md scripts/agent-guards/git_mutation_command_policy.py scripts/agent-guards/tests/test_git_mutation_command_policy.py

# AC6
$ rg -n "redacted_command" .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md docs/dev/hook-boundaries.md docs/dev/agent-skill-boundaries.md scripts/agent-guards/hook_repair_hints.py
$ rg -n "required_decision" .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md docs/dev/hook-boundaries.md docs/dev/agent-skill-boundaries.md scripts/agent-guards/hook_repair_hints.py

# AC7
# baseline-expect: pass
$ rg -n "open_pr.py" .claude/skills/open-pr/SKILL.md .claude/skills/open-pr/scripts/open_pr.py
# baseline-expect: pass
$ rg -n "E_GH_FAILURE" .claude/skills/open-pr/SKILL.md .claude/skills/open-pr/scripts/open_pr.py

Allowed Paths

  • .claude/skills/impl-review-loop/SKILL.md
  • .claude/skills/impl-review-loop/steps/preparation.md
  • .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md
  • .claude/skills/open-pr/SKILL.md
  • .claude/skills/open-pr/scripts/open_pr.py
  • .claude/hooks/worktree_scope_guard.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
  • scripts/agent-guards/local_main_branch_guard.py
  • scripts/agent-guards/git_mutation_command_policy.py
  • scripts/agent-guards/tests/test_git_mutation_command_policy.py
  • scripts/agent-guards/hook_repair_hints.py
  • docs/dev/hook-boundaries.md
  • docs/dev/agent-skill-boundaries.md
  • docs/dev/workflow.md

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • GitHub credential / OAuth / organization policy の変更が必要と判明した場合
  • branch force update の自動実行が必要と判明した場合
  • actual worker dispatch implementation の追加が必要と判明した場合
  • rtk 本体や外部 executor の仕様変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合

Required Skills

  • Hook policy
  • Agent workflow

Required Design References

  • .claude/skills/impl-review-loop/SKILL.md
  • .claude/skills/open-pr/SKILL.md
  • .claude/hooks/worktree_scope_guard.py
  • docs/dev/hook-boundaries.md
  • docs/dev/agent-skill-boundaries.md
  • scripts/agent-guards/git_mutation_command_policy.py
  • scripts/agent-guards/hook_repair_hints.py

Scope Delta

Delivery Rule

  • 1 Issue = 1 PR
  • 作業前に issue-contract-review で fresh CONTRACT_REVIEW_RESULT_V1 status: go を取得する。
  • human intervention を完全に隠すのではなく、必要時は deterministic な安全停止と監査メモを残す。

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added
    phase/implementation
    agent/implementer
    enhancement
    on Jul 8, 2026
  2. squne121 commented on Jul 8, 2026

    @squne121
    OwnerAuthor

    敵対的レビュー結果: REQUEST_CHANGES

    GitHub には投稿していません。#1402 自体にはコメントがなく、実質的な根拠は親 Issue #1395、PR #1399、特に PR #1399 の remote head drift コメントにあります。#1402 は「publish が hook / approval 境界で止まった場合に、手動 remote 更新へ流れず、deterministic retry または safety stop に誘導する」Issueですが、現状の契約のままだと false-green になる可能性が高いです。

    Blocker 1: Allowed Paths が enforcement 点とずれている

    #1402 の AC4 は「許可された publish lane は、対象 branch / remote / expected head が一致する場合にだけ案内される」です。しかし実際の rtk git push 認可は scripts/agent-guards/git_mutation_command_policy.py が担っており、このファイルは #1402 の Allowed Paths に含まれていません。現行 policy は意図的に狭い exact shape parser で、rtk git add/commit/push だけを認識し、それ以外を fail-closed にする設計です。

    現在の push 判定は、禁止 flag、origin、HEAD:refs/heads/<branch>、branch 名 regex、必要時の current branch 一致だけを見て、最後に rtk_git_push_allowed を返します。remote head readback、expected head、post-push verification、unrelated commit contamination は見ていません。

    さらに worktree_scope_guard.py は classify_rtk_git_mutation(... require_active_branch_push=True) の結果が allow で、issue worktree 解決と cwd containment が通れば _allow() します。つまり、現時点の実 enforcement は「local branch / refspec lane」までであり、「remote expected-head lane」ではありません。

    要求修正: #1402 はこのままでは AC4 を実装できません。scripts/agent-guards/git_mutation_command_policy.py と scripts/agent-guards/tests/test_git_mutation_command_policy.py を Allowed Paths に追加するか、#1402 を docs/tests/hints-only Issue に縮退し、remote-head enforcement は follow-up Issue に分割してください。現状の Allowed Paths のまま「expected head が一致する場合にだけ案内」と書くと、実装が伴わない claim になります。

    Blocker 2: #1399 の事故原因を “permission boundary” に矮小化している

    #1402 の parent gap は、単なる remote_write_requires_approval ではありません。PR #1399 では、intended verified head 548a586... に対して current remote head が a8e7e3... に進み、#1395 Allowed Paths 外の #1381 delegation-audit 変更が混入した、という remote_head_scope_contamination が記録されています。required human decision も「PR branch を #1395 専用 head へ戻す」または「#1381 混入を別 PR / 別 branch へ退避する」でした。

    その後、current head a8e7e3... で verification / CI は PASS になっていますが、これは「テストが通った」だけで、「linked issue の Allowed Paths と PR branch provenance が正しい」ことを意味しません。PR #1399 の最終 PR body も current head a8e7e3... で 9/9 PASS とし、changed files は #1395 の 5 files としていますが、前段の contamination report と緊張関係があります。

    要求修正: safety stop の判定は「CI pass/fail」ではなく、少なくとも次の比較を正本にすべきです。

    PUBLISH_LANE_DECISION_V1:
      status: allow_retry | safety_stop
      reason_code:
        - hook_policy_denied
        - permission_request_no_decision
        - branch_mismatch
        - stale_remote_head
        - local_head_mismatch
        - mixed_head_contamination
        - unsafe_wrapper_route
      issue_number: 1402
      pr_number: <number>
      branch: <branch>
      remote: origin
      expected_remote_head: <sha>
      current_remote_head: <sha>
      local_head: <sha>
      verified_head: <sha>
      allowed_paths_gate_status: ok | fail_closed | indeterminate
      allowed_command: null | "rtk git push origin HEAD:refs/heads/<branch>"
      postcondition: "remote branch head == local_head"
      required_human_decision: []

    Remote head readback は git ls-remote で remote refs と commit IDs を読むか、GitHub branch API の commit.sha を読む方式に寄せられます。(Git)

    Blocker 3: repair hint が危険に単純すぎる

    hook_repair_hints.py は push_refspec_requires_active_branch の場合、safe action を「active branch と一致する refspec だけを使う」とし、suggested command を rtk git push origin HEAD:refs/heads/<active-branch>、verification command を git branch --show-current にしています。

    これは #1402 の要求より弱いです。branch 名が合っていても、remote branch が別 commit に進んでいる、remote head に unrelated commit が混入している、local head が reviewed head と違う、というケースを防げません。#1402 の事故はまさにこの種の問題です。

    要求修正: push_refspec_requires_active_branch をそのまま publish retry hint に使わないでください。publish 用には別 reason code を切るべきです。

    HOOK_COMMAND_REPAIR_HINT_V1:
      blocked_command_class: "rtk_git_push"
      reason_code: "stale_remote_head"
      safe_action: "remote head と expected head を照合し、一致時のみ bounded publish lane を再試行する"
      suggested_command: ""
      verification_command: "git ls-remote origin refs/heads/<branch>"
      forbidden_alternatives:
        - "git push --force"
        - "git push origin <branch>"
        - "bash -lc 'git push ...'"
        - "rtk run git push ..."
      stop_condition: "expected_remote_head != current_remote_head の場合は safety stop"

    Git の通常 push は fast-forward であれば履歴を失いませんが、remote ref の破壊的な上書きには --force または + refspec が関わります。--force-with-lease=<refname>:<expect> は expected value を使って remote ref を保護できますが、#1402 は branch force update の自動実行を out-of-scope にしているため、自動実行ではなく human decision route としてだけ文書化するのが妥当です。([Git]2)

    Blocker 4: テスト対象が local_main_branch_guard に寄りすぎている

    #1402 は hook policy tests で raw publish route と unsafe wrapper route を block するとしていますが、実 publish lane は local main root ではなく issue worktree 内の worktree_scope_guard.py 経由で allow されます。local_main_branch_guard.py 側だけに negative tests を足しても、publish lane の positive/negative 判定は保証できません。

    Claude Code hooks の公式仕様上、PreToolUse は exit code 2 で tool call を block し、それ以外の多くの非ゼロは non-blocking error です。したがって unit-level 関数テストだけではなく、hook stdin JSON → stderr / exit behavior まで含む regression が必要です。([Claude Platform Docs]3)

    要求修正: 少なくとも以下を追加してください。

    Claude hook side:
    - worktree_scope_guard: rtk git push origin HEAD:refs/heads/<active-branch> allowed only when:
      - issue worktree is uniquely resolved
      - cwd is inside expected worktree
      - local branch == target branch
      - expected_remote_head == current_remote_head
      - local_head == reviewed_head or declared publish head
    
    - worktree_scope_guard: deny cases:
      - raw git push
      - git push --force
      - rtk git push origin main
      - rtk git push origin HEAD:refs/heads/other
      - bash -lc 'rtk git push ...'
      - stale remote head
      - mixed head contamination
    
    Codex parity:
    - same reason_code / repair hint assertions
    - no raw command / token leakage in denial output
    

    git merge-base --is-ancestor は ancestry check に使えますし、git rev-list A..B は B から到達可能で A から到達不能な commit set を列挙できます。mixed commit contamination の検出には、remote head と verified head の ancestry と、rev-list で出る追加 commit の path scope を組み合わせるのが堅いです。([Git]4)

    Blocker 5: remote_write_requires_approval の意味が Codex と Claude で混ざる

    Codex adapter には git push を remote_write_requires_approval と分類する処理があります。 ただし現行の adapter は remote write を evaluateGuard() 内で action: no_decision として返し、PreToolUse では deny、PermissionRequest では remote_write_requires_approval だけ no-decision として何も emit しない設計です。

    つまり #1402 の reason code に remote_write_requires_approval だけを置くと、「PreToolUse hook denial」「PermissionRequest no_decision」「Claude hook exit 2 denial」「worktree policy denial」が混同されます。

    要求修正: reason code は層を分けるべきです。

    publish_failure_reason:
      boundary_layer:
        - claude_pretooluse_exit2
        - codex_pretooluse_deny
        - codex_permission_request_no_decision
        - worktree_scope_guard_denied
        - git_remote_rejected
      reason_code:
        - remote_write_requires_approval
        - stale_remote_head
        - branch_mismatch
        - unsafe_wrapper_route
        - mixed_head_contamination

    Blocker 6: open-pr の正本と #1402 Allowed Paths が噛み合っていない

    #1402 の Allowed Paths には .claude/skills/open-pr/steps/publish-and-open.md が入っていますが、この確認では該当ファイルを取得できませんでした。一方、取得できた open-pr 正本は SKILL.md で、PR 作成は open_pr.py wrapper に集約されています。

    open-pr は gh pr create --head <branch> --base main を呼ぶだけで、branch publish 自体の deterministic retry lane は記述していません。失敗時の E_GH_FAILURE も「権限 / ブランチ存在 / remote push 済みを確認」に留まります。

    要求修正: open-pr 側に publish preflight / failure report を入れるなら、実在する SKILL.md に入れるべきです。存在しない step file を Allowed Paths に残すと、実装者が無効な path を編集しようとして Stop Conditions に落ちます。

    Blocker 7: impl-review-loop は現時点で dispatch 実装を足せない制約を持つ

    impl-review-loop の Step 5 は required_auto_actions を worker に委譲する routing を書いていますが、child-4 / #631 が open の間は dispatch 実行コードを追加せず docs-only mode に留める、と明記されています。

    したがって #1402 が「deterministic retry」を本当に自動化するなら、#631 との依存関係を解決するか、今回の outcome を「retry 手順と safety stop report の deterministic documentation + hook test」に限定する必要があります。

    要求修正: #1402 の Outcome を次のどちらかに明確化してください。

    implementation_mode: docs_and_policy_only
    allowed_effect:
      - reason_code alignment
      - repair hint alignment
      - hook policy test regression
      - safety stop report schema
    disallowed_effect:
      - actual worker dispatch implementation
      - automatic force update

    または:

    implementation_mode: publish_dispatch_enabled
    requires:
      - #631 completed
      - allowed_paths expanded
      - executor implementation path added

    現状のまま「手動介入依存を解消」と書くと、docs-only 制約と衝突します。

    Web 検索に基づく実装品質化提案

    安全な publish lane は「read → compare → bounded write → readback」の 4 段にしてください。

    1. read:
       git ls-remote origin refs/heads/<branch>
       または GitHub Branch API で current_remote_head を取得
    
    2. compare:
       expected_remote_head == current_remote_head
       local_head == reviewed_head または declared_publish_head
       branch == active_branch == target_branch
       remote == origin
    
    3. bounded write:
       rtk git push origin HEAD:refs/heads/<branch>
       ※ non-force only
       ※ force-with-lease は human decision route の説明に留める
    
    4. readback:
       remote branch head == local_head
       mismatch なら safety_stop
    

    Python wrapper を実装する場合は、shell string ではなく argv list + shell=False を使うべきです。Python 公式 docs は、subprocess は暗黙に system shell を呼ばないため shell metacharacters を安全に child process へ渡せるが、shell=True を明示した場合は shell injection を避ける quoting 責任がアプリ側に来る、と説明しています。([Python documentation]5)

    shlex は tokenization / shell quoting の補助には使えますが、Unix shell 向けであり、非 POSIX shell や Windows shell では injection risk が残るため、実行は subprocess.run([...], shell=False) へ寄せるべきです。([Python documentation]6)

    gh api -f / -F は request payload parameter を追加し、通常 POST に切り替わるため、raw gh api -f body=... を read-only と扱ってはいけません。これは #1399 で直した分類 drift と同じ種類の regression surface です。([GitHub CLI]7)

    具体的な修正案

    #1402 の AC をこの形に寄せるのがよいです。

    AC1:
      publish failure reason_code は boundary_layer と reason_code を分離し、
      docs / tests / hook stderr の machine-readable block で一致する。
    
    AC2:
      impl-review-loop は publish failure 後に
      fetch/readback -> expected/current/local head compare -> allowed publish lane decision ->
      post-publish readback -> safety stop report
      の順序を明記する。
    
    AC3:
      raw git push, git push --force, unsafe wrapper, wrong remote, wrong branch は
      Claude/Codex parity hook tests で block する。
    
    AC4:
      allowed publish lane は
      remote == origin,
      active_branch == target_branch,
      expected_remote_head == current_remote_head,
      local_head == declared_publish_head
      の全条件が満たされた場合だけ suggested_command を出す。
    
    AC5:
      current_remote_head に unrelated commit が混入した場合は
      force update も reset も実行せず、PUBLISH_SAFETY_STOP_REPORT_V1 を出す。
    
    AC6:
      human intervention audit memo は
      redacted_command, reason_code, boundary_layer, expected_remote_head,
      current_remote_head, local_head, required_decision を含む。

    結論

    この Issue は方向性は正しいですが、現行のまま実装に入ると「repair hint と grep は増えたが、実 publish lane は expected head を見ていない」という状態になり得ます。最優先の修正は、Allowed Paths を enforcement 点へ広げること、remote_write_requires_approval を境界層別に分解すること、そして #1399 の実事故である remote_head_scope_contamination を primary test case にすることです。

  3. squne121 commented on Jul 8, 2026

    @squne121
    OwnerAuthor

    Refinement Loop: Approved

    The issue has been approved and is ready for implementation.

  4. squne121 commented on Jul 9, 2026

    @squne121
    OwnerAuthor

    Contract Review Result

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-07-09T12:56:03Z"
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/1402
      body_sha256: "sha256:695ed768b597bf753eddf7ab320773ecf26584d1e4b6741213adc4ccb72e084f"
      checks:
        readiness: go
        blockers: pass
        product_spec: pass
        vc_preflight: pass
      source: ensure_contract_snapshot_auto
  5. squne121 commented on Jul 10, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (2026-07-10T12:14:21Z)

    • iteration: 2
    • verdict: APPROVE
    • merge_ready: true
    • required_auto_actions: []
    • PR: fix: agent publish lane safety stop (#1402) #1410
    • reviewed_head_sha: 4ae91f5388d8d3f4885058c8b79c10241d112d5c
    • 次アクション: 人間レビュー → マージ → post-merge-cleanup
    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      draft_pr_ready: true
      github_merge_ready: true
      merge_ready: true
      github_merge_state_status: CLEAN
      pr_url: "https://github.com/squne121/loop-protocol/pull/1410"
      head_sha: "4ae91f5388d8d3f4885058c8b79c10241d112d5c"
      issue_number: 1402
      termination_reason: approved
      iteration: 2
      required_auto_actions: []
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: impl-review-loop
      follow_up_issues: []
      note_only_observations: []
    
    ISSUE_SCOPE_ROLLUP_DECISION_V2:
      schema_version: 2
      recorded_at: "2026-07-10T12:14:21Z"
      rollup_plan_ref:
        body_sha256: null
        generated_at: null
      decision: skipped
      executed_actions: []
      skipped_reason: "このループでは scope rollup preflight を実行していないため"
      candidates_reviewed: []
  6. squne121 commented on Jul 10, 2026

    @squne121
    OwnerAuthor

    post-merge-cleanup: 完了 (2026-07-10T12:21:29Z)

    POST_MERGE_CLEANUP_REPORT_V1:
      schema_version: 1
      status: ok
      merged_pr_number: 1410
      linked_issue_number: 1402
      pr_state:
        state: MERGED
        merged_at: "2026-07-10T12:18:07Z"
        merge_commit: "ce6df511a08d87852168b4b03fa94d65100b04ab"
        head_ref_name: "worktree-issue-1402-agent-publish-lane"
        head_ref_oid: "4ae91f5388d8d3f4885058c8b79c10241d112d5c"
      actions_taken:
        - main_synced
        - worktree_removed
        - local_branch_removed
        - remote_branch_absent_confirmed
      cleaned_worktrees:
        - "/home/squne/projects/LOOP_PROTOCOL/.claude/worktrees/issue-1402-agent-publish-lane"
      cleaned_branches:
        - "worktree-issue-1402-agent-publish-lane"
      unresolved_cleanup_items: []
      parent_issue_status:
        recommended_action: null
        reason: "linked issue #1402 is already CLOSED/completed and no parent close action was applicable"
      superseded_prs: []
      human_review_required: false
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: post-merge-cleanup
      follow_up_issues: []
      note_only_observations:
        - dedupe_key: "post-merge-cleanup-1410-linked-pr-search-1419"
          source_url: "https://github.com/squne121/loop-protocol/pull/1419"
          source_note_id: "linked-search-candidate"
          summary: "linked:issue/1402 search also surfaced PR #1419, but live readback shows it closes #1385, so it is not a superseded PR for #1402."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/implementerenhancementphase/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions