Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "Issue metadata mutation を worktree 境界から分離し、controlled executor lane で決定論的に実行できる状態にする"
change_kind: mixedParent Issue
なし(単独改善)
Parent Goal Ref
- Goal: Issue 本文修正・Contract Snapshot 投稿などの GitHub metadata mutation を、repo 作業木 mutation と同じ worktree 境界で扱わない
- Desired Destination: metadata mutation は controlled executor lane、file mutation は worktree lane という二層構造の確立
Current Validated Scope
scripts/agent-guards/controlled_skill_mutation_policy.pyにissue_body.update/issue_comment.publish/contract_snapshot.publishの command id を追加(command id ごとに個別 input schema・precondition・postcondition を持つ)scripts/agent-guards/controlled_skill_mutation_exec.pyに対応する実行経路と readback 検証・stale-write 防止を追加contract_snapshot.publishの実 publisher authority を.claude/skills/impl-review-loop/scripts/ensure_contract_snapshot.pyに固定し、executor からshell=Falseargv で呼び出す.claude/hooks/worktree_scope_guard.pyに controlled executor 経由の metadata mutation を allow する exact command class を追加.claude/skills/issue-contract-review/SKILL.mdから worktree 作成経路を排除し、controlled executor lane を明記- 上記の adversarial テスト追加(must-block / must-allow 両軸、実 PreToolUse hook 経路)
Remaining Parent Gaps
edit-issue/issue-authorの手順全体を transaction script 化する変更は 実装: edit-issue transaction script を追加し issue-author の shell 手順と context load を削減する #1287 で扱う(本 Issue の executor lane に依存)- PreToolUse hook chain の read-only fast-path / telemetry dedupe 最適化は 実装: PreToolUse hook の read-only / exact-executor fast-path と telemetry dedupe を追加する #1289 で扱う
local_main_branch_guard.pyの既存 rawgh issue edit/commentallowlist の deprecate は follow-up Issue で扱う
Outcome
issue-contract-review の Contract Snapshot 投稿と Issue body/comment mutation が、issue-specific worktree を作らず root/default branch から controlled executor(policy 検証 + stale-write 防止 + readback 付き)で実行でき、対応するテストが CI で PASS している状態。
Background
issue-contract-review は「実装直前の deterministic preflight」であり、guardrails に code edit / branch / PR / worktree を作らないと明記されている。それにもかかわらず、worktree_scope_guard.py が gh issue comment / gh issue edit を mutating command に分類し、active issue 解決済みで対応 worktree がない場合に fail-closed で block するため、metadata mutation のためだけに worktree へ入る運用が発生している。
controlled mutation executor は現状 termination_report.publish のみを扱い(scripts/agent-guards/controlled_skill_mutation_policy.py、ALLOWED_WRITE_ROOTS = ["artifacts/"])、input schema・binding・readback は termination report の形に結合している。この lane を Issue body update / comment publish / contract snapshot publish に拡張する。
Contract Snapshot 投稿の既存実体は .claude/skills/impl-review-loop/scripts/ensure_contract_snapshot.py にあり(run_contract_review_once.py は「API post は ensure_contract_snapshot.py が扱う」と明記)、body / updatedAt 再取得による stale check(stale_or_conflicting_snapshot)を既に実装している。本 Issue はこの publisher を executor lane に組み込み、direct 実行経路を production path から封鎖する。
また local_main_branch_guard.py には gh issue comment <N> --body-file tmp/... 等を条件付き allow する既存 lane があるが、本 Issue の成功経路の認可根拠としては使わない(責務差分を AC で固定する)。
In Scope
controlled_skill_mutation_policy.pyへの 3 command id(issue_body.update/issue_comment.publish/contract_snapshot.publish)追加。各 command は required repo binding / issue number binding / input file binding(artifacts/<issue_number>/issue-metadata/<command-id>/subtree 内のみ)/ command id ごとの個別 input schema 検証 / idempotency(body sha256 または marker readback)を持つcontrolled_skill_mutation_exec.pyの実行経路追加(mutation 後 readback 不一致は成功扱いしない、tracked diff 発生時は失敗、issue_body.updateは previous_body_sha256 / previous_updated_at の precondition 比較で stale-write を防止)contract_snapshot.publishは executor からensure_contract_snapshot.pyをsubprocess.run([...], shell=False)で呼び出す。--artifact-dirの任意指定は executor policy で束縛し、executor を経由しない direct--postは production path から排除するworktree_scope_guard.pyに controlled executor の exact command class allow を追加(rawgh issue edit/gh issue commentの block は維持)- executor の issue number binding は
--issue-number == input.issue_number+ repo/origin binding を必須とし、LOOP_ISSUE_NUMBERenv は存在する場合のみ一致必須(env 非存在は root 実行の正常系) issue-contract-review/SKILL.mdの Contract Snapshot 投稿手順を controlled executor 呼び出しに書き換え- 新テストの
.github/ci/python-test-plan.jsonへの登録
Out of Scope
edit-issue全手順の transaction script 化(実装: edit-issue transaction script を追加し issue-author の shell 手順と context load を削減する #1287)- PreToolUse hook chain の fast-path / telemetry dedupe(実装: PreToolUse hook の read-only / exact-executor fast-path と telemetry dedupe を追加する #1289)
local_main_branch_guard.pyの既存 raw gh allowlist の変更・deprecate(follow-up Issue)- reviewer replay / VC compiler 関連の変更
- GitHub 側 branch protection / CI 設定の変更
Runtime Verification Applicability
- decision: not_applicable
- reason: 全 AC が pytest による決定論的検証(実 PreToolUse hook 経路の subprocess 統合テストを含む)で CI 内に完結し、静的品質ゲート外の runtime 証跡を要しない
Acceptance Criteria
- AC1: Contract Snapshot 投稿が issue-specific worktree を作らず root/default branch から controlled executor で実行できる
- AC2:
issue_body.updateは input file が policy で許可されたartifacts/<issue_number>/issue-metadata/<command-id>/subtree 外の場合 fail-closed する - AC3: wrong repo / wrong issue number / absolute path /
../ symlink / schema mismatch は mutation 前に exit 2 で拒否される - AC4: mutation 後の readback で body hash または marker が一致しない場合、成功扱いにならない
- AC5:
worktree_scope_guard.pyの active issue + no matching worktree 状態で rawgh issue edit/gh issue commentは引き続き block され、controlled executor の exact command は allow される - AC6: tracked file に diff が出た場合 executor は失敗する
- AC7:
issue-contract-review/SKILL.mdに worktree 作成経路が残っておらず、metadata mutation は controlled executor lane と明記されている - AC8:
contract_snapshot.publishの実 publisher authority がensure_contract_snapshot.pyに固定されている。executor は同スクリプトをshell=Falseargv で呼び、--artifact-dirの任意 write 先指定は policy 検証済みの値のみ許可され、executor を経由しない direct--postがissue-contract-reviewproduction path に存在しないことが negative test で固定されている - AC9:
issue_body.updateは stale-write 防止を持つ。input のprevious_body_sha256/previous_updated_atが mutation 直前の readback と一致しない場合は mutation せず、mutation 後の body_sha256 が input のnew_body_sha256と一致しない限り success にしない。片側のみ一致するズレも success にしない - AC10: 3 command id は個別 input schema(
ISSUE_BODY_UPDATE_INPUT_V1/ISSUE_COMMENT_PUBLISH_INPUT_V1/CONTRACT_SNAPSHOT_PUBLISH_INPUT_V1)を fixture で固定し、command id と schema の不一致は mutation 前に deny される - AC11: input file namespace は
artifacts/に統一されている。policy registry / executor validation /issue-contract-review/SKILL.md/ tests の namespace 表記不一致は test fail になる - AC12:
issue-contract-reviewの production path は rawgh issue edit/gh issue commentを呼ばず、local_main_branch_guard.pyの既存 raw gh allowlist を成功経路の認可根拠として使わないことが test で固定されている - AC13: executor invocation と publisher invocation は argv-list /
shell=Falseのみを使い、bash -lc/sh -c/python -c/--body-file -(stdin)/ shell metachar / duplicate flags は mutation 前に deny される - AC14: readback / idempotency は false success を許さない。marker absent / duplicate marker / body hash mismatch / comment readback mismatch / GitHub API error(403・422・429)/ JSON parse failure / timeout は success にならない
- AC15: executor は
LOOP_ISSUE_NUMBERenv が存在しなくても--issue-number == input.issue_numberと repo binding が成立すれば実行でき、env が存在して--issue-numberと不一致の場合は mutation 前に拒否される
Verification Commands
# AC1
$ uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q
# AC2
$ uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q
# AC3
$ uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q
# AC4
$ uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q
# AC5
$ uv run --locked pytest .claude/hooks/tests/test_worktree_scope_guard_issue_metadata_executor.py -q
# AC6
$ uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q
# AC7
$ uv run --locked pytest .claude/skills/issue-contract-review/tests/test_contract_review_no_worktree_creation.py -q
# AC8
$ uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q
# AC9
$ uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q
# AC10
$ uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q
# AC11
$ uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q
# AC12
$ uv run --locked pytest .claude/skills/issue-contract-review/tests/test_contract_review_no_worktree_creation.py -q
# AC13
$ uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q
# AC14
$ uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -q
# AC15
$ uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py -qAllowed Paths
- scripts/agent-guards/controlled_skill_mutation_policy.py
- scripts/agent-guards/controlled_skill_mutation_exec.py
- scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py
- scripts/agent-guards/tests/test_controlled_skill_mutation_policy.py
- .claude/hooks/worktree_scope_guard.py
- .claude/hooks/tests/test_worktree_scope_guard_issue_metadata_executor.py
- .claude/skills/issue-contract-review/SKILL.md
- .claude/skills/issue-contract-review/tests/test_contract_review_no_worktree_creation.py
- .claude/skills/impl-review-loop/scripts/ensure_contract_snapshot.py
- .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py
- docs/dev/agent-skill-boundaries.md
- .github/ci/python-test-plan.json
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
なし
Scope Delta(任意)
N/A
Notes for Reviewer
- VC は check_vc_scope の bare path 規約(Allowed Paths と完全一致のみ narrow)に従い file-level 実行とする。AC ごとの対応テスト関数は以下を実装すること: AC1=
test_ac1_contract_snapshot_publish_from_root, AC2=test_ac2_input_file_outside_artifacts_subtree_fails_closed, AC3=test_ac3_binding_violations_rejected_before_mutation, AC4=test_ac4_readback_mismatch_not_success, AC5=test_ac5_raw_gh_issue_mutation_still_blocked, AC6=test_ac6_tracked_diff_fails_executor, AC7=test_ac7_skill_md_uses_controlled_executor_lane, AC8=test_ac8_contract_snapshot_publisher_authority_fixed, AC9=test_ac9_issue_body_update_stale_write_prevented, AC10=test_ac10_per_command_input_schema_enforced, AC11=test_ac11_input_namespace_unified_to_artifacts, AC12=test_ac12_production_path_uses_executor_only, AC13=test_ac13_argv_only_shell_false_enforced, AC14=test_ac14_readback_idempotency_no_false_success, AC15=test_ac15_env_binding_optional_but_must_match - fail-closed guard の変更を含むため、must-block / must-allow 両軸の adversarial テスト(実 PreToolUse hook 経路、stdin JSON + 実 git worktree)を必須とする
- 新テストは
.github/ci/python-test-plan.jsonへの登録まで含める - executor / publisher の GitHub mutation は
subprocess.run([...], shell=False, capture_output=True, text=True, timeout=...)のみを使い、hand-crafted shell string を組み立てない - negative matrix の最低ライン: unknown command id は mutation 前 exit 2 /
tmp/../x.json等の traversal deny / symlink・hardlink・absolute path・stdin-deny / input JSON の repo・issue_number・schema・body hash mismatch deny / marker duplicate の deterministic 分類 /gh issue commentの--delete-last・--edit-last・--web・--editor・--create-if-none・--yesは raw path・executor path 双方で deny /updatedAtのみ変化した stale ケースの block - 本 Issue は 実装: hooks: publish_termination_report 用 controlled mutation policy を分離する #1166(termination_report.publish executor)で後追い指摘された input-file resolution・issue_number 検証・readback/idempotency/import-origin 束縛の類型を contract に最初から含めている。実装: implement-issue の worktree bootstrap を controlled executor 化し、rtk/raw git policy 衝突を解消する #1209(worktree bootstrap executor)と同粒度で「direct route 封鎖」まで含めて閉じること
Activity
squne121 commentedon Jul 2, 2026
判定: REQUEST_CHANGES
方向性は正しいです。Issue #1284 は、
gh issue edit/commentのような GitHub metadata mutation を worktree lane から切り離し、issue_body.update/issue_comment.publish/contract_snapshot.publishを controlled executor lane に載せる設計です。Issue 本体は 2026-07-02 時点で open、コメントは 0 件でした。ただし、このまま実装すると false green になります。最大の問題は、Issue #1284 が「何を通すか」は書いている一方で、「既存のどの publisher 実体を置換・封鎖するか」「
tmp/とartifacts/の authority をどう統一するか」「issue body update の stale-write をどう防ぐか」が契約化されていない点です。P0-1:
contract_snapshot.publishの実体が Allowed Paths から漏れているIssue #1284 は
issue-contract-review/SKILL.mdの Contract Snapshot 投稿手順を controlled executor 呼び出しに書き換える、としています。 しかし、現在のissue-contract-review本体は「go の場合に Contract Snapshot コメントを投稿する」とだけ規定し、実際の投稿実装はrun_contract_review_once.pyではなくimpl-review-loop/scripts/ensure_contract_snapshot.py側にあります。run_contract_review_once.py自身も「API post は ensure_contract_snapshot.py が扱う」と明記しています。ensure_contract_snapshot.pyはcheck-only / auto / dry-runと--postを持ち、gh api --method POST repos/{repo}/issues/{issue}/commentsでコメント投稿し、body / updatedAt / comments digest の再取得による atomicity check も実装しています。 しかし Issue #1284 の Allowed Paths にはこのファイルも既存テストも入っていません。修正要求:
contract_snapshot.publishは次のどちらかに固定してください。ensure_contract_snapshot.pyを controlled executor から呼ぶ正式な publisher とする。この場合、Allowed Paths にensure_contract_snapshot.pyと対応テストを追加し、--artifact-dirなど任意 write capability を executor 側で封鎖する。ensure_contract_snapshot.pyを呼ばず、controlled_skill_mutation_exec.py内または新規 allowed helper に Contract Snapshot 投稿を再実装する。この場合、既存の directensure_contract_snapshot --post経路を Issue 実装: Issue metadata mutation を worktree ではなく controlled metadata executor 経由にする #1284 の対象外として明示し、skill path が必ず executor を通る negative test を追加する。現契約のままだと、SKILL.md の文面だけが変わり、実際の mutation path は旧来のまま残る可能性が高いです。
P0-2:
tmp/とartifacts/の authority が衝突しているIssue #1284 は input file binding を「canonical tmp subtree 内のみ」と書いています。 一方、既存の
controlled_skill_mutation_policy.pyはALLOWED_WRITE_ROOTS = ["artifacts/"]を持ち、現 executor はartifacts/<issue>/配下の input と marker を前提にしています。さらに
local_main_branch_guard.pyには、gh issue comment <N> --body-file tmp/...やgh issue edit <N> --repo squne121/loop-protocol --body-file tmp/...を限定的に許可する既存ロジックがあります。 つまり、Issue #1284 の「metadata mutation は controlled executor lane」という設計と、既存の「local main で一部 raw gh mutation を許可する lane」が重なります。修正要求: authority root を 1 つに決めてください。候補は次のいずれかです。
artifacts/<issue>/issue-metadata/<command-id>/input.jsontmp/issue-metadata/<issue>/<command-id>/input.jsonただし、
tmp/を使うなら idempotency marker や audit artifact の永続性が弱くなります。artifacts/を使うなら Issue #1284 本文の “canonical tmp subtree” を修正してください。現状のままでは、実装者がtmp/とartifacts/の両方を正当化でき、review が不可能になります。P0-3: 3 command ID を足すだけでは安全境界にならない
既存 executor は
termination_report.publish専用です。input schema もTERMINATION_REPORT_INPUT_V1前提で、issue_numberの一致、artifact subtree、symlink / hardlink 拒否、marker readback などが termination report の形に強く結合しています。Issue #1284 は
issue_body.update/issue_comment.publish/contract_snapshot.publishを追加しますが、この 3 つは同じ mutation ではありません。GitHub CLI でもgh issue editは body だけでなく title, label, project, assignee, milestone, parent/sub-issue など多数の metadata を編集できます。(GitHub CLI)gh issue commentも--edit-last,--delete-last,--create-if-none,--web,--editor,--yesなど mutation / interactive / destructive な枝を持ちます。([GitHub CLI]2)修正要求: policy registry は command ID ごとに最低限これを持つべきです。
GitHub REST API の
Update an issueは issue owner / push access / Triage role で issue を編集でき、body field を更新対象にできます。([GitHub Docs]3)Create an issue commentはowner,repo,issue_number,bodyを必須にし、201/403/404/410/422 などの status を返します。([GitHub Docs]4) CLI で実装する場合でも、executor 内では REST のこの粒度に対応する pre/postcondition を固定すべきです。P0-4: Issue body update には stale-write 防止が必要
Issue #1284 の AC4 は「mutation 後 readback 不一致は成功扱いしない」としています。 これは必要ですが不十分です。
issue_body.updateは readback 後に一致しても、直前に人間または別プロセスが本文を更新していた場合、その更新を上書きして成功できます。既存の
ensure_contract_snapshot.pyはこの問題を一部認識しており、最初にbodyとupdatedAtを取得し、投稿直前に再取得してbody_sha256やupdatedAtが変わっていればstale_or_conflicting_snapshotにしています。 Issue #1284 のissue_body.updateは、これより強い precondition を持つ必要があります。修正要求:
issue_body.updateinput には少なくとも次を必須化してください。{ "schema": "ISSUE_BODY_UPDATE_INPUT_V1", "repo": "squne121/loop-protocol", "issue_number": 1284, "previous_body_sha256": "sha256:...", "previous_updated_at": "2026-07-02T...", "new_body_sha256": "sha256:...", "body_file_sha256": "sha256:...", "operation_reason": "contract_refinement" }実行順序は
read current -> compare previous_body_sha256/updatedAt -> mutate -> read current -> compare new_body_sha256です。updatedAtが変わったが body hash は同じ、または body hash が変わったが updatedAt が同じ、といった片側だけのズレもhuman_judgmentかstale_or_conflicting_snapshotに倒すべきです。P0-5: raw
gh issue edit/commentの block claim が guard ごとに違うworktree_scope_guard.pyはgh issue edit/gh issue commentを mutating command と分類し、controlled skill mutation executor を先に exact allow する構造になっています。 したがって Issue #1284 の「active issue + no matching worktree では raw gh を block」は worktree guard の話としては妥当です。しかし
local_main_branch_guard.py側には、既に限定的な GitHub issue mutation allowlist があります。gh issue comment <N> --body-file tmp/...やgh issue edit <N> --repo squne121/loop-protocol --body-file tmp/...は条件付きで allow されます。 その後、未許可のgh issue/prmutation は fail-closed で block されます。修正要求: AC5 を次のように分割してください。
worktree_scope_guard.pyの active issue + no matching worktree 状態では、rawgh issue edit/commentは block、controlled executor exact command は allow。issue-contract-review/impl-review-loopの production path は rawgh issue edit/commentを一切呼ばない。local_main_branch_guard.pyの既存 raw gh allowlist は本 Issue の認可根拠ではない。必要なら別 Issue で deprecate する。この分割がないと、レビュー時に「worktree guard では block」「local main では一部 allow」の両方が同時に真になり、AC が曖昧になります。
P0-6:
LOOP_ISSUE_NUMBER必須は root/no-worktree 目標と衝突しうる現 executor は
LOOP_ISSUE_NUMBERが存在しないと error にし、存在しても--issue-numberと一致しないと error にします。 一方、Issue #1284 は「root/default branch から issue-specific worktree なしで実行できる」ことを求めています。ここで危険なのは、root session が active issue env を持たない場合です。inline env で
LOOP_ISSUE_NUMBER=1284 ...を付ける回避はlocal_main_branch_guard.pyが明示的に block する設計です。修正要求: 次のどちらかに決めてください。
--issue-number == input.issue_numberと repo/origin binding だけで許可する。ただし hook が active issue を解決できる場合は一致必須。LOOP_ISSUE_NUMBERが供給される」ことを明記し、no-env negative test と valid-env positive test を追加する。現状の AC1 は、実運用で「worktree は不要だが env がなくて executor が常に失敗する」可能性を潰せていません。
P1: 実装方式は
shell=False+ argv list に固定すべきIssue #1284 の reviewer note は「raw command は
gh issue edit --body-file/gh issue comment --body-fileに限る、hand-crafted shell string は不要」と書いています。 これは正しい方向です。Python 公式 docs でも、subprocess.run()は argv sequence が一般に推奨され、escaping/quoting を subprocess 側に任せられると説明しています。([Python documentation]5)shlexは shell-like lexical split であり、非 POSIX shell では quoting が安全とは限らないため、shell=Falseの list argv を使うべきです。([Python documentation]6)修正要求: AC に以下を明記してください。
subprocess.run([...], shell=False, capture_output=True, text=True, timeout=...)のみ。bash -lc,sh -c,python -c, process substitution, redirection, pipe は executor invocation と publisher invocation の両方で deny。gh apiを使うなら、GitHub CLI docs が示す通り--methodを明示し、-F/--fieldの@file読み込み semantics を input-file validation と同じ root で束縛する。([GitHub CLI]7)gh issue edit/commentを使うなら、CLI の--body-file -は stdin freeform なので必ず deny する。gh issue editとgh issue commentはどちらも--body-file <file>があり、-は stdin 読み込みです。([GitHub CLI]1) ([GitHub CLI]2)P1: Hook は sandbox ではないので、test は “real hook path” が必要
Claude Code の PreToolUse は tool call 実行前に走り、allow / deny / ask / defer が可能です。([Claude Platform Docs]8) ただし command hooks はユーザー権限で shell command を実行でき、入力 validation、path traversal block、absolute path 使用などが best practice として明記されています。([Claude Platform Docs]8) Codex 側も PreToolUse は guardrail であり完全な enforcement boundary ではなく、すべての shell call を捕捉するわけではないと説明しています。([OpenAI Developers]9)
Issue #1284 の reviewer note は real PreToolUse hook path と actual git worktree を使った must-block / must-allow adversarial tests を要求しています。 これは必須です。unit test だけでは、hook matcher、cwd、active issue resolution、worktree presence、local root / linked worktree の差分を検証できません。
追加すべき negative matrix:
uv run python3 ... --command-id unknown.command ...は guard allow 後 executor が mutation 前に exit 2。--command-id issue_comment.publish --input-file tmp/../x.jsonは deny。-は deny。repo/issue_number/ schema / body hash mismatch は mutation 前に deny。gh issue comment --delete-last,--edit-last,--web,--editor,--create-if-none,--yesは raw path でも executor path でも deny。gh issue commentはこれらの flags を公式に持っています。([GitHub CLI]2)issue_body.updateは pre-read と post-read の両方を fixture 化し、updatedAtだけ変わるケースも block。ensure_contract_snapshot.py --artifact-dir /tmp/outのような arbitrary write capability は executor 経由で deny または無効化。現在 CLI は--artifact-dirを受け取り、指定先へ JSON artifact を保存します。関連 Issue / PR から見た設計リスク
#1166 は
termination_report.publishを単一 executor 経由にする親実装で、repo / issue / input / artifact / env / import / postcondition / idempotency を束縛することを求めていました。 PR #1182 はそれを実装して merged された PR ですが、PR 本文の safety matrix が “yes” とした後でも、後続の敵対的レビューでは input-file resolution mismatch、input issue_number 未検証、readback/idempotency/import-origin 束縛不足が REQUEST_CHANGES として指摘されています。この履歴から、#1284 は単に「#1166 の command ID を 3 つ増やす」では不足です。#1166 で後から潰した種類のバグを、#1284 の contract / AC / VC に最初から入れるべきです。
また、#1209 の worktree bootstrap executor は raw
git worktree addを controlled executor に置換し、exact argv / repo root / default branch / idempotent readback /shell=Falsesubprocess を固定した前例です。 #1284 も同じ粒度で「raw gh を消す」だけでなく、「executor の入出力・readback・idempotency・direct route 封鎖」を contract 化する必要があります。#1287 は
edit-issue/issue-authorの transaction script 化が #1284 の controlled executor lane に依存すると明記しています。 #1289 は PreToolUse fast-path / telemetry dedupe を別 Issue に切り出しています。 したがって #1284 では、transaction script 化や hook optimization に逃げず、metadata executor の authority 境界だけを閉じるべきです。修正版 AC 案
既存 AC に追加するなら、最低限この形にしてください。
最終コメント
Issue #1284 は、metadata mutation と worktree mutation を分離する設計としては必要です。ただし現本文は、既存の
ensure_contract_snapshot.py、local_main_branch_guard.pyの raw gh allowlist、artifacts/前提のtermination_report.publishexecutor を十分に織り込めていません。このまま実装すると、「executor command ID は増えたが、旧 direct publisher が残る」「Contract Snapshot だけ別ルートで投稿される」「
tmp/とartifacts/が混在する」「body update が stale overwrite できる」という形で、AC は通っても安全境界は閉じません。修正後に着手すべきです。squne121 commentedon Jul 2, 2026
Refinement Loop: Approved
The issue has been approved and is ready for implementation.
approvedsqune121 commentedon Jul 2, 2026
Contract Review Result
squne121 commentedon Jul 2, 2026
Contract Review Result
fix(agent-guards): remote状態を authority にしてissue metadata mutationのfal…
実装: Issue metadata mutation を controlled metadata executor 経由にする (#1295)