Skip to content

実装: issue-refinement-loop/SKILL.md の apply_deterministic_repair 記述を repair_action.apply(#2039) 実装後の現行挙動へ更新する #2346

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "issue-refinement-loop/SKILL.md の apply_deterministic_repair 記述を repair_action.apply(#2039) consumer実装後の現行 main に整合させ、false block regression(#2240 で実害確認済み)を再発させない"
change_kind: docs

Parent Issue

なし(単独改善)

Parent Goal Ref

Current Validated Scope

Remaining Parent Gaps

なし

Outcome

.claude/skills/issue-refinement-loop/SKILL.md の該当節が、repair_action.apply(Issue #2039 / PR #2202、2026-08-16 マージ済み・command_registry.py の ISSUE_REFINEMENT_COMMAND_REGISTRY_V1 に登録済み)が実装済み・production reachable な controlled consumer であることを正しく反映し、「この orchestrator は現時点では auto-apply consumer を持たない」という stale な記述を含まない状態になっていること。同時に、NEXT_ACTION: apply_deterministic_repair を受信した main orchestrator が既存 repair_action.apply consumer を実際に consume する手順(preflight.run の repair candidate 検出 → worktree bootstrap による active-issue binding → repair_action.apply 呼び出し → mutation_outcome(applied/no_change/unknown/not_attempted)ごとの分岐 → readback → fresh preflight 再実行)が SKILL.md に明記され、git commit された状態を完了とする。

Runtime Verification Applicability

  • decision: immediate
  • reason: .claude/skills/issue-refinement-loop/SKILL.md の手順記述変更(docs/dev/extension-surface-runtime-policy.yaml の risk-trigger rule skill-invocation-procedure-or-contract-change および subagent-lifecycle-start-stop-delegation-fallback に該当)に該当するため、同 policy 上 decision: immediate が必須
    applicable_acs: AC1, AC2, AC3, AC4, AC5, AC6
    execution_environment: repository チェックアウト環境での rg -n によるテキスト照合のみ(外部プロセス起動・追加のランタイム・認証は不要)。本 Issue は SKILL.md の1節の prose 記述更新のみでスクリプト・schema 変更を伴わないため、worktree-agent-runtime-smoke 相当の system test は不要と判断し、静的テキスト照合を verification artifact として採用する
    skip_conditions: なし(rg -n 実行に外部依存・secret・認証がないため SKIP 条件は生じない)
    fallback_policy: SKIP は想定しない。万一 rg が利用不可な実行環境に遭遇した場合は fail-closed とし、human judgment へエスカレーションする(advisory な握りつぶしは行わない)
    artifact_requirements: AC1〜AC6 それぞれに対応する Verification Commands セクションの rg -n(または rg -c)実行結果(コマンド文字列・stdout・exit code)を実装完了報告(PR body もしくは実装完了コメント)に記録する

In Scope

Out of Scope

Acceptance Criteria

  • AC1: SKILL.md の該当節が「この orchestrator(issue-refinement-loop)は現時点では」で始まる stale な文言を含まない
  • AC2: SKILL.md が repair_action.apply という command id に言及している
  • AC3: SKILL.md が repair_action.apply 呼び出しに worktree bootstrap による active-issue binding が必要である旨に言及している
  • AC4: SKILL.md が fresh preflight 再実行までの一連の流れ(readback を経て preflight を再実行する旨)に言及している
  • AC5: SKILL.md が mutation_outcome の applied / no_change / unknown / not_attempted の4値それぞれについて orchestrator 側の扱いに言及している
  • AC6: SKILL.md が unsafe(auto_apply_safe 以外)な disposition は引き続き fail-closed で human judgment route のままであることに言及している

Verification Commands

# AC1
# stale 文言(consumer 不在という古い記述)が0件であること
# baseline-expect: pass
$ rg -c "この orchestrator(issue-refinement-loop)は現時点では" .claude/skills/issue-refinement-loop/SKILL.md
# AC2
# repair_action.apply という command id への言及が1件以上あること
# baseline-expect: fail
$ rg -c "repair_action.apply" .claude/skills/issue-refinement-loop/SKILL.md
# AC3
# worktree bootstrap による active-issue binding への言及が1件以上あること
# baseline-expect: fail
$ rg -c "worktree bootstrap" .claude/skills/issue-refinement-loop/SKILL.md
# AC4
# fresh preflight 再実行への言及が1件以上あること
# baseline-expect: pass
$ rg -c "fresh preflight" .claude/skills/issue-refinement-loop/SKILL.md
# AC5
# mutation_outcome の not_attempted 分岐への言及が1件以上あること
# baseline-expect: fail
$ rg -c "not_attempted" .claude/skills/issue-refinement-loop/SKILL.md
# AC6
# auto_apply_safe 以外は fail-closed human judgment のままである旨への言及が1件以上あること
# baseline-expect: pass
$ rg -c "auto_apply_safe" .claude/skills/issue-refinement-loop/SKILL.md

Allowed Paths

  • .claude/skills/issue-refinement-loop/SKILL.md

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合

Required Skills

なし

Required Design References

  • .claude/skills/issue-refinement-loop/SKILL.md(本 Issue の編集対象そのもの。既存手順記述の正本)
  • .claude/skills/issue-refinement-loop/scripts/command_registry.py(repair_action.apply の canonical registry 定義)
  • .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py(mutation_outcome 分岐ロジックの実装箇所)

Scope Delta(任意)

N/A

Notes for Reviewer

Activity

  1. added
    phase/implementation
    agent/implementer
    enhancement
    triage-required
    on Aug 25, 2026
  2. squne121 commented on Aug 25, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

  3. squne121 commented on Aug 25, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-08-25T20:31:40Z)

  4. squne121 commented on Aug 29, 2026

    @squne121
    OwnerAuthor

    fix_delta 実施報告(PR #2351 blocker解消)

    検出した blocker

    PR #2351 の元実装は .claude/skills/issue-refinement-loop/SKILL.md の該当節(169行目付近)で、repair_action.apply の典型 invocation を以下のように記述していた:

    uv run python3 scripts/agent-guards/skill_runtime_exec.py --command-id repair_action.apply --issue-number <N> --repo <owner/repo>
    

    しかし現行 main の scripts/agent-guards/skill_runtime_command_policy.py::parse_exact_skill_runtime_repair_action_apply_command()(1194-1264行目付近)は固定長12トークンの exact-match parser であり、--apply-repair-action <preflight_result_path> という4番目の必須フラグ+値ペアが無いと len(tokens) != 12 で parser が None を返し実行不能となる(skill_runtime_exec.py 側にも is_repair_action_apply_command and not args.apply_repair_action の明示エラーがある)。この docs が案内する invocation 例は実行不能であり blocker と判断した。

    修正内容

    .claude/skills/issue-refinement-loop/SKILL.md の該当一文を以下のように修正した:

    1. invocation 例に --apply-repair-action <preflight_result_path> を追加し、12トークンの exact-match parser に整合させた。
    2. <preflight_result_path> は _is_safe_issue_artifact_path()(同 policy ファイル 637-662行目付近)により、対象 Issue 自身の .claude/artifacts/issue-refinement-loop/<N>/ 配下の fresh artifact パスに限定され、他 Issue の artifact や任意 repo-relative path は拒否される旨を補記した。

    変更は Allowed Paths(.claude/skills/issue-refinement-loop/SKILL.md)内の1行差分(1 insertion, 1 deletion)のみ。既存 AC1〜AC6 のキーワード(repair_action.apply、worktree bootstrap、fresh preflight、not_attempted、auto_apply_safe、stale文言不在)は維持している。

    検証結果

    • uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_thin_entrypoint.py -v → 10 passed
    • wc -l .claude/skills/issue-refinement-loop/SKILL.md → 499行(500行以内)
    • rg -c "apply-repair-action" .claude/skills/issue-refinement-loop/SKILL.md → 1
    • AC1〜AC6 Verification Commands 全て PASS(AC1: stale文言0件、AC2: repair_action.apply 1件、AC3: worktree bootstrap 1件、AC4: fresh preflight 2件、AC5: not_attempted 1件、AC6: auto_apply_safe 2件)

    反映先

  5. squne121 commented on Aug 29, 2026

    @squne121
    OwnerAuthor

    PR #2351 に対する人間 reviewer の敵対的レビュー(https://github.com/squne121/loop-protocol/pull/2351#issuecomment-5459980387)を反映した fix_delta round 2 を実施しました(コミット 52e20790892034fea427fa6bea3efe1b5cbd1494、既存 branch worktree-issue-2346-apply-deterministic-repair-docs へ push 済み)。

    対応内容(実装とのソース照合済み)

    1. preflight artifact path の絶対パス/相対パス不整合: <preflight_result_path> は canonical main root からの repo-relative path でなければならない旨、ARTIFACT: が出力する絶対パスはそのまま渡すと skill_runtime_command_policy.py に拒否されるため相対パスへ正規化してから渡す旨を SKILL.md に明記しました。
    2. mutation_outcome のみで判定すると発生する成功誤判定・not_attempted 一律誤分類: phase / failure_code を含めた複合成功条件、phase: fresh_validation や consumer 非ゼロ終了時の implementation authorization 抑止、not_attempted の環境系 failure_code(secure-open・provenance・transaction 等)を Step 4 rewrite ではなく環境/control-plane recovery へ倒す分岐を SKILL.md に明記しました。
    3. worktree branch/basename 正規表現の記述誤り: worktree_catalog.py::select_issue_worktrees() の実装(worktree- prefix は branch のみ任意、path basename には許容されない)に合わせて記述を修正しました。

    検証結果

    • uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_thin_entrypoint.py -v → 10 passed
    • wc -l .claude/skills/issue-refinement-loop/SKILL.md → 499(500行以内)
    • 本 Issue の AC1〜AC6 Verification Commands(rg -c ...)を再実行し全て期待どおりの結果

    Allowed Paths(.claude/skills/issue-refinement-loop/SKILL.md)以外の変更はありません。既存 PR #2351 のまま更新済みです。

  6. added a commit that references this issue on Aug 29, 2026
  7. removed
    triage-required
    on Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/implementerenhancementphase/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions