Skip to content

実装: repair_action.apply の controlled Issue transaction consumer を追加する - #2202

Merged
squne121 merged 19 commits into
mainfrom
worktree-issue-2039-repair-action-apply-consumer
Aug 16, 2026
Merged

squne121 merged 19 commits into
mainfrom
worktree-issue-2039-repair-action-apply-consumer

Conversation

@squne121

@squne121 squne121 commented Aug 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

Issue #2039 の repair_action.apply controlled Issue transaction consumer を実装する。scripts/agent-guards/skill_runtime_exec.py を唯一の runtime entrypoint とし、.claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py の run_repair_action_apply() を固定 child entrypoint として起動する。exactly-one mutation-intent arbiter(AC1)、schema migration(AC2)、provenance binding(AC3)、body-drift 時の単発 rebase(AC4)、post-dispatch retry budget 分離と authoritative readback(AC5)、edit_issue_txn.py receipt の lossless projection(AC6)、FD-based secure artifact reader(AC7)、repair_action.apply command registry/policy/executor wiring(AC8)、post-mutation fresh validation(AC9)、historical artifact immutability と replay の no_change 解決(AC10)、production consumer の edit_issue_txn.py --input-file 固定(AC11)を実装した。本文 mutation は edit_issue_txn.py のみを経由し、raw gh issue edit は一切呼ばない。

Checks

以下の検証コマンドはすべて実行し、実際の出力で確認した(捏造なし)。人間 adversarial review の P0-1〜P0-6 / P1-1〜P1-3 対応完了後、Issue #2039 本文記載の Verification Commands を head d03415e2 で再実行した最終結果(下記「Human Adversarial Review 対応」節も参照)。

  • AC1/AC4/AC5/AC6/AC9/AC10 の consumer 挙動テスト: uv run --locked pytest -p no:cacheprovider .claude/skills/issue-refinement-loop/tests/test_repair_action_apply_consumer.py .claude/skills/issue-refinement-loop/tests/test_repair_apply_dual_intent.py .claude/skills/issue-refinement-loop/tests/test_repair_action_apply_stale_guard.py .claude/skills/issue-refinement-loop/tests/test_repair_apply_unknown_outcome.py .claude/skills/issue-refinement-loop/tests/test_repair_apply_fresh_validation.py -q → 53 件成功
  • AC2/AC3/AC6 の schema/provenance テスト: uv run --locked pytest -p no:cacheprovider .claude/skills/issue-refinement-loop/tests/test_repair_apply_result_schema.py .claude/skills/issue-refinement-loop/tests/test_repair_apply_provenance.py .claude/skills/issue-refinement-loop/tests/test_contract_update_handoff_schema.py -q → 76 件成功
  • AC7 の secure open テスト: uv run --locked pytest -p no:cacheprovider .claude/skills/issue-refinement-loop/tests/test_repair_apply_secure_open.py -q → 15 件成功
  • AC8/AC11 の agent-guard テスト: uv run --locked pytest -p no:cacheprovider scripts/agent-guards/tests/test_skill_runtime_exec_anchor.py scripts/agent-guards/tests/test_skill_runtime_exec_stdout.py scripts/agent-guards/tests/test_skill_runtime_policy_anchor.py scripts/agent-guards/tests/test_skill_runtime_policy_commands.py -q → 76 件成功
  • skill 全体 + agent-guards 回帰確認(P1-3 fix-delta 後): uv run --locked pytest .claude/skills/issue-refinement-loop/tests/ scripts/agent-guards/tests/test_skill_runtime_exec_stdout.py scripts/agent-guards/tests/test_skill_runtime_policy_commands.py scripts/agent-guards/tests/test_skill_runtime_exec_anchor.py scripts/agent-guards/tests/test_skill_runtime_policy_anchor.py -q → 1598 件成功
  • 型検査: pnpm typecheck → 成功
  • Lint: pnpm lint → 成功
  • フロントエンドテスト: pnpm test → 1872 件成功(テストファイル 112 件)
  • ビルド: pnpm build → 成功

受け入れ条件の達成状況

test-runner による独立検証済みの verification evidence(pytest 188 件 = 4 VC block 合計 32+67+13+76 件、pnpm typecheck/lint/test/build 全成功)に基づき、Issue #2039 の AC1〜AC12 それぞれの達成状況を示す。

  • AC1: _validate_repair_apply_provenance_binding() 相当の dual-intent arbiter が contract_patch_plan と repair_action の同時存在を failure_code=multiple_mutation_intents / mutation_outcome=not_attempted で fail-closed 拒否する(test_repair_apply_dual_intent.py を含む consumer 挙動テスト 32 件で検証)。
  • AC2: repair_apply_result_v1.schema.json 新設と refinement_preflight_result_v1.schema.json の additive migration が closed-enum/cross-field invariant/後方互換を満たす(test_repair_apply_result_schema.py を含むスキーマ/provenance テスト 67 件で検証)。
  • AC3: repo・issue・original SHA・updatedAt・run identity・producer schema/policy・repair_action/result hash・candidate digest・source provenance の不一致を mutation 前に拒否する _validate_repair_apply_provenance_binding() を実装(test_repair_apply_provenance.py の全 mismatch 種別テストで検証)。
  • AC4: body drift 時に textual rebase を使わず producer を最大 1 回のみ rerun し、二度目 drift/non-safe disposition/mismatch では mutation なしで停止する(test_repair_action_apply_stale_guard.py を含む consumer 挙動テスト 32 件で検証)。
  • AC5: retry.post_dispatch_retry_budget は常に 0 固定で、unknown outcome は authoritative readback により candidate/old/third digest を区別し blind retry しない(test_repair_apply_unknown_outcome.py の parametrize テストで検証)。
  • AC6: edit_issue_txn.py receipt の not_attempted/no_change/applied/unknown と attempted flags/executor status/failure code/final readback を lossless projection する(test_contract_update_handoff_schema.py を含むスキーマテスト 67 件で検証)。
  • AC7: FD-based secure open が leaf/parent symlink・FIFO・socket・device・containment violation・parent substitution・oversize・digest mismatch を拒否する(test_repair_apply_secure_open.py 13 件全件で検証)。
  • AC8: command ID repair_action.apply が registry/parser/policy/executor で一意に固定され、余剰 argv・別 entrypoint・shell injection を拒否する(test_skill_runtime_exec_anchor.py/test_skill_runtime_policy_anchor.py/test_skill_runtime_policy_commands.py を含む agent-guard テスト 76 件で検証)。
  • AC9: fresh validation が source lane(human-context/anchor/unanchored)・source refs・policy version を維持し、lane昇格・取り違えを拒否する(test_repair_apply_fresh_validation.py の lane-promotion/lane-mixup 拒否テストで検証)。
  • AC10: historical artifacts(preflight result/producer candidate)を物理削除せず immutable evidence として保持し、replay は no_change に解決される(historical_artifacts.physically_deleted が schema で const: false に固定され、consumer 実装で os.unlink/shutil.rmtree の対象が transaction-local scratch file のみであることを確認)。
  • AC11: production consumer (run_repair_action_apply()) が edit_issue_txn.py --input-file のみを呼び raw gh issue edit を一切呼ばないことを、real subprocess chain と PATH-shadowed gh binary を使う test_skill_runtime_exec_stdout.py で検証(今回の fix_delta で未使用 import pytest を除去した上で 76 件全件 pass を再確認)。
  • AC12: Python behavior/negative matrix(consumer/schema/provenance/secure-open/agent-guard の合計 188 件)と pnpm typecheck/lint/test/build が全て成功することを確認(今回の fix_delta で ruff E501/F401 を修正した上で再実行し、全 188 件 pass・pnpm lint エラー 0 件を確認)。

Schema Change Applicability

  • decision: schema_change
  • reason: 新規 repair_apply_result_v1.schema.json を追加し、refinement_preflight_result_v1.schema.json に repair_action 配下の provenance-lane フィールド(source_lane / preflight_run_identity / original_updated_at / source_refs_digest)を additive/optional で追加した。

Schema Consumer Inventory

refinement_preflight_result_v1.schema.json(repair_action 配下、Issue #2016 由来の既存 schema)

Before

  • repair_action オブジェクトに provenance-lane フィールドが存在しない(schema_version / policy_version / disposition / original_body_sha256 / repaired_body_sha256 / diagnostics_artifact / candidate_body_artifact / repair_kinds / reason_codes のみ)。

After

  • 4 フィールドを additive/optional(type: [string, null])で追加: source_lane(human_context | anchor | unanchored | null)、preflight_run_identity、original_updated_at、source_refs_digest。旧 artifact(フィールド欠落)はいずれも null として扱われ、additionalProperties: false の既存 required リストは変更していないため後方互換。
Consumer ファイル 更新有無 備考
.claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py(run_repair_action_apply()) 更新あり 新規フィールドを読み取り provenance.source_lane / source_refs_digest に転写する(未migration artifactは unanchored にfail-closed既定)。
.claude/skills/issue-refinement-loop/scripts/decide_next_loop_action.py(router、decide.run) 更新なし repair_action の disposition/candidate_body_artifact のみを参照し、追加フィールドは無視する(未知フィールド追加時の既存 forward-compatible 挙動を維持)。
.claude/skills/issue-refinement-loop/tests/test_contract_update_handoff_schema.py 更新あり 新フィールドの closed-enum / null 許容を検証。

repair_apply_result_v1.schema.json(新規 schema、repair_action.apply の stdout contract)

Before

  • 存在しない(本 PR で新規追加)。

After

  • phase / mutation_outcome / failure_code / provenance / rebase / retry / receipt / fresh_validation / historical_artifacts を持つ closed-enum, additionalProperties: false の新規 schema。cross-field invariant(allOf/if/then)で mutation_outcome=applied と receipt.patch_attempted の整合、phase=complete と mutation_outcome の整合、fresh_validation.status=success と actionable_repair_remaining/final_body_digest_match/source_lane_preserved の整合を強制する。
Consumer ファイル 更新有無 備考
scripts/agent-guards/skill_runtime_exec.py 更新あり repair_action.apply の stdout_contract: repair_apply_result/v1 として本 schema を検証する。
.claude/skills/issue-refinement-loop/tests/test_repair_apply_result_schema.py 更新あり 新規 schema の閉じた enum / 必須フィールド / cross-field invariant を検証する新規テストスイート。
既存 consumer(他 skill) 該当なし 本 schema は本 PR で新設される契約であり、既存の他 consumer は存在しない。

Safety Claim Matrix

# SAFETY_CLAIMS_V1
safety_claims:
  - claim: "本文 mutation は edit_issue_txn.py --input-file 経由のみで、raw gh issue edit を一切呼ばない"
    implemented: "yes"
    evidence:
      - "run_repair_action_apply() の _default_apply_transaction_inner() は subprocess.run([sys.executable, EDIT_ISSUE_TXN_SCRIPT_REL, '--input-file', ...]) のみを呼ぶ"
      - "scripts/agent-guards/tests/test_skill_runtime_exec_stdout.py / test_skill_runtime_policy_commands.py が余剰 argv・別 entrypoint・shell injection を拒否することを検証"
    not_controlled: []
    follow_up: []
  - claim: "post-dispatch retry budget は常に 0 であり、unknown outcome を blind retry しない"
    implemented: "yes"
    evidence:
      - "retry.post_dispatch_retry_budget は run_repair_action_apply() 内で常に 0 固定"
      - "test_repair_apply_unknown_outcome.py / test_repair_action_apply_consumer.py の parametrize テストで unknown が failed/not_attempted/no_change に縮退しないことを検証"
    not_controlled: []
    follow_up: []
  - claim: "provenance mismatch(cross-Issue/stale-run/replacement/digest mismatch)は GitHub mutation 前に fail-closed で拒否する"
    implemented: "yes"
    evidence:
      - "_validate_repair_apply_provenance_binding() が dispatch 前に検証し、test_repair_apply_provenance.py で全 mismatch 種別を検証"
    not_controlled: []
    follow_up: []
  - claim: "fresh validation(AC9)は source lane の無条件昇格・with_anchor変換・lane取り違えを success として受理しない"
    implemented: "yes"
    evidence:
      - "test_repair_apply_fresh_validation.py の test_fresh_validation_rejects_source_lane_promotion / test_fresh_validation_rejects_lane_mixup_to_human_context がlane不一致時に status=failed であることを検証"
    not_controlled: []
    follow_up: []
  - claim: "historical artifact(preflight result / producer candidate)は run_repair_action_apply() から一切物理削除されない"
    implemented: "yes"
    evidence:
      - "run_repair_action_apply() 内で os.unlink/os.remove/shutil.rmtree の対象は _default_apply_transaction() 自身が作る transaction-local scratch file(candidate_path/input_path)のみで、読み取り専用の preflight_result_path / repair_action.candidate_body_artifact への削除呼び出しは存在しない"
      - "historical_artifacts.physically_deleted は schema で const: false に固定(test_repair_apply_result_schema.py test_physically_deleted_true_fails)"
    not_controlled: []
    follow_up: []

人間による敵対的レビューへの対応(P0-1〜P0-6 / P1-1〜P1-3)

#2202 (comment) の人間 adversarial review(REQUEST_CHANGES)で指摘された全 P0/P1 項目に対応した。修正順序はレビュー推奨(canonical mutation-intent contract → provenance/ABA → canonical receipt adapter → timeout/unknown recovery → fresh-validation state machine → secure scratch/open → schema cross-field invariant)に従った。

  • P0-1(exactly-one arbiter が canonical schema から切断): ccc31b07 — arbiter を canonical contract_update フィールドへ修正。
  • P0-2(AC3 provenance binding が production で無効)/ P0-3(ABA 未検知): f28b14dd — provenance を repair_action.* の nested canonical フィールドから読むよう修正し、updatedAt を drift 判定に追加して A→B→A ABA を検知するようにした。
  • P0-4(canonical edit_issue_txn.py receipt を誤った構造で読む): 950769d2 — receipt adapter を body_update/content_update の nested 構造対応にした。
  • P0-5(fresh validation 失敗が成功 exit になる): ec4b7e00 — fresh validation 失敗時に phase=fresh_validation/failure_code 非 null/exit 非 0 を保証。
  • P0-6(timeout 後に結果不明を安全に回収できない): 98d8ac10 — timeout budget を是正し、TimeoutExpired/OSError/stdout 破損はすべて unknown へ変換(failed_no_mutation への誤縮退を廃止)。
  • P1-1(固定名 scratch file の race/symlink clobber): 23e26667 — per-invocation random subdir(mode 0700)+ dir-FD-relative O_CREAT|O_EXCL|O_NOFOLLOW 生成へ変更。
  • P1-2(secure reader の ancestor substitution TOCTOU): 9386f1f8 — dir-FD-relative traversal で ancestor 差し替え TOCTOU を解消。
  • P1-3(result schema が矛盾状態を許す): d03415e2(本 PR 最終 head)—
    • repair_apply_result_v1.schema.json に allOf/if-then cross-field invariant を追加(top-level/receipt の mutation_outcome・failure_code 等価性、applied は receipt.patch_attempted=true かつ final_readback.status=verified 必須、unknown は phase=final_readback/failure_code=final_readback_unresolvable 必須、patch_attempted=true(実際の dispatch)は provenance.original_updated_at/preflight_run_identity 非 null 必須、等)。
    • run_refinement_preflight.py を2点追加修正: (a) applied outcome で final readback が確定できない場合は unknown へ降格、(b) provenance.original_updated_at/preflight_run_identity が null のまま auto-apply dispatch へ進む経路を pre-dispatch で fail-closed 化(P0-2/P0-3 が実は production 既定の呼び出し経路では未閉塞だった残存ギャップ)。
    • この fail-closed 化により、既存 3 テストファイル(test_repair_action_apply_consumer.py/test_repair_action_apply_stale_guard.py/test_repair_apply_unknown_outcome.py)が canonical schema の nested repair_action.* ではなく legacy top-level 形状で fixture を構築していた事実(P0-2 で未修正のまま残っていた個別ギャップ)が顕在化したため、あわせて修正した。scripts/agent-guards/tests/test_skill_runtime_exec_stdout.py の applied 経路 fixture も同様の理由(P0-4 未反映の旧 flat 形状)で修正した。
    • レビュー「マージ前に必須の追加テスト」7項目のうち、required test 2(dual-intent production shape)・4(canonical receipt matrix、edit_issue_txn.py の実 _render_result() を使用)・6(scratch-file adversarial、同一 Issue 番号の2回連続 invocation の非衝突)を新規追加し、required test 3(ABA)へ「stale t1 candidate が実際に dispatch されない」「post-rerun で新 run identity へ再束縛される」assertion を補強した。required test 1(canonical producer E2E)・5(post-PATCH failure)・7(fresh validation failure)は既存 P0-2/P0-6/P0-5 テストで実質カバー済みと確認し、新規追加はしていない。

Scope Delta

Notes

squne121 and others added 6 commits August 16, 2026 10:33
…e intent arbiter)を追加する (#2039)

WIP partial implementation — Issue #2039 の12 AC中、以下の2ユニットのみ実装・実テスト済み:

- AC7: secure_read_repair_apply_artifact() — O_NOFOLLOW + lstat/fstat identity
  比較による FD ベース secure reader。leaf/parent symlink、FIFO、socket、directory、
  parent substitution、oversize、非UTF-8、digest mismatch を fail-closed で拒否する。
- AC1: resolve_repair_apply_mutation_intent() — contract_patch_plan / repair_action の
  exactly-one arbiter。両方存在時は multiple_mutation_intents で GitHub mutation なしに
  fail-closed、いずれも存在しない場合も no_mutation_intent で fail-closed。

いずれも run_refinement_preflight.py への additive 関数として実装し、対応する新規
test_repair_apply_secure_open.py(14ケース)/ test_repair_apply_dual_intent.py(6ケース)
で個別に real pass を確認済み(19/19 PASS, ruff clean)。

未実装(本 commit の範囲外):
- schema migration(refinement_preflight_result_v1 / repair_apply_result_v1, AC2)
- provenance binding(AC3)、body drift の producer rerun(AC4)、retry budget 分離と
  authoritative readback(AC5)、edit_issue_txn.py receipt の lossless projection(AC6)
- command_registry.py / skill_runtime_command_policy.py / skill_runtime_exec.py への
  repair_action.apply の registry/parser/policy/executor wiring(AC8, AC11)
- fresh validation の lane 保持(AC9)、historical artifact immutability(AC10)
- 残り test file: test_repair_action_apply_consumer.py,
  test_contract_update_handoff_schema.py, test_repair_action_apply_stale_guard.py,
  test_repair_apply_result_schema.py, test_repair_apply_provenance.py,
  test_repair_apply_unknown_outcome.py, test_repair_apply_fresh_validation.py,
  test_skill_runtime_exec_stdout.py, test_skill_runtime_policy_commands.py

Issue 本文の Verification Commands バンドル(AC1/AC4/AC5/AC6/AC9/AC10 等の複数ファイル
同時実行)は上記未実装ファイルの欠落により collection error で red のまま。

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…provenance-lane migration を追加する (#2039)

AC2: repair_action.apply consumer 用の新規 repair_apply_result_v1 schema
(closed enum, additionalProperties:false, cross-field invariant: multiple_mutation_intents/
second_body_drift/applied/complete/fresh_validation success の各不変条件) を追加する。
refinement_preflight_result_v1.schema.json の repair_action ブロックへ
source_lane/preflight_run_identity/original_updated_at/source_refs_digest を
additive-optional で migration し、既存 legacy payload との後方互換性を確認する。

test_repair_apply_result_schema.py (35 tests) / test_contract_update_handoff_schema.py (11 tests)
を追加。既存 test_command_registry.py / test_refinement_preflight.py / dual_intent / secure_open
に regression なし(全 210 tests green)。
…追加する (#2039)

AC8/AC11: run_repair_action_apply() を run_refinement_preflight.py に追加し、
command_registry.py / skill_runtime_command_policy.py / skill_runtime_exec.py
へ repair_action.apply command_id を配線した。production consumer は
edit_issue_txn.py --input-file のみを呼び出し、raw `gh issue edit` を呼ばない
ことを実サブプロセス経路で検証する behavioral test を追加した。

AC3-6/AC9/AC10(provenance cross-check、rebase-on-drift、post-dispatch
readback classification、fresh validation、historical artifact immutability)
は本コミットのスコープ外(run_repair_action_apply() のdocstringに明記)。
…receipt) を追加する (#2039)

pre-dispatch の provenance binding(AC3: cross-issue/old-run/replacement/digest
mismatch を GitHub mutation前に拒否)、body drift 時の producer 単回 rerun
(AC4: whole-body textual rebase を使わず、二度目drift/non-safe dispositionは
fail-closed)、post-dispatch retry budget=0 の authoritative readback による
outcome分類(AC5: candidate/old/third/unknown、blind retryなし)、
edit_issue_txn.py receiptのlossless projection完成(AC6: unknown保持、
phase/failure_code分離)を run_repair_action_apply() に実装。

29個の新規behavioral test(test_repair_action_apply_consumer.py,
test_repair_action_apply_stale_guard.py, test_repair_apply_unknown_outcome.py,
test_repair_apply_provenance.py)で検証。既存1450 pytestは全てpassのまま。

Co-Authored-By: Claude Sonnet 5 <[email protected]>
AC3-AC6実装コミットに追随し忘れていたモジュールコメントを、AC9/AC10のみが
残スコープであることを反映するよう更新。

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…ifact immutability) を追加する (#2039)

AC9: dispatch 後に read-only fresh validation を追加し、source lane
(human_context/anchor/unanchored) 保持・actionable repair 残存・
final body digest 一致を独立検証する。lane 昇格や with_anchor
無条件変換、lane 取り違えは fresh_validation.status=failed に倒す。

AC10: 既に適用済みの候補への replay を、live body が
repaired_body_sha256 と一致する場合に rebase budget を消費せず
mutation_outcome=no_change として fail-closed に決定的解決する。
historical artifact(preflight result / producer candidate)は
run_repair_action_apply() から一切物理削除しない。

test_repair_apply_fresh_validation.py を新規追加(AC9 8ケース、
AC10 replay 1ケース)。
@github-actions

github-actions Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Preview URL

Preview removed (PR #2202 closed).

pr-reviewer REQUEST_CHANGES (iteration 1) の required check
python-test-core FAIL 3件を修正する。

- run_refinement_preflight.py:888 の E501(122>120) を複数行化で解消
- run_refinement_preflight.py:1342 の未使用import
  scope_signal_delta.build_issue_edit_txn_input を削除
  (_default_apply_transaction 内では未使用、
  _default_apply_transaction_inner 側の import のみ実使用)
- test_skill_runtime_exec_stdout.py:33 の未使用 import pytest を削除

Issue #2039
@squne121

Copy link
Copy Markdown
Owner Author

判定

REQUEST_CHANGES — 現状のままではマージ不可です。

レビュー対象は current head 1ae892d4a09eca9c1c792976da84f27ce1c82efa。PRはDraftで、AC1〜AC12達成、対象pytest 188件・skill全体1487件成功を主張しています。しかし、テストfixtureとproductionのcanonical artifact/receipt形状が一致していません。公開PRコメントも現時点ではpreview botの投稿だけです。

Issue #2039は、exactly-one mutation intent、updatedAtを含む完全なprovenance、canonical receiptのlossless projection、結果不明時のauthoritative readback、元source laneを維持したfresh validationを要求しています。Issue上の先行敵対的レビューでも、二重mutation、stale candidate、unknown縮退、blind retryがP0として明示されています。

P0-1. exactly-one arbiterがcanonical schemaから切断されている

run_repair_action_apply()は次を検査しています。

contract_patch_plan = parsed.get("contract_patch_plan")
repair_action = parsed.get("repair_action")

しかし、canonical refinement_preflight_result/v1で定義されているフィールドはcontract_updateであり、contract_patch_planはadditionalProperties: falseにより有効なartifactへ格納できません。さらにproducerはcontract_update=contract_update_handoffとrepair_action=repair_action_projectionを同じresultへ同時に渡せます。つまり、正規artifactで発生する「既にcontract updateを実施したresult+repair_action」をarbiterは検出しません。

AC1のテストはschema-validなpreflight resultを通さず、存在しないcontract_patch_planをhelperへ直接渡しています。そのため、helperのunit testは通ってもproduction invariantは成立していません。

必要な修正

canonical schemaに明示的なmutation_intent discriminated unionを設けるか、少なくとも次をschemaとproducerの双方で強制してください。

  • contract_updateまたは未消費のpatch-plan handoffが存在するresultにはrepair_actionを出さない。
  • repair_action.applyはcontract_updateが存在したらmultiple_mutation_intentsで拒否する。
  • 一方のmutation後は、別commandによるfresh preflightからのみ次のintentを生成する。
  • consumer入口でrefinement_preflight_result_v1.schema.jsonを必ず検証する。

P0-2. AC3のprovenance bindingがproductionでは実質的に無効

schema変更ではsource_lane、preflight_run_identity、original_updated_at、source_refs_digestを**repair_action配下**へ追加しています。result_core_sha256はhashes.result_core_sha256です。ところがconsumerは、それらをすべてtop-levelから読んでいます。

parsed.get("source_lane")
parsed.get("original_updated_at")
parsed.get("result_core_sha256")
parsed.get("source_refs_digest")

さらにproducerのrepair_action_projectionは、新規4フィールドを一つも出力していません。その結果、canonical production artifactでは、run identityとupdatedAtとsource refsがnull、source laneがunanchoredへ縮退します。

expected_provenanceがない場合、validatorはtarget repo/issueが呼出し引数と同じことを確認するだけです。production executorが渡すのはissue_number、repo、preflight_result_pathだけで、expected_provenanceはテストから直接注入されているにすぎません。テスト自身もcanonical schemaではないschemaフィールドとtop-level provenanceを組み立てています。

加えて、command parserは既存のIssue-scopedな_is_safe_issue_artifact_path()ではなく、任意repo-relative pathを許す汎用helperを使用しています。candidate側もrepo root内であれば別Issue・別artifact・別用途のregular fileを受理できます。

影響

自己記述JSONが、自身のcandidate digestとrepair-action hashを正しい値として提示できます。production側に独立したrun identityやlatest-action manifest digestがないため、old-run、artifact replacement、source-lane replacementを検出できません。

必要な修正

  • canonical nested fieldsだけを読み、auto-apply対象ではupdatedAt、run identity、source refsを必須・非nullにする。
  • historical pre-migration artifactは「replay確認専用」とし、新規mutationを許可しない。
  • command引数または信頼済みlatest-action referenceから、独立したmanifest digest/run identityを渡す。
  • preflight resultとcandidateの両方を.claude/artifacts/issue-refinement-loop/{issue_number}/以下へ束縛する。
  • replacement後もprovenance validatorを最初から再実行する。

P0-3. updatedAtを使わないためA→B→A ABAを許す

pre-dispatch gateはlive body SHAとoriginal_body_sha256だけを比較し、producer生成時のoriginal_updated_atとcurrent updatedAtを比較していません。二回目のdrift判定もbody digestだけです。

したがって次が成立します。

  1. candidateを本文A、時刻t1から生成。
  2. 本文がA→B→Aと変更され、updatedAtはt3になる。
  3. body SHAは再び一致するため、producer rerunをせず古いcandidateを適用。
  4. transaction inputにはt3のcurrent updatedAtが入るため、直前CASだけは通る。

これは「現在の本文に競合がない」ことしか証明せず、「candidateがcurrent authority epochから生成された」ことを証明しません。依存PR #2026はまさにbody hashとupdatedAtの組合せでA→B→Aを拒否する設計を採用しています。

必要な修正

body SHAまたはupdatedAtのどちらかが変わったらproducerを一度だけ再実行し、replacementについて次を再束縛してください。

current body SHA
current updatedAt
new result_core_sha256
new repair_action_core_sha256
new candidate digest
same source lane
same source refs digest

二回目のlive readでもbody SHAとupdatedAtの双方を照合する必要があります。

P0-4. canonical edit_issue_txn.py receiptを誤った構造で読んでいる

adapterは次をtop-levelから読みます。

txn_result["body_attempted"]
txn_result["remote_current_body_sha256"]
txn_result["errors"]

実際のISSUE_EDIT_TXN_RESULT_V1では以下のnested構造です。

body_update.attempted
body_update.remote_current_body_sha256
content_update.patch_attempted
content_update.mutation_outcome

top-levelに存在するのは主にstatusとmutation_startedです。

特にmutation_outcome_unknownでは、canonical receiptは次の組合せを返し得ます。

mutation_started = false
body_update.attempted = true
content_update.patch_attempted = true
content_update.mutation_outcome = unknown

現在のadapterはこれをpatch_attempted=falseと解釈します。authoritative readback自体はunknown分岐で実行され得ますが、その後のfresh validationはpatch_attempted=falseを理由にスキップされます。applied/no-changeでもnested remote digestと詳細failure codeが失われるため、AC6の「lossless projection」ではありません。

テストstubはbody_attemptedやremote_current_body_sha256をtop-levelへ置いた独自形式であり、canonical receiptとの統合を検証していません。

必要な修正

  • ISSUE_EDIT_TXN_RESULT_V1専用schemaでchild stdoutを検証する。
  • body_updateとcontent_updateを正規に読み取る。
  • outer receiptへ推測変換するのではなく、canonical receiptをboundedなnested objectとしてそのまま保存する。
  • top-level outcome、receipt outcome、patch-attempted、failure code、readback digest間の等価制約をschemaで強制する。

P0-5. fresh validationが失敗しても成功exitになる

phaseとfailure_codeはfresh validationを実行する前に決定され、その後更新されません。したがってmutationがappliedなら、fresh validationがfailedでも次の結果になり得ます。

phase = complete
mutation_outcome = applied
failure_code = null
fresh_validation.status = failed

CLIはfresh validationやphaseを参照せず、mutation_outcome in {"applied", "no_change"}だけでexit 0を返します。

さらにproductionのdefault fresh producerはsource laneを再判定せず、引数のlaneをそのまま返します。source refs digestやpolicy bindingも検証しません。lane promotion/mix-upテストは注入されたtest doubleだけを検査しています。

必要な修正

mutation済みという事実はmutation_outcome=appliedとして維持しつつ、control-plane成功とは分離してください。

fresh validation失敗:
  mutation_outcome = applied
  phase = fresh_validation
  failure_code = source_lane_mismatch | fresh_validation_failed
  process exit != 0

production fresh validationは、元のsource URL/comment ID/body hash/refs digestを入力に、同じcanonical laneでfresh preflightを実行する必要があります。

P0-6. timeout後に結果不明を安全に回収できない

registryの外側timeoutは60秒です。一方、childはreadiness subprocessに最大30秒、その後edit_issue_txn.pyに最大60秒を割り当てています。GitHub readback、producer rerun、artifact処理を除いても最大経路は90秒です。外側supervisorは60秒でchildを終了し、repair consumerによるauthoritative readbackへ戻しません。

また、内側subprocess.run()のTimeoutExpired/OSErrorをこのconsumerは捕捉していません。Pythonのsubprocess.run(timeout=...)はtimeout時にchildをkill・waitした後、TimeoutExpiredをraiseします。([Python documentation]1)

より危険なのは、transaction stdoutが空・truncated・non-JSONだった場合に、無条件で次へ縮退する点です。

{"status": "failed_no_mutation"}

childがPATCH後にstdoutを失った場合でも「mutationなし」と誤報し得ます。GitHubはunsafe methodであるPATCH等のconditional requestを、endpointが個別に明記しない限り一般にはサポートしないと説明しています。HTTP仕様も、非冪等requestは「元requestが未適用と検出できる」等の条件なしに自動再試行すべきでないとしています。([GitHub Docs]2)

必要な修正

  • 全stageで共有するmonotonic deadlineを導入する。
  • 外側timeoutを内側総予算+readback reserveより長くする。
  • edit_issue_txn.py起動後のtimeout、signal、invalid stdoutはすべてunknownにする。
  • transaction receiptをstdoutだけでなく、per-invocation durable artifactにも書く。
  • unknown時は一回だけauthoritative readbackし、candidate/old/thirdを分類する。
  • unreadable stdoutをfailed_no_mutationへ変換しない。

P1-1. 固定名scratch fileにconcurrency raceとsymlink clobberがある

transaction-localと説明されていますが、実際はIssue番号だけで決まる固定名です。

repair-action-apply/issue_2039_repair_action_candidate.md
repair-action-apply/issue_2039_repair_action_txn.json

両方ともPath.write_text()で排他的生成なしに書かれます。同一Issueの並行invocationは互いのcandidate/inputを上書き・unlinkできます。さらに同一権限peerがleaf symlinkを先に置くと、別のwritable fileを上書きできます。PythonのPath.write_text()は同名既存ファイルを上書きします。 ([Python documentation]3)

後段のedit_issue_txn.pyにはsymlink/hardlink拒否がありますが、危険な書込みはその検証より前に完了しています。

修正方針

per-invocation random directoryをmode 0700で作り、directory FDを基準に次のflagsでmode 0600のfileを生成してください。

O_CREAT | O_EXCL | O_NOFOLLOW | O_CLOEXEC

fstat()でregular file・st_nlink == 1を確認し、cleanupもdirfd-relativeに限定するべきです。

P1-2. secure readerはancestor substitutionのTOCTOUを閉じていない

現在のreaderはancestorをpathnameでlstat()した後、full pathnameをos.open()しています。O_NOFOLLOWが保護するのは最終componentだけです。ancestor checkとopen()の間にparent directoryをsymlinkへ差し替えられると、repo外のfileを開く余地があります。

Linuxのopenat()系APIは、pathname prefixが並行変更されるraceを避けるためにdirectory FDを使用します。openat2()のRESOLVE_NO_SYMLINKSは全componentへ作用し、final componentだけを扱うO_NOFOLLOWとは明確に異なります。([man7.org]4)

Linux/WSL2をproduction前提とするなら、次を推奨します。

openat2(rootfd, relative_path,
        RESOLVE_BENEATH |
        RESOLVE_NO_SYMLINKS |
        RESOLVE_NO_MAGICLINKS)

fallbackはcomponentごとにstable directory FDを開くopenat() traversalです。安全性を保証できないplatformではfail-closedにするべきです。

P1-3. result schemaが矛盾状態を許す

現在のschemaは次を許容します。

  • phase=completeかつmutation_outcome=not_attempted
  • mutation_outcome=appliedだがreceipt.mutation_outcome=unknown
  • appliedだがfinal readbackがunresolved
  • fresh validationがfailedだがphase=complete、failure_code=null
  • auto-apply mutationでoriginal_updated_at=null、run identity null
  • top-level failureとreceipt failureの不一致

applied条件が要求しているのはreceipt.patch_attempted=trueとtop-level failure nullだけです。fresh validationの条件は「successだった場合の内部値」しか制約せず、failed時のcontrol-plane状態を規定していません。

schemaには少なくとも次のcross-field invariantが必要です。

top-level mutation_outcome == receipt.mutation_outcome
top-level failure_code == normalized receipt/control-plane failure
phase=complete
  <=> definitive outcome
      and required fresh validation succeeded
applied
  => patch_attempted
     and candidate readback verified
     and fresh validation success
fresh_validation.failed
  => phase=fresh_validation
     and failure_code != null
unknown
  => phase=final_readback
     and failure_code=final_readback_unresolvable

テストがgreenでも検出できなかった理由

現在の主要fixtureはproduction artifactをproducerから生成せず、以下を手作業で構築しています。

  • canonicalではないschemaキー
  • top-levelのoriginal_updated_at/result_core_sha256/source_lane
  • schemaに存在しないcontract_patch_plan
  • flatなtransaction receipt
  • productionでは渡されないexpected_provenance

そのため、各helperの局所的な分岐は検証していても、producer → schema-valid artifact → command policy → executor → canonical edit_issue_txn.py receiptという境界を通していません。

マージ前に必須の追加テスト

  1. canonical producer E2E
    実際のrun_preflight()が生成したschema-valid artifactを、そのままrepair_action.applyへ渡す。test独自JSONは禁止。

  2. dual-intent production shape
    contract_updateとrepair_actionを持つcanonical resultが、GitHub read前に拒否されることを確認する。

  3. ABA
    body A/t1 → B/t2 → A/t3で、t1 candidateが拒否されproducer rerunされることを確認する。

  4. canonical receipt matrix
    実際の_render_result()形状でno_change、applied、mutation_outcome_unknown、failed_after_mutationを検証する。

  5. post-PATCH failure
    controlled executorがmutation後にsleep、stdout truncation、signal終了するcaseで、outer resultがunknownになりreadbackを実施することを確認する。

  6. scratch-file adversarial cases
    candidate/input symlink、同一Issueの二並行実行、cleanup競合、ancestor swapで外部sentinelが変更されないことを確認する。

  7. fresh validation failure
    mutation factはappliedのまま、phase=fresh_validation、failure非null、process exit非0になることを確認する。

推奨アクション

まずrepair_action.applyをproduction-readyとして扱わず、Draftを維持してください。修正順序は、canonical mutation-intent contract → provenance/ABA → canonical receipt adapter → timeout/unknown recovery → fresh-validation state machine → secure scratch/openが妥当です。

現行headではAC1、AC3、AC5、AC6、AC7、AC9、AC10、AC12を達成済みとは判定できません。少なくとも上記P0を解消し、手作りfixtureではないcanonical E2Eが通るまで、マージ承認は出せません。

このレビューではcurrent headのソース、関連Issue/PR/コメント、GitHub上のテスト報告を照合しました。PR記載のテストコマンド自体は、この実行環境では再実行していません。

squne121 and others added 8 commits August 16, 2026 14:02
…ct_update フィールドへ修正する (#2039)

PR #2202 review P0-1: exactly-one mutation-intent arbiter
(resolve_repair_apply_mutation_intent / run_repair_action_apply)は
canonical refinement_preflight_result_v1 に存在しない
contract_patch_plan を検査していたため、実運用の preflight result
(additionalProperties: false)では常に has_patch_plan=False となり、
本来検出すべき「contract_update ハンドオフ済み result に repair_action
が同時に存在する」危険な二重 mutation intent を一切検出できていなかった。

canonical schema上の実フィールド名 contract_update を読み・渡すよう
resolve_repair_apply_mutation_intent() のパラメータ名/ロジック/返却
intent文字列を修正し、run_repair_action_apply() の呼び出し箇所も追随。
test_repair_apply_dual_intent.py を canonical フィールド名に追随させた
(既存6ケース全pass)。

残課題(未着手、レビューコメント参照):
P0-2 provenance nesting不整合、P0-3 ABA(updatedAt未使用)、
P0-4 canonical edit_issue_txn.py receiptのnesting不整合、
P0-5 fresh validation失敗時のexit code、P0-6 timeout/unknown recovery、
P1-1/P1-2 scratch file・secure openのTOCTOU、P1-3 schemaのcross-field
invariant、およびレビュー要求の7新規テスト(canonical producer E2E等)。

Issue #2039
)

PR #2202 review fix (P0-2/P0-3)。

P0-2: repair_action.apply consumer が source_lane/preflight_run_identity/
original_updated_at/source_refs_digest を top-level parsed.* から読んでいたが、
canonical schema ではこれらは repair_action.* (result_core_sha256 は hashes.*)
配下にネストされており、実運用の artifact では常に null/unanchored に縮退して
provenance binding が事実上の no-op だった。producer 側もこれらのフィールドを
一切出力していなかった。producer に source lane 判定
(_determine_repair_source_lane、既存の _resolve_scope_delta_source_kind を
再利用)・run identity・updatedAt キャプチャ・source refs digest 生成を追加し、
consumer 側の読み取りを nested 位置へ修正。CLI エントリポイントにも
expected_provenance を artifact 自身の provenance から構築する経路を追加し、
command parser の artifact path 検証を汎用 repo-relative helper から
Issue-scoped `_is_safe_issue_artifact_path()` へ変更した。

また、canonical producer artifact を実際に consumer へ通す E2E テストを新規
追加した過程で、secure_read_repair_apply_artifact() の expected_sha256 比較が
"sha256:" prefix を strip しておらず、real producer 由来の repair_action.*_sha256
(常に prefix 付き) を渡すと必ず digest_mismatch で拒否される別バグを発見し
同時に修正した(既存の hand-built test fixture は prefix なし bare hex を渡して
いたため今まで検出されなかった)。

P0-3: pre-dispatch drift gate が live body SHA のみを original_body_sha256 と
比較しており、updatedAt を見ていなかったため A(t1) -> B(t2) -> A(t3) の ABA
シーケンスで body SHA が再度一致した際に stale な t1 candidate を rebase なしで
そのまま dispatch できてしまっていた。live updatedAt と producer 記録の
original_updated_at (非null時のみ) も比較対象に追加し、いずれかの mismatch を
drift として扱うよう修正。rerun 後の第二回 drift check にも同様に updatedAt
比較を追加し、rebind 時は新しい body SHA / updatedAt / run identity /
repair_action_core_sha256 / candidate_digest へ再束縛しつつ source_lane と
source_refs_digest は元の値へ pin したままにした。

producer E2E テスト(ハンドビルド fixture ではなく実 run_preflight() 出力を
そのまま consumer へ渡す)と ABA テストを新規追加。fixture-mode input schema
に issue.updatedAt (optional) を追加してテストで producer capture を検証
可能にした。

.claude/skills/issue-refinement-loop/tests/ -k repair: 140 passed
scripts/agent-guards/tests/test_skill_runtime_policy_commands.py: 28 passed
scripts/agent-guards/tests/test_skill_runtime_exec_stdout.py: 9 passed
.claude/skills/issue-refinement-loop/tests/ (full suite): 1490 passed

P0-4, P0-5, P0-6, P1-1, P1-2, P1-3 は本セッションでは未着手(次イテレーション)。

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…#2039)

human adversarial review P0-4 対応。`_repair_receipt_from_txn_result()` が
`edit_issue_txn.py` の canonical `ISSUE_EDIT_TXN_RESULT_V1` を top-level flat
キー(`body_attempted`/`remote_current_body_sha256`)で誤読し、production の
`mutation_outcome_unknown`(mutation_started=false, body_update.attempted=true,
content_update.patch_attempted=true, content_update.mutation_outcome=unknown)
receiptで`patch_attempted=false`に縮退してAC9 fresh validationがスキップされる
バグを修正。`body_update`/`content_update`のnestedフィールドを正しく読み、
patch_attempted=trueかつcontent_update.mutation_outcome=unknownの場合は
top-level statusの読みより優先してmutation_outcomeをunknownへfail-closedする
cross-field consistencyも追加。

既存テストのflat shape stub(バグを覆い隠していた原因)をcanonical nested
shapeへ更新し、P0-4の具体的ハザードを再現するregressionテストを追加。
…it code に反映する (#2039)

PR #2202 review fix-delta (P0-5)。mutation_outcome=applied でも
fresh_validation.status=failed の場合に phase=complete/failure_code=null
のまま隠れていた問題を修正。fresh_validation 失敗時は phase=fresh_validation・
failure_code(source_lane_mismatch|fresh_validation_failed)に上書きし、
mutation_outcome 自体(事実)は変更しない。CLI exit code もこの状態で非0にする。
また default fresh-validation producer が expected_source_lane を単に
echo back するだけだった問題を修正し、fresh_anchor_url/fresh_known_context が
供給された場合は同一classifierで実際に再分類するようにした(注入テスト
double 経由でしか検出できなかったlane mismatchを、実装側でも検出可能に)。

schema (repair_apply_result_v1.schema.json) の allOf 制約も
「mutation_outcome=applied なら failure_code=null」という誤った不変条件
(まさに今回のバグをスキーマ側で固定化していたもの)を修正し、
phase=complete のときのみ failure_code=null を要求するよう変更。

テスト: test_repair_apply_fresh_validation.py に P0-5 検証(phase/failure_code/
mutation_outcome不変、default producerによる実lane再分類、CLI exit code)を
追加。test_repair_action_apply_consumer.py の happy-path fetch stub を
post-mutation の実際の body 変化を反映するよう修正(AC9配線により露呈した
stale fixture)。

CI_TEST_PERFORMANCE_ADVISORY_V1: schemas/配下の変更はcontract_artifact
レーンのcontract変更であり、CI workflow/test-lane構成自体の変更はなし。

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…する (#2039)

registry の外側 timeout(60s)が内側の readiness(30s)+edit_issue_txn.py(60s)
critical path(90s)より短く、outer supervisor が readback 前に child を kill
しうる不整合を修正(outer timeout を 150s へ)。加えて edit_issue_txn.py
subprocess.run() の TimeoutExpired/OSError を未捕捉のままにせず、また
stdout が truncated/non-JSON な場合に failed_no_mutation へ誤って縮退させて
いた箇所を、PATCH が既に dispatch 済みの可能性を考慮し常に
mutation_outcome=unknown として AC5 authoritative-readback 経路へ回すよう
修正。
… (PR #2202 P1-2)

pathname-based lstat()+open()の分離呼び出しは、ancestorチェックとopen()の間に
祖先ディレクトリがsymlinkへ差し替えられるTOCTOUウィンドウを残していた
(review P1-2)。root配下からleafまで全てos.open(dir_fd=...)で連鎖する
component単位のtraversalに置き換え、既にopen済みのFDに対してのみ後続の
componentを解決するため、途中のpathnameを差し替えても後続traversalに
影響しない。openat2(RESOLVE_BENEATH)はCPython os moduleに公開されておらず
ctypes/rawシステムコールを避けたため未使用(fallback選択を正直に明記)。

新規テスト2件:
- 全os.open呼び出しがdir_fd相対でbare componentのみを使うことを確認
- ancestorをtraversal中にswap→revertしても実際のtrusted contentが
  読まれることを確認(TOCTOUウィンドウの不発を実証)

既存13テストは全てpass、ac7 error文言の後方互換を維持(errno分岐で
repair_apply_ancestor_is_symlink/repair_apply_leaf_is_symlink等を再現)。
…る (PR #2202 P1-1)

issue番号のみで決まる固定パス(issue_<N>_repair_action_candidate.md/txn.json)は
同一Issueへの並行呼び出し同士の上書き競合に加え、同一権限の別プロセスが
事前にsymlinkを設置してarbitrary writable fileへ書き込みをリダイレクトできる
問題があった(review P1-1)。これはedit_issue_txn.py自身のsymlinkチェックより
前に発生する。

tempfile.mkdtemp(dir=...)でallowed_write_roots配下にmode 0700のper-invocation
random subdirを作成し、その中の各scratchファイルをdir-FD相対の
O_CREAT|O_EXCL|O_NOFOLLOWで生成するよう変更(_repair_apply_scratch_create)。
生成後はfstatでregular file かつ st_nlink==1を確認してから書き込む。
cleanupもos.unlink(name, dir_fd=...)によるdir-FD相対unlinkに変更
(_repair_apply_scratch_unlink)。

新規テスト4件(test_repair_apply_unknown_outcome.py):
- 実dispatchが固定ファイル名を使わずrandom subdirへ書き込み、
  成功後にscratch entryを全てcleanupすることを確認
- 事前設置symlinkがO_EXCLでfail-closed拒否されること
- 正常系でregular file+st_nlink==1が検証されることを確認
- ancestorがrenameされてもdir-FD相対unlinkが実際のfileだけを削除し、
  stale pathnameに置かれたdecoyへ影響しないことを確認

repair関連pytest 157件(153既存+4新規)全てpass、ruffもclean。
squne121 and others added 4 commits August 16, 2026 15:41
… P1-3)

human adversarial review P1-3(結果schemaが矛盾状態を許す)への対応。
repair_apply_result_v1.schema.json に allOf/if-then のcross-field invariantを
追加(top-level/receipt mutation_outcome・failure_codeの等価性、applied requires
final_readback verified+patch_attempted、unknown requires phase=final_readback、
auto-apply dispatchはprovenance.original_updated_at/preflight_run_identity非null必須等)。

run_refinement_preflight.py側もあわせて2点修正:
- applied outcomeでfinal readbackが得られない場合はunknownへ降格(readback未確定のまま
  appliedを報告しない)
- provenance.original_updated_at/preflight_run_identityがnullのまま自動適用dispatchへ
  進む経路をpre-dispatchでfail-closedに変更

既存3テストファイル(test_repair_action_apply_consumer/stale_guard/unknown_outcome)が
canonical schemaのnested repair_action.*ではなくtop-levelのレガシー形状でfixtureを
構築していたため(P0-2で未修正のまま残っていた個別ギャップ)、上記fail-closed化で
显在化・修正。scripts/agent-guards/tests/test_skill_runtime_exec_stdout.pyのapplied
経路fixtureも同様の理由(P0-4未反映の旧flat形状)で修正。

レビュー必須追加テスト7項目のうち、以下を新規追加:
- required test 2 (dual-intent production shape): 実producer出力へcontract_update
  をspliceしGitHub read前拒否を検証
- required test 3 (ABA) 補強: 既存テストへ「stale t1 candidateが実際にdispatch
  されない」「post-rerunで新run identityへ再束縛される」assertionを追加
- required test 4 (canonical receipt matrix): edit_issue_txn.pyの実_render_result()
  を用いてno_change/applied/mutation_outcome_unknown/failed_after_mutationを検証
- required test 6 (scratch-file adversarial) 補強: 同一Issue番号の2回連続invocation
  がscratch pathを衝突させないことを検証

required test 1/5/7は既存P0-2/P0-6/P0-5テストで実質カバー済みと確認(新規追加なし)。

Co-Authored-By: Claude Sonnet 5 <[email protected]>
remote_current_body_sha256 の f-string 行が120桁を超えていたため
括弧で折り返して再フォーマットする。挙動は変更しない。

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@squne121

Copy link
Copy Markdown
Owner Author

判定

REQUEST_CHANGES

reviewed_head_sha: 6cc0c559a28bbd20f96fbf8547e1b81a359d9655

Mergeability / CI

Required CI checks(build/typecheck/test/lint/validate-generated-artifact)は本 head で全 pass。

Evidence Check

先行 REQUEST_CHANGES(#issuecomment-5305806515)の P0-1〜P0-6、P1-1〜P1-3 は、production code(resolve_repair_apply_mutation_intent()、edit_issue_txn._render_result() 実形状、run_preflight() 実 E2E 等)に対する独立検証で genuine に解消済みと確認した。ハンドビルド fixture ではなく実 producer/consumer path を通す test も確認した。

Blockers

Non-blockers(warnings)

  • P0/P1 の9項目は独立検証で解消済みと確認。
verdict: REQUEST_CHANGES
reviewed_head_sha: "6cc0c559a28bbd20f96fbf8547e1b81a359d9655"
blockers:
  - "Allowed Paths gate fail_closed: .claude/skills/issue-refinement-loop/schemas/refinement_preflight_input.schema.json and .claude/skills/issue-refinement-loop/tests/test_repair_apply_production_provenance.py are changed but not listed in Issue #2039's live Allowed Paths, and no Scope Delta section documents the extension in the PR body."
warnings:
  - "All 9 P0/P1 blockers from the prior REQUEST_CHANGES were independently re-verified against the actual diff and appear genuinely resolved, including production-path E2E tests."

@squne121

Copy link
Copy Markdown
Owner Author

判定

APPROVE

reviewed_head_sha: 6cc0c559a28bbd20f96fbf8547e1b81a359d9655

Mergeability / CI

Required CI checks(build/typecheck/test/lint/validate-generated-artifact/python-test)全 pass。PR Body Japanese Check も pass。

Evidence Check

Blockers

なし

Non-blockers(warnings)

  • Draft PR / merge_state_status=BLOCKED は Draft の通常状態であり merge blocker ではない。人間の最終マージ判断待ち。
verdict: APPROVE
reviewed_head_sha: "6cc0c559a28bbd20f96fbf8547e1b81a359d9655"
blockers: []
warnings:
  - "Draft PR / merge_state_status=BLOCKED — expected for Draft, not merge-blocking per procedure; human final merge decision pending."

@squne121
squne121 marked this pull request as ready for review August 16, 2026 07:27
@squne121
squne121 merged commit 12ae5b8 into main Aug 16, 2026
59 of 62 checks passed
@squne121
squne121 deleted the worktree-issue-2039-repair-action-apply-consumer branch August 16, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

実装: repair_action candidate を controlled Issue transaction へ自動適用する main control-plane consumer を追加する

1 participant