Repository navigation
feat: structural repair actionをcontrolled consumerへ接続する - #2400
Merged
Merged
Conversation
template-derived structural_repair_action/v1 の auto_apply_safe bundle を 既存 edit_issue_txn.py controlled transaction core へ接続し、修復可能な missing_required_section が severity precedence によって永続的に deferred される blocked precedence deadlock(#2180 の実インシデント)を 解消する。 - command_registry.py に structural_repair_action.apply エントリを追加 (execution_class は repair_action.apply と別値) - run_refinement_preflight.py に run_structural_repair_action_apply() を 追加。per-item digest 再検証 → 行シフト安全な合成 → 既存 GitHub mutation dispatch core(_dispatch_candidate_body_via_edit_txn / _dispatch_candidate_body_default_transaction、run_repair_action_apply() から抽出した共有ヘルパー)経由で single mutation・stale guard・ authoritative readback・fresh validation まで実行 - severity arbitration に _structural_deadlock_override_eligible() を 追加し、全件 auto_apply_safe かつ過不足なく missing_required_section を coverage する場合のみ structural_repair_action_deferred を出さず needs_fix/apply_deterministic_structural_repair を採用 Co-Authored-By: Claude Sonnet 5 <[email protected]>
9 tasks
Contributor
Preview URLPreview removed (PR #2400 closed). |
…tructural-repair-consumer
squne121
marked this pull request as ready for review
August 29, 2026 11:59
This was referenced Aug 29, 2026
Closed
10 tasks
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
template-derived
structural_repair_action/v1(Issue #995 の mutation-free producer)のauto_apply_safebundle を、既存のedit_issue_txn.pycontrolled transaction core(Issue #2039 / PR #2202 が確立したパターン)へ接続する。command_registry.pyにstructural_repair_action.applyを新規登録し、run_refinement_preflight.pyに per-item digest 再検証・行シフト安全な body 合成・共有 mutation dispatch core・fresh validation を備えた新規 consumer 関数run_structural_repair_action_apply()を追加した。あわせて severity arbitration に限定条件付きの deadlock override を追加し、全件auto_apply_safeかつ過不足なくmissing_required_sectionを coverage する structural candidate がstructural_repair_action_deferredによって永続的に抑制される #2180 実インシデントの blocked precedence deadlock を解消した。Checks
pnpm typecheck: PASS(TypeScript エラーなし。本 PR は Python 専用スキルコード変更のため影響なし)pnpm lint: PASS(ESLint: No issues found)pnpm test: PASS(Test Files 112 passed / Tests 1887 passed)pnpm build: PASS(vite build 成功)uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py: PASS(24 passed)git diff --check: PASS(whitespace エラーなし)Schema Change Applicability
refinement_preflight_result_v1.schema.jsonのstructural_repair_action/repair_actionフィールド定義は一切変更していない(Out of Scope)。既存フィールド定義をそのまま再利用し、run_structural_repair_action_apply()の戻り値(structural_repair_apply_result/v1)は preflight result schema の一部ではない、この consumer 独自の stdout 形状(Allowed Paths が schemas/ を含まないため新規 schema ファイルも追加していない)。Schema Consumer Inventory
schema 変更を伴わないため(
not_schema_change)、consumer inventory の詳細記入は対象外。Safety Claim Matrix
test_consumer_reuses_edit_issue_txn_core/test_multi_item_synthesis_reverifies_digests_before_dispatch(dispatch 呼び出し回数 1 を assert)test_whole_body_drift_without_replay_rejected/test_stale_anchor_heading_removed_from_live_body_rejected/test_tampered_candidate_section_digest_rejectedtest_consumer_reuses_edit_issue_txn_coreの_repair_receipt_from_txn_result経由 readback 呼び出し(generic lane と共有)test_receipt_projection_matches_generic_lane_semantics(mutation_outcome_unknownでも dispatch 呼び出しは 1 回のまま)gh issue editを経由しない(edit_issue_txn.py --input-fileのみ)_dispatch_candidate_body_via_edit_txn()の実装(generic lane から抽出した共有コア。新規 subprocess 呼び出しを追加していない)no_changeに解決するtest_replay_against_already_applied_body_is_idempotent_no_changeNotes
AC 別ステータス
structural_repair_action.applyのexecution_classはexact_structural_repair_action_applyでrepair_action.apply(exact_repair_action_apply)と別値。auto_apply_safeかつmissing_required_sectionを過不足なく coverage する structural candidate に対し、severity arbitration がstructural_repair_action_deferredを追加せずneeds_fix/apply_deterministic_structural_repairを採用する。argvは固定 list、issue_number/repo/preflight_result_pathのプレースホルダー命名はrepair_action.applyと同一。run_repair_action_apply()から抽出した共有ヘルパー_dispatch_candidate_body_via_edit_txn()/_dispatch_candidate_body_default_transaction()を両 lane が呼び出す。2 件以上の同時 auto_apply_safe item を行シフトを考慮した順序で単一 body へ合成し、合成前に各 item の digest を再検証する。build_structural_repair_bundle()再実行)で対象 blocker が解消し、合成後 body が意図した内容と byte-exact に一致することを確認。test_repair_action_apply_consumer.py等)が全件変更なく PASS(137 passed)。Verification Commands(実行結果)
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_structural_repair_action_apply_consumer.py -k test_command_registry_entry_distinct_execution_class -v # => 1 passed$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_structural_repair_deadlock_arbitration.py -k test_full_coverage_auto_apply_safe_not_deferred -v # => 1 passed$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_structural_repair_action_apply_consumer.py -k test_consumer_reuses_edit_issue_txn_core -v # => 1 passed$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_structural_repair_action_apply_consumer.py -k test_fresh_preflight_after_apply_clears_blocker -v # => 1 passed$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_repair_action_apply_consumer.py .claude/skills/issue-refinement-loop/tests/test_repair_action_apply_stale_guard.py .claude/skills/issue-refinement-loop/tests/test_repair_apply_dual_intent.py .claude/skills/issue-refinement-loop/tests/test_repair_apply_fresh_validation.py .claude/skills/issue-refinement-loop/tests/test_repair_apply_production_provenance.py .claude/skills/issue-refinement-loop/tests/test_repair_apply_provenance.py .claude/skills/issue-refinement-loop/tests/test_repair_apply_result_schema.py .claude/skills/issue-refinement-loop/tests/test_repair_apply_secure_open.py .claude/skills/issue-refinement-loop/tests/test_repair_apply_unknown_outcome.py -v # => 137 passed$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/ -q # => 1829 passed, 4 failed(下記「既知の pre-existing 失敗」参照。origin/main の clean checkout でも同一 3 件が再現する uv バージョンピン不一致、および 1 件の flaky な live smoke。いずれも本 PR の変更とは無関係)既知の pre-existing 失敗(本 PR の変更と無関係)
test_command_registry.py::TestAuthorityTransportPrivilegedExecutorRealSubprocessDispatchの 3 件:skill_runtime_exec.py内のuv_version_mismatchによるサンドボックス環境依存の失敗。origin/mainの clean worktree checkout で同一 3 件を再実行し、同じ失敗が再現することを確認済み(本 PR の変更前から存在)。test_codebase_investigator_agy_fallback_smoke.py::test_live_smoke_consumer_agy_timeout_native_fallback_when_allowed: 単独実行では PASS(flaky な live smoke、タイミング依存)。Scope Delta
N/A(Allowed Paths の 4 ファイルのみ変更。追加のスコープ拡張なし)。
関連 Issue(参照のみ、closing keyword は使用しない)
実装ノート
command_registry.py:structural_repair_action.applyエントリを新規登録(execution_class: exact_structural_repair_action_apply、argvは固定 list)。run_refinement_preflight.py:run_repair_action_apply()内の transaction dispatch ロジックを_dispatch_candidate_body_via_edit_txn()/_dispatch_candidate_body_default_transaction()として top-level 抽出し、両 lane が同一コアを再利用する形に整理(既存 9 テストは無改変で PASS)。run_structural_repair_action_apply()を新規追加。artifact 読込 → disposition/insertion 検証 → live body に対する stale guard(whole-body sha 比較 + AC10 類似の idempotent replay 検出)→ per-item digest 再検証 → 行シフト安全な body 合成 → 共有 dispatch core 呼び出し → fresh validation、という流れ。structural_repair_action_deferredブロック)に_structural_deadlock_override_eligible()を追加。全 item がauto_apply_safeかつinsertion.disposition != "ambiguous"、かつrequired_sections/required_contract_keysの union と bundle の coverage が完全一致し、かつblockersがmissing_required_section[:*]/structural_repair_action_deferred:*/PLANNER_FAIL_CLOSED(実装: e2e performance benchmark の percentile estimator を before/after/provider/gate-ready 全経路で統一する #2180 実インシデントで同時発生することが確認済みの companion marker)のみで構成される場合に限り、deferred を発生させずneeds_fix/apply_deterministic_structural_repairを採用し、該当 blocker を clear する。test_structural_repair_action_apply_consumer.py15 件、test_structural_repair_deadlock_arbitration.py8 件)を追加。producer 由来の production-shaped fixture(build_structural_repair_bundle()を実際に呼び出す)を優先し、手書き digest は使用していない。本 Issue を解決するための実装 PR である。
Closes #2396