Repository navigation
feat: issue-refinement-loop に native dependency の producer/materializer choke point を追加する - #2447
Conversation
…erializer choke point を追加する (#2435) hard dependency (trusted human context / trusted anchor / controlled reframe / #2406 confirmed-hard-predecessor) が確定した際、これまで Issue body の `## Blocked By` prose のみが 更新され GitHub native blockedBy への materialization/readback が行われないことがあった (#2424 retrospective: body には #2422/#2423/#2432 が記載されたが live readback は空集合)。 dependency_materializer.py を単一の共通 choke point として追加する。 ISSUE_EXECUTION_DECISION_V1 の depends_on relation / predecessors を desired native predecessor 集合へ投影し (producer)、既存 edit_issue_txn.py の native_relationships / issue_relationship.update controlled executor へ explicit add/remove delta のみを渡し (materializer)、mutation 後に 独立した postcondition readback で exact match を再検証する。stale predecessor の removal は 常に2つの確定済み decision snapshot 間の明示的差分としてのみ決定し、live native state に対する full-set-replace 計算は行わない。無関係な既存 native predecessor は決して自動削除されない。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
…dency Materialization 節を圧縮する (#2435) test_thin_entrypoint / test_step_0f_parent_owned_preflight の 500 行制約に抵触したため、 既存段落へ1文追記 + 参照マップへの1行追加のみに圧縮する(詳細は references/dependency-materialization.md 側に集約済み)。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Preview URL✅ verified live assets: https://squne121.github.io/loop-protocol/pr-2447/ The preview will be removed when this PR is closed. |
) CI job python-test-core が failure_class 算出行の長さ超過で失敗していたため、 複数行に整形して behavior を変えずに解消する。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
PR Body Japanese Check の per-block バリデータが日本語文字比率 0 の 見出しブロック `## dependency-materialization choke point(AC2)` を prose として検出し fail していた問題を、見出しに「の設計」を追加して解消する。
impl-review-loop PR Review 結果
verdict: APPROVE
reviewed_head_sha: "9cb9a561c14b4b69cb10af6ee95df900d2e4e067"
blockers: []
warnings:
- "PR body uses a '## Checks' table instead of the literal '## 受け入れ条件の達成状況' heading; substance is present and not a template requirement, so non-blocking." |
impl-review-loop PR Review 結果(update_branch後の再レビュー)
verdict: APPROVE
reviewed_head_sha: "cd29b323e2cd9eba0ac77d876ff124a4358b6c39"
blockers: []
warnings:
- "Safety Claim Matrix 'Not controlled' row references an unnumbered follow-up issue; rationale is contract-grounded but tracking issue should be filed for traceability." |
総合判定REQUEST_CHANGES です。PR #2447 は native dependency の delta 計算・既存 最新 head
merge 前に直す最小範囲大きな再設計は不要です。 必要なのは、final deterministic review / implementation handoff の直前に production 共通 gate を1個だけ実配線することです。そこで confirmed その production gate に Runtime Verification は現在の直接 CLI canary ではなく、disposable Issue を使って actual issue-refinement-loop entrypoint から1本通せば十分です。#1897 が primitive を既に検証しているため、新しい安全ハーネスを増築する必要はありません。 この修正が入れば、私は APPROVE 寄りです。現在の blocker は native dependency 実装の安全性ではなく、「再発防止コードを作ったが、再発する場所にはまだ接続していない」ことです。 |
…配線する OWNER REQUEST_CHANGES (PR #2447 comment 5468370232) 反映。producer/materializer choke point 自体は追加済みだったが、issue-refinement-loop の実際の Step 5 終了処理 (approved / LOOP_HANDOFF_RESULT_V1 投稿)のどこからも呼ばれておらず、#2424 型の body-only false-green が merge 後も再発可能だった。 - dependency_materializer.py に evaluate_termination_dependency_gate() を追加し、 Step 5 が approved 終了を投稿する前に必ず呼ぶ単一の choke point とする (proceed / block_retryable / block_persistent の3値、body-only false-green 検出を end-to-end で decision に統合)。 - materialize_dependencies() は自身では contract_readiness_check.py を再実行しない よう変更(呼び出し側が既に計算済みの readiness_result を forward するのみ)。 従来は本 module 自身の subprocess crash が human_judgment escalation に誤変換 されていた。 - SKILL.md Step 5 / references/termination-policy.md / references/dependency- materialization.md に必須ゲートの手順・schema・routing を明記。 - 新規 11 tests(termination gate の proceed/block_retryable/block_persistent、 #2424 regression・explicit-remove+unrelated-preservation・body-only false-green のいずれも gate 経由の end-to-end 検証、readiness 再実行禁止の回帰)。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
CI の PR Body Japanese Check(実体は変更 Markdown ファイル全体の日本語比率検査)が、 コードスパンのみで構成された exit code 説明段落を日本語比率不足として fail させていた。 文を日本語プロースへ書き換えて解消する。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
impl-review-loop PR Review 結果(オーナーREQUEST_CHANGES対応後の再レビュー、iteration 4)対象コメント: #2447 (comment)
verdict: APPROVE
reviewed_head_sha: "3b8a87660370f190e34595084b29ac5a3b890607"
blockers: []
warnings:
- "Full .claude/skills/issue-refinement-loop/tests/ suite (1934 tests) was not independently re-executed end-to-end by the reviewer due to local execution time; covered by CI required-check evidence (python-test: passed) at this exact head SHA instead." |
Summary
Closes #2435(本 Issue を解決する)
Issue #2424 の refinement では #2422/#2423/#2432 が hard predecessor として確定し Issue 本文の
## Blocked Byに記載されたが、GitHub nativeblockedByの live readback は空集合のままだった(body-only false green)。本 PR は、確定済み hard dependency を native
blockedByへ実際にmaterialize し、mutation 後に独立した readback で postcondition を再検証する単一の共通
dependency-materialization choke point を追加し、かつその choke point を
issue-refinement-loopの実際の Step 5 終了処理(approved終了直前)へ実配線した。今回の追加修正(リポジトリ所有者からの差し戻し反映、第4回目の反復対応)
OWNER レビューにより、初回実装は choke point(producer + materializer)を追加しただけで、
実際の Step 5 終了経路のどこからも呼び出されておらず、#2424 型の body-only false-green が
merge 後も再発可能である P0 gap が指摘された。本 iteration で以下を修正した。
dependency_materializer.pyにevaluate_termination_dependency_gate()を追加した。issue-refinement-loopの Step 5 がapproved/LOOP_HANDOFF_RESULT_V1を投稿する前に必ず呼ぶ単一の choke point であり、derive_desired_predecessors()でこのサイクルの確定済み hard dependency を投影し、materialize_dependencies()を呼び、proceed/block_retryable/block_persistentの3値で orchestrator が取るべきアクションを返す。確定済み hard dependency が存在しない
サイクルでは no-op で
proceedを返す。body-only false-green 検出(AC5)もこの gate のdecision に統合されており、standalone helper 単体テストに留まらない。SKILL.md Step 5 /
references/termination-policy.md(新設「Dependency Materialization Gate」節)/references/dependency-materialization.md(新設「Step 5 termination gate」節)に必須invocation 契約を明記した。
materialize_dependencies()はcontract_readiness_check.pyを自身の subprocess として二度と呼ばない。呼び出し側が同一サイクルで既に計算済みの
readiness_resultを forward するのみ(省略時は subprocessを起動しない no-op
status: goの default を使う)。旧実装は本 module 自身の subprocesscrash / non-JSON 出力を
input_or_runtime_errorに合成し、edit_issue_txn.pyの既存readiness forwarding 契約経由で不要な
human_judgmentescalation に化けさせていた。直接 CLI 呼び出しから
dependency_materializer.py gateサブコマンド(新設 Step 5 chokepoint の実 CLI)経由へ変更した。詳細は下記「動作検証」節参照。
proceed/block_retryable/block_persistent、実装: 実CI raw attemptsからReliability V1 close evidenceをproduction生成する #2424 regression fixture・explicit-remove+unrelated-blocker-preservation・body-only false-green のいずれも gate 経由の end-to-end
検証、readiness 再実行禁止の回帰)。既存 36 tests は変更していない。
.claude/skills/issue-refinement-loop/scripts/dependency_materializer.pyISSUE_EXECUTION_DECISION_V1のrelations[].relation_type == "depends_on"/execution.predecessors[]を desired native predecessor 集合へ投影する(
derive_desired_predecessors)。removal 対象を決定する (
derive_stale_predecessors)。live native state に対するlive_native - desiredの full-set-replace 計算は一切行わない。.claude/skills/edit-issue/scripts/edit_issue_txn.pyのnative_relationships/issue_relationship.updatecontrolled executor へ explicitadd/remove delta のみを渡す (
materialize_dependencies)。この module 自身は GitHub への直接 GraphQL/REST 呼び出しを行わない。add/remove の schema key 名は
edit_issue_txn.NATIVE_RELATIONSHIPS_KEYSから動的解決し、二重にハードコードしない。readiness は呼び出し側からの forward のみで、自身では再実行しない(fix_delta iter4 P1)。
(live_before - explicit_remove) ∪ explicit_addを独立に再計算し、executor のlive readback と exact match するかを再検証する。executor 自身の
status: ok自己申告をそのまま信用しない。
native-capability-unavailable/controlled-executor-failure/auth-or-environment-failure/readback-mismatch/semantic-human-judgment-required。detect_body_only_false_green): native capability が利用可能なのに本文の
## Blocked Byだけを更新し native materialization を試みなかった場合を fail-closed で検出する(実装: 実CI raw attemptsからReliability V1 close evidenceをproduction生成する #2424 incident shape そのもの)。
evaluate_termination_dependency_gate()(fix_delta iter4 新設): Step 5 がapproved終了を投稿する前に必ず呼ぶ choke point。CLI:dependency_materializer.py gate。.claude/skills/issue-refinement-loop/references/dependency-materialization.md: SSOT 宣言、choke point 設計、失敗分類、readiness 判定との分離に加え、「readiness の再実行禁止」「Step 5
termination gate」の2節を新設。
.claude/skills/issue-refinement-loop/references/termination-policy.md: 「DependencyMaterialization Gate」節を新設し、Step 5 が
approved終了前に gate を呼ぶ必須契約・decision ごとの routing・
termination_cause: dependency_materialization_blockedを定義。.claude/skills/issue-refinement-loop/references/index.md: 上記 reference を登録。.claude/skills/issue-refinement-loop/SKILL.md: SSOT 宣言・choke point pointer に加え、Step 5 節に必須 gate 呼び出しの一文を追記(500 行 thin-entrypoint budget 内、既存行への
追記のみで新規行は増やしていない)。
.claude/skills/issue-refinement-loop/tests/test_dependency_materialization.py(既存 36 +新規 11 = 47 tests)。
In Scope / Out of Scope(Issue 本文どおり)
writer の追加、
edit_issue_txn.pyの既存 primitive の置き換え、check_blockers.shの再設計、scope collision classification の変更、既存 Issue の一括遡及修正、semantic 判定ルールの
全面再設計。いずれも本 PR には含まれない。
materialize_dependencies()/evaluate_termination_dependency_gate()を単一の choke point として設計した。実装: issue-refinement-loop で scope_collision_check/v1 を消費する #2406 のconfirmed-hard-predecessor 経路も同じ関数を再利用できる構造。本 gate は
issue-refinement-loop自身の Step 5 手順(SKILL.md/references/、Allowed Paths 内)として配線されており、
.claude/agents/issue-editor.md等の個別 lane 実装ファイル自体の変更は引き続き Allowed Paths 外のため対象外(OWNER レビューが「各 lane からの呼び出し配線」
ではなく「Step 5 終了経路への実配線」を求めていたため、本 iteration でその要求は満たした)。
Checks
pnpm typecheckpnpm lintpnpm testpnpm builduv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.pyuv run --locked ruff check .claude/scripts scripts schemas .claude/skillsrg "hard dependency の SSOT は GitHub native" SKILL.md references/rg "dependency-materialization choke point" SKILL.md references/ scripts/pytest issue-refinement-loop/tests/ -k "native_dependency or blocked_by or dependency_materialization"pytest edit-issue/tests/test_edit_issue_txn.py(regression)rg -e "add_blocked_by" -e "remove_blocked_by" --glob "!edit-issue/**" scripts/ references/pytest issue-refinement-loop/tests/TestAuthorityTransportPrivilegedExecutorRealSubprocessDispatchfailures(base ブランチでも同様に失敗する既知の環境依存 flake、本 PR 由来ではない)動作検証 Runtime Verification(AC4 / AC6 / AC7、
decision: immediate、fix_delta iter4 で再照準)OWNER レビュー指摘(初回実装は materializer への bare CLI 呼び出しのみで producer→materializer
wiring を検証していなかった)を反映し、実 GitHub 上の disposable Issue に対して
新設の
dependency_materializer.py gateサブコマンド(Step 5 termination gate の実 CLI、evaluate_termination_dependency_gate())経由で検証した。native relationship primitive自体は #1883/PR #1897 で live canary 済みのため再検証しない(本 Issue の RVA 記載どおり)。
UNRELATED-PREEXISTING([RVA disposable] gate wiring UNRELATED-PREEXISTING (#2435 fix_delta iter4) #2452)(4件とも canary 完了後に close 済み)
gh issue edit 2449 --add-blocked-by 2452で無関係な既存 blocker を手動 seed(
dependency_materializer.py/ gate 自体では一切実行していない、fixture 準備のみ)ISSUE_EXECUTION_DECISION_V1相当の decision file(desired={2450,2451})を用意し
dependency_materializer.py gate --target-issue 2449 --current-decision-file ... --body-file ...を実行。1回目は
issue_relationship.update側の post-mutation readback で一時的なtransport エラーが発生し、gate は
decision: block_retryable(controlled-executor-failure)を返した(mutation 自体は成立していたが、gate は自己申告を信用せず独立確認できるまで
proceedを返さなかった — AC4 の意図通りの fail-closed 挙動)。同じ gate を再実行(bounded retry)したところ、独立 live readback が
{2450,2451,2452}と一致しdecision: proceed/status: okを確認。previous decision={2450,2451}・current decision={2450}([RVA disposable] gate wiring BLOCKER-REMOVE (#2435 fix_delta iter4) #2451 を明示的に除外)を渡し
dependency_materializer.py gateを実行 →decision: proceed,observed_predecessors_after: [2450,2452]。独立 GraphQL readback(
blockedByquery) で{2450,2452}と一致確認([RVA disposable] gate wiring BLOCKER-REMOVE (#2435 fix_delta iter4) #2451 は明示的に削除、無関係な [RVA disposable] gate wiring UNRELATED-PREEXISTING (#2435 fix_delta iter4) #2452 はdesired set に含まれていないだけでは削除されないことを実 GitHub 上で確認)。
applicable_acs(AC4/AC6/AC7)に含まれないため、実 GitHub 上での再現は行わず、決定論的 pytest(gate 経由の end-to-end テストを含む)
でのみ検証した。
Schema Change Applicability
ISSUE_EDIT_TXN_INPUT_V1/ISSUE_RELATIONSHIP_UPDATE_INPUT_V1schema はそのまま消費するのみで、フィールド追加・変更は行っていない。新規スキーマDEPENDENCY_MATERIALIZATION_RESULT_V1/TERMINATION_DEPENDENCY_GATE_RESULT_V1は本 PR 内で閉じた新規 internal contract であり、外部 consumer は本 PR 時点で存在しない。Schema Consumer Inventory
N/A
reason: schema_change ではないため対象外。
DEPENDENCY_MATERIALIZATION_RESULT_V1/TERMINATION_DEPENDENCY_GATE_RESULT_V1は現時点でdependency_materializer.pyの CLI 呼び出し元(issue-refinement-loopStep 5 手順自身)以外に consumer を持たない新規 internal schema。Safety Claim Matrix
edit_issue_txn.py/issue_relationship.updatecontrolled executor のみに委譲するrgno-match)+ コード全体でsubprocess呼び出しはedit_issue_txn.pyのみ(contract_readiness_check.pyへの subprocess 呼び出しは fix_delta iter4 で撤去済み)stale_predecessors_to_remove(gate 経由では前回/今回 decision snapshot の明示的差分)からのみ決定され、live native state のlive - desired計算からは決定しないtest_dependency_materialization_compute_add_and_remove_targets_never_removes_unrelated_blocker+test_termination_gate_explicit_remove_with_unrelated_blocker_preservation_proceeds+ 実 disposable Issue での live 検証(#2452 保持確認)test_dependency_materialization_materialize_dependencies_readback_mismatch_never_reported_ok+ 実 disposable Issue での live 検証(Step 1 の transient transport error をblock_retryableとして fail-closed に扱い、proceedを返さなかった実例)test_dependency_materialization_materialize_dependencies_capability_unavailable_fails_closed等 8 tests +test_termination_gate_persistent_failure_classes_block_persistent等 gate testsissue-refinement-loopの Step 5 終了処理(approved/LOOP_HANDOFF_RESULT_V1投稿)は、確定済み hard dependency が存在するサイクルで choke point (evaluate_termination_dependency_gate) を必ず経由する(fix_delta iter4 で解消。旧: 各 lane からの呼び出し配線が未接続)references/termination-policy.md「Dependency Materialization Gate」節、SKILL.md Step 5 の必須ゲート文、gate 経由の live disposable-Issue 検証(Step 1/Step 2 上記)references/dependency-materialization.mdの AC9 節、Issue #2435 Allowed Paths / Out of ScopeNotes
Related issue: #2435(本 PR に関連する Issue 番号)
.claude/worktrees/issue-2435-native-dependency-materializationworktree-issue-2435-native-dependency-materialization(
.claude/skills/issue-refinement-loop/{SKILL.md,references/,scripts/,tests/})。edit-issue/tests/test_edit_issue_txn.pyとdocs/dev/agent-skill-boundaries.mdは今回変更不要だったため触れていない(Allowed Paths の「必要な場合のみ」条項)。
(リンク先: feat: issue-refinement-loop に native dependency の producer/materializer choke point を追加する #2447 (comment) )
で指摘された配線欠落を反映したものである。