Skip to content

feat: route structural repair actions - #2408

Merged
squne121 merged 6 commits into
mainfrom
worktree-issue-2402-structural-repair-root-runtime
Aug 30, 2026
Merged

squne121 merged 6 commits into
mainfrom
worktree-issue-2402-structural-repair-root-runtime

Conversation

@squne121

@squne121 squne121 commented Aug 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • structural_repair_action.apply 専用の root runtime transport を追加し、generic repair_action.apply と command ID、outer flag、exact policy を分離しました。
  • canonical apply_deterministic_structural_repair route、target-Issue の repo-relative artifact 正規化、成功時だけの fresh preflight / Step 2 resume gate を実装しました。
  • structural child の stdout/stderr は bytes のまま relay するため、CRLF と invalid UTF-8 を保持します。root は nested structural payload semantics を再解析しません。

Closes #2402(この PR は Issue #2402 を完了対象として関連付けます)

Checks

  • focused structural policy、executor、documentation の VC を current head で実行し、すべて成功しました。
  • root wiring、structural deadlock-arbitration、generic repair consumer の回帰検証を実行し、既存の挙動を維持しました。
  • pnpm typecheck、pnpm lint、pnpm test(112 files / 1887 tests)、pnpm build はすべて成功しました。
  • uv run --locked pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py -q は 24 passed でした。
  • git diff --check は whitespace error を検出しませんでした。

受け入れ条件の達成状況

以下では、各受け入れ条件を実装差分と独立実行できる検証結果へ一対一で対応付けます。AC4 と AC5 は文字列検索ではなく、実際の root executor、exact policy、command registry、および fixture child を通過する subprocess boundary を検証します。fixture だけを置換し、policy・registry・consumer の意味論を test 用に再実装していません。AC8 は Claude agent availability に依存させず、変更範囲と安全境界の負の保証として PR review で照合します。

  • AC1: canonical apply_deterministic_structural_repair route は structural_repair_action.apply と --apply-structural-repair-action だけを使い、target-Issue repo-relative artifact を要求します。
    • Evidence: rg -n "apply_deterministic_structural_repair" .claude/skills/issue-refinement-loop/SKILL.md で route の記載を確認しました。
  • AC2: dedicated structural outer flag を追加し、generic / structural apply flags を相互排他にしました。
    • Evidence: uv run --locked pytest scripts/agent-guards/tests/test_skill_runtime_policy_commands.py -k "structural_repair_action_apply" -v は 12 passed でした。
  • AC3: structural exact policy は fixed command shape、repository、target Issue artifact、canonical root/default branch、active Issue worktree を検証します。
    • Evidence: 同 focused policy VC の 12 passed が、受理条件と拒否条件を確認します。
  • AC4: production root executor → real exact policy → real registry → fixture leaf child chain は exact argv、byte-for-byte stdout/stderr、CRLF、invalid UTF-8、nonzero return code を検証します。
    • Evidence: uv run --locked pytest scripts/agent-guards/tests/test_skill_runtime_exec_stdout.py -k "structural_repair_action_apply" -v は 4 passed でした。
  • AC5: missing/mixed/extra flags、wrong pairing、unsafe artifact path、wrong repo/Issue/cwd/branch/active-worktree は child spawn 前に拒否されます。
    • Evidence: 同 structural executor VC は 4 passed であり、negative case の fixture child spawn count 0 を確認します。
  • AC6: documentation-contract test は exit 0 + complete + null failure_code + applied/no_change のみを resume 可とし、unknown / not_attempted / incomplete / nonzero の blind retry を禁止します。
    • Evidence: uv run --locked pytest scripts/agent-guards/tests/test_skill_runtime_policy_commands.py -k "structural_repair_route_documents_resume_gate" -v は 1 passed でした。
  • AC7: generic root wiring と structural / deadlock / generic repair consumer の回帰を維持します。
    • Evidence: root test files は 54 passed、test_structural_repair_action_apply_consumer.py、test_structural_repair_deadlock_arbitration.py、test_repair_action_apply_consumer.py は 34 passed でした。
  • AC8: verification は live canary、network/auth dependency、credential requirement、schema / ledger / persistent state store / generic broker、permission broadening、unrelated runtime harness を追加していません。
    • Evidence: git diff --check は PASS であり、live Allowed Paths gate、Schema Change Applicability: not_schema_change、Schema Consumer Inventory: N/A、下記 Safety Claim Matrix を fresh review で照合します。

Runtime Verification Evidence(実行時検証証跡)

この section は reframe 後の causal runtime evidence のみを記録します。対象は structural root dispatch の outer transport であり、実行されない generic worktree inspection や agent identity discovery を成功証拠に数えません。child の標準出力・標準エラーは bytes のまま受け渡され、改行表現と UTF-8 として復号できない値も変更されないことを current head で確認しました。fixture child 以外は production 実装を使用し、live GitHub mutation、network、認証、credential を必要としません。

  • Applicable ACs: AC4, AC5。今回の causal runtime verification はこの二つだけです。
  • Tested head: 6a647c2c046152b289e72aacd06e72fd58aac4a5
  • Command: uv run --locked pytest scripts/agent-guards/tests/test_skill_runtime_exec_stdout.py -k "structural_repair_action_apply" -v
  • Result: PASS — 4 passed。実行結果は current head に対応します。
  • Observed evidence: real root executor → exact policy → real registry → fixture leaf child、exact child argv、byte-for-byte stdout/stderr relay、CRLF と invalid UTF-8 preservation、nonzero child return-code propagation、invalid-input pre-spawn rejection/no child spawn を確認しました。
  • Fallback: none。代替経路を PASS として扱っていません。
  • Live GitHub mutation: none。runtime verification は hermetic fixture-child test だけで完結します。

以前の generic worktree-agent-runtime-smoke observation は、controlled Route A reframe により superseded です。その smoke はこの PR の structural dispatch boundary を invoke / observe していないため、現在の AC evidence には使用しません。

許可パス準拠

変更ファイルは Issue #2402 の Allowed Paths に限定されています。

以下の五つだけが変更対象であり、いずれも live Issue contract の許可パスです。

  • .claude/skills/issue-refinement-loop/SKILL.md
  • scripts/agent-guards/skill_runtime_exec.py
  • scripts/agent-guards/skill_runtime_command_policy.py
  • scripts/agent-guards/tests/test_skill_runtime_policy_commands.py
  • scripts/agent-guards/tests/test_skill_runtime_exec_stdout.py

generic と structural の分離

  • generic repair_action.apply は既存の --apply-repair-action exact profile を維持します。
  • structural structural_repair_action.apply は --apply-structural-repair-action の組だけを受理します。
  • 両 flag、wrong command/flag pairings、extra argv、absolute/traversal/symlink/cross-Issue paths、wrong repo/Issue/cwd/branch/active context は child spawn 前に拒否します。

Schema Change Applicability

  • decision: not_schema_change
  • reason: この PR は既存 registry entry と既存 structural consumer への到達経路を配線するだけであり、machine-readable schema の key、type、semantics を追加・変更しません。

Schema Consumer Inventory

N/A — schema change はありません。このため consumer migration や compatibility migration も不要です。

Safety Claim Matrix

この表の主張は、今回変更した command transport と検証可能な境界に限定します。structural consumer の payload 解釈、既存 registry argv、schema、権限モデル、GitHub 上の Issue mutation はこの PR の制御対象に含めません。ここに記載しない可用性・権限・外部サービスを暗黙に保証するものではありません。

Claim Implemented? Not controlled Evidence Follow-up
command/flag/path/context isolation yes N/A focused policy と executor VCs N/A
byte-exact stdout/stderr relay と pre-spawn rejection yes N/A CRLF と invalid UTF-8 を含む structural fixture-child VC N/A
runtime verification で live GitHub mutation を行わない yes N/A hermetic fixture-child tests N/A

C1 調整

#2393、#2398、#2403 とは shared paths があっても semantic non-conflict です。#2408 は structural runtime profile と preflight route だけを扱い、contract-update profile、Step 2 operator-intervention route、GH_CONFIG_DIR environment propagation を変更しません。

Notes

Add a distinct exact root transport lane for the existing structural repair consumer and document its resume gate.

Co-Authored-By: Claude Code <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

Preview URL

✅ verified live assets: https://squne121.github.io/loop-protocol/pr-2408/

The preview will be removed when this PR is closed.

Test and others added 3 commits August 30, 2026 01:50
@squne121

Copy link
Copy Markdown
Owner Author

推奨は、PR #2408 の実装をさらに広げる前に、PR body の機械可読性を直し、そのうえで AC8 が本当に #2402 の merge gate であるべきかを fresh に再判定することです。

現在の PR は open / Draft / mergeable で、head は e1cc66ec2eda65c614cd47fb5d1194fc79bef2b2。main は d0e0e6993e8182200cd90b02533697f81cede82b で PR の base と一致しているため、現時点では「main に追従していない」問題はありません。

一方、確実な修正点が1つあります。現在の PR 本文は ## 受け入れ条件対応 と ## 動作検証証跡 になっていますが、現行 pr-review-judge は ## 受け入れ条件の達成状況 に各 AC の [x]/[ ] + 根拠、immediate runtime AC には ## Runtime Verification Evidence を要求しています。したがって、内容が十分でも現在の見出し・形式のままだと review gate で落ち得ます。

AC8 は別問題です。現行 #2402 は AC4/AC5/AC8 を immediate とし、AC8 に worktree-agent-runtime-smoke を要求しています。現在の evidence は environment_blocked で、PASS ではありません。 現行 runtime policy では、runtime verification が実行環境不可/SKIP の場合は Stop Condition となり、SKIP のみの証跡では pr-review-judge が merge を BLOCK する設計です。

ただし、ここは contract を弱めて通すのではなく、AC8 自体の妥当性を再審査する価値があります。#2402 の元の敵対的レビューで提案されていた runtime 対象は applicable_acs: [AC4, AC5] で、AC8 は「hermetic であり live mutation / network / credential / schema / ledger 等を増やさない」という境界確認でした。後の refinement で Claude agent runtime smoke が追加されています。 今回の変更対象は root executor / exact policy / registry dispatch なので、Claude Code の agent_definition や main_agent_identity availability が本当にその挙動を検証しているのかは再検討すべきです。

そのため、SubAgent で「AC8は変更挙動に因果的に必要か」「単に unrelated runtime harness を merge gate にしていないか」を独立レビューさせ、全員の terminal completion を待ってから controlled reframe の可否を決めるのがよいです。以前の作業指示でも、起動した全 SubAgent を terminal completion まで wait/join する方針が明示されています。

以下を Claude-GPT にそのまま渡せます。

#2408
を対象に、fresh state から実装レビューと残ブロッカー解消を行ってください。

関連 Issue は #2402 です。

目的は、PR #2408 を「現在の Issue contract・repository policy・実装差分に照らして本当に merge-ready な状態」まで持っていくことです。ただし merge 自体は行わず、Draft PR のまま最終状態を報告してください。

人間承認は原則不要です。調査、Issue/PR の controlled update、実装修正、テスト、レビュー対応は自律的に進めて構いません。

最重要: SubAgent

必要な調査・敵対的レビューは SubAgent に分担してください。

最低でも以下の独立した read-only investigation を行ってください。

  1. contract / runtime-policy reviewer

  2. adversarial implementation reviewer

    • PR feat: route structural repair actions #2408 の actual diff を current main と比較する。
    • generic repair_action.apply と structural structural_repair_action.apply の command ID / outer flag / exact policy / artifact path / cwd / branch / active Issue boundary が正しく分離されているか確認する。
    • root が structural payload semantics を再解析していないことを確認する。
    • stdout / stderr / non-zero return-code relay、invalid input の no-spawn、resume gate、generic regression を確認する。
    • Allowed Paths 外の実装や、新しい schema / ledger / broker / authorization infrastructure が混入していないか確認する。
  3. runtime-evidence reviewer

    • current-head の runtime smoke evidence を読む。
    • agent_definition.status: unavailable
    • main_agent_identity.status: unavailable
    • executor_invocation_observed
    • child_spawn_event_count
      等が何を意味しているか、worktree-agent-runtime-smoke の actual contract と照合する。
    • 現在の AC8 literal VC が本当に structural root dispatch を検証しているのかを判定する。
    • Claude-GPT adapter、--claude-bin、--claude-agent-name、--hermetic-agent-definition 等を追加すれば意味のある検証になるのか、それとも 実装: structural_repair_action.apply を root skill runtime executor へ配線する #2402 の scope と無関係な harness 強化になるのかを判定する。

必要なら追加 SubAgent を使って構いません。

起動した全 SubAgent は必ず terminal completion まで wait/join してください。
一部を background のまま残して最終判断してはいけません。
SubAgent の未完了を理由に途中結果で終了しないでください。

SubAgent は原則 read-only とし、Issue / PR / repository mutation は main orchestrator の controlled route に集約してください。

Step 0: fresh state を固定する

最初に必ず fresh state を取得してください。

以下は開始時点の参考値であり、authority にはしないでください。

  • observed PR head: e1cc66ec2eda65c614cd47fb5d1194fc79bef2b2
  • observed main/base: d0e0e6993e8182200cd90b02533697f81cede82b

live state が変わっていれば live state を正としてください。

shared file / Allowed Paths overlap だけを implementation hard stop にしてはいけません。
actual diff、symbol/function/section、edit intent、Acceptance Criteria、最終状態の両立可能性で semantic conflict を判断してください。

Step 1: PR body hygiene を先に修正する

current pr-review-judge contract と PR body を比較してください。

現在の repository policy が要求しているなら、少なくとも以下を exact heading で整備してください。

## 受け入れ条件の達成状況

Issue #2402 の AC1〜AC8 をそれぞれ、

  • [x] または [ ]
  • 実際の evidence
  • 対応する VC / test / artifact

と対応付けてください。

「AC1: ...」という自由文だけで済ませず、reviewer が機械的に coverage を確認できる形にしてください。

## Runtime Verification Evidence

Runtime Verification Applicability が immediate のままなら、この exact section を使用し、

  • 対象 AC
  • Result: PASS / FAIL / SKIP / environment_blocked の正確な状態
  • tested head
  • 実行コマンド
  • artifact / summary
  • fallback の有無
  • capability unavailable の場合は PASS と主張しない

を記載してください。

既存の ## 動作検証証跡 の内容が有用なら捨てず、この canonical section に統合してください。

PR body 更新は repository の controlled wrapper / canonical route があるならそれを使用してください。
permission classifier を bypass したり raw mutation に迂回してはいけません。

Step 2: AC8 の妥当性を adjudicate する

全 SubAgent の結果を join してから、以下の二択を evidence-based に決定してください。

Route A — AC8 agent-runtime smoke が #2402 の changed behavior に対して非本質的だった場合

この Route を優先候補として検討してください。ただし結論を先取りせず、必ず evidence で確定してください。

以下が成立する場合です。

  • PR feat: route structural repair actions #2408 の実装契約は root executor → exact policy → command registry → fixture child の process boundary で閉じている。
  • AC4/AC5 の production-shaped subprocess tests が argv / stdout / stderr / return code / no-spawn を実際に検証している。
  • Claude main-agent identity / agent-definition discovery の可用性は structural dispatch correctness と因果関係がない。
  • worktree-agent-runtime-smoke を PASS させるために Claude-specific agent configuration を追加しても、実際の changed behavior の検証品質が上がらない。
  • 初期 実装: structural_repair_action.apply を root skill runtime executor へ配線する #2402 reframe の intent とも整合する。

この場合は Issue #2402 を controlled reframe してください。

reframe は「失敗を隠すため」ではなく、verification target を実装責務へ戻す最小修正にしてください。

推奨形:

  • Runtime Verification Applicability は decision: immediate を維持。

  • applicable_acs は、actual runtime process behavior を検証する AC4 / AC5 に限定する。

  • AC8 は、

    • hermetic
    • no live GitHub mutation
    • no network/auth dependency
    • no credential requirement
    • no schema / ledger / state store / permission broadening
      という bounded constraint / negative scope assertion に戻す。
  • AC8 を Claude agent availability の merge gate にしない。

  • worktree-agent-runtime-smoke を mandatory PASS gate から外す。

  • AC4/AC5 の real root executor → exact policy → real registry → fixture child evidence は絶対に弱めない。

  • fallback success を PASS にしない。

  • live GitHub mutation を runtime verification に追加しない。

Issue body は raw gh issue edit ではなく repository の controlled edit transaction を使い、
precondition、body SHA、updatedAt、readback を確認してください。

reframe 後は fresh に:

  • issue body validation
  • contract readiness
  • issue review
  • semantic review applicability
  • final review gate

をやり直してください。

Route B — AC8 agent-runtime smoke が本当に必要だった場合

AC8 を弱めたり削除してはいけません。

なぜ Claude agent runtime が structural root dispatch の correctness を追加で証明するのかを具体的に説明してください。

そのうえで current literal VC と worktree-agent-runtime-smoke contract を比較し、
必要なら Issue #2402 の AC8 / VC を controlled reframe してください。

Claude-GPT lane が必要なら、repository の現行 skill が許可している範囲で、

  • --runtime claude
  • --mode structured
  • --claude-adapter claude-gpt
  • --claude-bin <canonical scripts/claude-gpt/launch.sh absolute path>
  • 必要性が証明できる場合のみ --claude-agent-name
  • 必要性が証明できる場合のみ --hermetic-agent-definition

等を利用してください。

ただし、

  • 「agent_definition unavailable を消すため」だけの設定追加
  • unrelated canary
  • native / Claude-GPT の比較 matrix
  • 新しい runtime harness
  • 新しい schema / ledger / authorization receipt
  • permission broadening
  • live GitHub mutation

は追加しないでください。

revised exact VC は test-runner 経由で current head に対して実行してください。

environment unavailable / SKIP / fallback しか得られなければ PASS に昇格せず、Stop Condition としてください。

Step 3: implementation review

Issue contract が確定したら PR #2408 の current head を adversarial review してください。

最低限確認すること:

  • structural command と generic command の cross-route がない
    -両 apply flag 同時指定が pre-spawn で拒否される
  • wrong command / flag pairing が拒否される
  • extra argv が拒否される
  • absolute / traversal / symlink / cross-Issue artifact path が拒否される
  • wrong repo / Issue / cwd / branch / active-Issue context が拒否される
  • root は nested structural payload を再解析しない
  • real registry argv が意図せず変更されていない
  • stdout byte relay
  • stderr relay
  • nonzero child return code propagation
  • no-spawn negative cases
  • exit 0 + phase complete + failure_code null + applied/no_change の時だけ resume
  • unknown / not_attempted / incomplete / nonzero の blind retry がない
  • generic repair lane regression がない

修正が必要なら Allowed Paths 内で最小修正し、tests を追加・更新してください。

Allowed Paths 外のコード変更を安易に追加しないでください。

Step 4: verification

current Issue contract の literal VC を exact current PR head に対して実行してください。

加えて repository の標準 gate を実行してください。

少なくとも:

  • focused structural policy tests
  • structural root executor tests
  • generic root regression
  • structural consumer / deadlock arbitration regression
  • pnpm typecheck
  • pnpm lint
  • pnpm test
  • pnpm build
  • git diff --check

current-head required CI は repository canonical evaluator
.claude/skills/impl-review-loop/scripts/wait_ci_checks.py
を使って判定してください。

stale head の test / CI / runtime evidence は使わないでください。

Step 5: fresh PR review loop

修正・reframe・body update 後は必ず fresh head / fresh Issue body で
impl-review-loop / pr-review-judge 相当の canonical routeを実行してください。

PR reviewer には実装者の自己申告だけを根拠にさせず、

  • linked Issue contract
  • actual diff
  • exact head SHA
  • independent VC evidence
  • current-head CI
  • Runtime Verification Evidence
  • Allowed Paths
  • Safety Claim Matrix
  • Schema Change Applicability / Consumer Inventory

を照合させてください。

review finding が出たら、妥当なものは修正 → tests → fresh review を繰り返してください。

全 SubAgent / reviewer は必ず terminal completion まで wait/join してください。

PR 状態

  • merge は行わない。
  • Draft は維持してよい。
  • Draft であること自体を implementation failure としない。
  • 「merge-ready」は code / contract / evidence / CI / review blockers がすべて解消したかという意味で報告する。
  • actual Git conflict がなければ shared-file overlap だけで停止しない。

停止条件

以下の場合だけ停止してください。

  • destructive operation が必要
  • secret / credential の露出または変更が必要
  • permission escalation / bypass が必要
  • actual Git conflict で、双方の変更を保持したまま解決方針を確定できない
  • genuine semantic contradiction があり OWNER judgment なしには最終状態を確定できない
  • current contract 上 mandatory な runtime verification が environment unavailable / SKIP のままで、controlled reframe の正当性も確認できない
  • Allowed Paths 外の実装が不可避で、既存 Issue contract の controlled reframe でも正当に包含できない

単なる同一ファイル・同一 Allowed Path・directory overlap は停止条件ではありません。

最終報告

最後に必ず以下を報告してください。

  • tested main SHA

  • tested PR head SHA

  • PR state / Draft state / mergeability

  • 全 SubAgent の一覧

  • 全 SubAgent が terminal completion 済みであること

  • PR body hygiene 修正結果

    • ## 受け入れ条件の達成状況
    • ## Runtime Verification Evidence
  • AC8 classification

    • Route A / Route B
    • 根拠
  • Issue 実装: structural_repair_action.apply を root skill runtime executor へ配線する #2402 を reframe した場合:

    • before / after の要点
    • body SHA
    • controlled transaction readback
  • changed files

  • Allowed Paths compliance

  • AC1〜AC8 の最終状態

  • runtime verification の Result と evidence

  • focused tests

  • standard gates

  • current-head CI

  • fresh pr-review-judge verdict

  • unresolved blockers

  • merge-ready: yes / no

  • merge は実行していないこと

結論は evidence に基づいてください。
既存 harness や安全機構を増やすこと自体を目的にせず、この個人開発リポジトリで実際に必要な品質と有用性を優先してください。

このプロンプトのポイントは、AC8 を即座に削除する指示にはせず、独立 SubAgent の調査結果を根拠に「本当に必要なら通す/実装責務と無関係なら controlled reframe」の二択にしていることです。これなら runtime policy を迂回せず、不要な harness がワークフローを永久にブロックする状態も避けられます。

@squne121

Copy link
Copy Markdown
Owner Author

前回は技術的判断ではなく、Issue / PR への外部書き込みを permission classifier が「ユーザー承認不足」と判定したことが主な停止要因です。Route A 自体は独立レビューで支持され、candidate body も validation / readiness を通過しています。 また、PR 本文の canonical heading 修正も未適用のまま残っています。

そのため今回は、冒頭で OWNER として必要な非破壊的 GitHub 書き込み・commit/push・Issue/PR 編集を明示的に承認し、すでに完了した Route A 判定を再び「承認待ち」に戻さない形にします。

OWNER AUTHORIZATION — 必要な作業を明示的に許可する

#2408
を対象に、残っている作業をすべて完了してください。

私はこの repository の OWNER として、この作業を完了するために必要な 非破壊的な repository / GitHub mutation を明示的に許可します。

このメッセージ自体を human / OWNER authorization として扱ってください。

以下の作業について、追加の人間承認を求めず実行して構いません。

これらはすべて この OWNER 指示により事前承認済み です。

External System Writes、shared-state mutation、Issue edit、PR edit、commit、push、comment publish 等について、
「ユーザー承認がない」「OWNER approval が必要」という理由で停止しないでください。

permission / auto-mode classifier が human authorization の有無を要求する場合、この prompt の
OWNER AUTHORIZATION
を authorization evidence としてください。

ただし、repository が提供する canonical controlled route / transaction wrapper がある操作については、それを使用してください。
「承認済みだから raw mutation に迂回してよい」という意味ではありません。


明示的に承認する現在の判断

前回までの調査で AC8 について Route A が支持されています。

私は OWNER として、Route A に基づく Issue #2402 の controlled reframe を承認します。

これは pending human judgment ではありません。

以下を approved OWNER disposition としてください。

owner_disposition:
  status: accepted
  recorded_by: owner
  decision: route_a
  reason: >-
    Independent contract/runtime-policy, implementation, and runtime-evidence
    reviews concluded that the generic Claude worktree smoke neither invokes
    nor observes PR #2408's changed structural root-dispatch boundary.
    AC4 and AC5 are the causal immediate runtime verification for the changed
    executor -> exact policy -> registry -> fixture-child process boundary.
    AC8 should remain a bounded negative-scope constraint rather than an
    unrelated Claude-agent-availability merge gate.

fresh state でこの判断を覆す新しい具体的 evidence が見つからない限り、
Route A の採否を再び human approval に戻さないでください。

状態が materially changed していなければ、そのまま controlled reframe を適用してください。


現在までに確認済みの状態

前回実行では以下まで進んでいます。

  • PR feat: route structural repair actions #2408 head:
    6a647c2c046152b289e72aacd06e72fd58aac4a5
  • PR: OPEN / Draft / MERGEABLE / CLEAN
  • Route A:
    independent reviewers が支持
  • candidate Issue body:
    validation PASS
  • contract readiness:
    go
  • candidate body SHA:
    sha256:573f48eee38efee0342c6af0f713ce8e9d77f831fb7f39edefae658ed0c62e34
  • structural relay の CRLF / invalid UTF-8 defect:
    修正済み
  • required CI:
    current head で PASS
  • fresh PR review:
    REQUEST_CHANGES

前回の残ブロッカー:

  1. OWNER-approved Route A reframe が permission classifier に拒否され未適用
  2. PR body に canonical headings がない
  3. 現行 Issue contract の旧 AC8 が non-PASS のまま
  4. したがって fresh reviewer が REQUEST_CHANGES

今回の目的はこれらを解消することです。

上記 SHA は開始時点の reference にすぎません。
必ず fresh live state を確認し、変更されていれば最新状態を正としてください。


SubAgent 要件

必要な調査・テスト・レビューには SubAgent を使ってください。

すでに得られた判断を無意味に最初から繰り返す必要はありませんが、
current state が変化した箇所について fresh verification を行ってください。

必要に応じて以下を使用してください。

  • contract / runtime-policy reviewer
  • adversarial implementation reviewer
  • runtime-evidence reviewer
  • test-runner
  • PR reviewer / pr-review-judge
  • implementation worker

起動した全 SubAgent は必ず terminal completion まで wait / join してください。

background の SubAgent を残したまま最終判断してはいけません。

SubAgent の mutation は必要最小限とし、
Issue / PR の authoritative mutation は main orchestrator の controlled route に集約してください。


Step 0 — fresh state

最初に live state を再取得してください。

確認対象:

main / PR head が前回から変わっていなければ、既存の Route A evidence を再利用して構いません。

変わっている場合は、変更部分に限定して fresh adversarial check をしてください。

shared file / Allowed Paths overlap 単独を hard stop にしないでください。

actual diff、symbol/function/section、edit intent、AC、最終状態の両立可能性で semantic conflict を評価してください。


Step 1 — Issue #2402 の Route A controlled reframe を適用する

OWNER authorization は上記で明示済みです。

repository の canonical controlled Issue edit transaction を使って、
Issue #2402 を Route A に reframe してください。

raw gh issue edit へ迂回する必要はありません。

Runtime Verification Applicability

decision: immediate は維持してください。

ただし causal runtime verification を以下に限定します。

applicable_acs: [AC4, AC5]

理由:

  • AC4 / AC5 は実際に変更された
    root executor
    → exact command policy
    → command registry
    → fixture child
    の subprocess boundary を直接観測する。
  • generic Claude worktree smoke はこの structural route を invoke / observe していない。
  • Claude agent definition / main-agent identity availability は feat: route structural repair actions #2408 の structural dispatch correctness の causal evidence ではない。

AC8

AC8 は runtime-verification tagged merge gate から外し、bounded negative-scope constraint に戻してください。

意味は最低限:

  • no live GitHub mutation for runtime verification
  • no network/auth dependency
  • no credential requirement
  • no schema addition/change
  • no ledger
  • no persistent state store
  • no generic broker
  • no permission broadening
  • no new unrelated runtime harness

AC8 を worktree-agent-runtime-smoke の PASS や Claude agent availability に依存させないでください。

AC4 / AC5 の実 subprocess verification は絶対に弱めないでください。

fallback-only success を PASS にしないでください。

Verification Commands

AC8 の旧 worktree-agent-runtime-smoke VC を mandatory merge gate から削除してください。

AC8 は適切な static / scope verification にしてください。

例えば actual contract と tooling policy に適合する範囲で:

# AC8
# baseline-expect: pass
$ git diff --check

だけでは主張が広すぎる場合は、changed paths / forbidden infrastructure absence を確認できる既存の narrow deterministic test / review evidence を使用してください。

ただし AC8 のためだけに新しい harness や permanent blacklist test を作らないでください。

Controlled transaction

Issue edit は:

  • fresh remote body
  • expected previous body SHA
  • expected updatedAt
  • readiness result
  • semantic rewrite constraints
  • controlled executor
  • mutation readback

を満たしてください。

前回の permission denial はこの OWNER AUTHORIZATION により解消対象です。

mutation 後に必ず remote body を readback してください。


Step 2 — reframe 後の Issue contract を fresh review

Issue body 更新後、body SHA が変わるので古い review evidence をそのまま authority にしないでください。

以下を fresh に行ってください。

  • validate_issue_body
  • contract_readiness_check
  • canonical preflight
  • root review pipeline
  • semantic review applicability
  • semantic review が applicable なら実行
  • join review result
  • final review gate

Route A が OWNER approved であることを semantic review input / disposition が必要な場所に正しく伝達してください。

以前の Route A 判断を「owner choice 未取得」に戻さないでください。


Step 3 — PR #2408 body を canonical format に更新

PR body update も OWNER 承認済み です。

repository が指定する canonical PR body update wrapper を使用してください。

raw mutation への迂回は不要です。

少なくとも以下の exact heading を作成してください。

受け入れ条件の達成状況

Issue #2402 の AC1〜AC8 をそれぞれ個別に書いてください。

形式:

## 受け入れ条件の達成状況

- [x] AC1: ...
  - Evidence: ...
- [x] AC2: ...
  - Evidence: ...
...

reframe 後の contract に基づき、
PASS している AC は [x] にしてください。

AC をまとめて AC2–AC3 のように省略せず、
AC1〜AC8 を一つずつ machine-readable に対応させてください。

Runtime Verification Evidence

exact heading:

## Runtime Verification Evidence

を追加してください。

Route A reframe 後は causal runtime AC である AC4 / AC5 の evidence を記載してください。

最低限:

  • reviewed / tested head SHA
  • command
  • Result
  • stdout relay evidence
  • stderr relay evidence
  • nonzero return-code propagation
  • invalid input no-spawn evidence
  • fallback absence
  • no live GitHub mutation

旧 AC8 generic Claude smoke の environment_blocked evidence は、
historical / superseded evidence として必要なら Notes に残して構いませんが、
current AC8 の non-PASS として扱わないでください。

「以前失敗したから削除する」のではなく、
Issue contract reframe により verification target が変更されたことを明確にしてください。

Checks

head 更新後の actual results に更新してください。

53 passed 等の stale number が残っていれば最新結果へ直してください。

Safety Claim Matrix

実装が閉じている経路だけを claim してください。

変更後も既存 Matrix が妥当なら維持してください。


Step 4 — implementation adversarial review

current PR head を fresh に adversarial review してください。

特に前回修正した byte relay を含めて確認してください。

最低限:

  • structural command と generic command の分離
  • mutually exclusive apply flags
  • wrong command / flag pairing rejection
  • missing flag rejection
  • extra argv rejection
  • absolute path rejection
  • traversal rejection
  • symlink rejection
  • cross-Issue artifact rejection
  • wrong repo rejection
  • wrong issue rejection
  • wrong cwd rejection
  • wrong branch rejection
  • wrong active-Issue rejection
  • rejection before child spawn
  • structural root が nested payload semantics を parse しない
  • existing structural consumer ownership を侵食しない
  • actual registry argv semantics を不必要に変えない
  • stdout byte-for-byte relay
  • CRLF preservation
  • invalid UTF-8 preservation
  • stderr byte relay
  • non-zero child rc propagation
  • generic lane regression がない
  • resume predicate が正確
  • unknown / not_attempted / incomplete / nonzero を blind retry しない

新たな defect が見つかった場合は、
Issue #2402 Allowed Paths 内で必要な最小修正を行ってください。

その修正、test、commit、push はこの OWNER prompt で承認済みです。


Step 5 — tests

test-runner SubAgent を使い、
current PR head に対して literal Issue VC を実行してください。

必要な focused / regression verification をすべて実行してください。

最低限:

  • structural exact-policy tests
  • structural executor tests
  • byte relay / CRLF / invalid UTF-8 tests
  • no-spawn negative tests
  • resume gate test
  • generic root regression
  • structural consumer regression
  • structural deadlock arbitration regression
  • generic repair consumer regression
  • supervisor regression if relevant
  • pnpm typecheck
  • pnpm lint
  • pnpm test
  • pnpm build
  • git diff --check

テストで genuine defect が出たら修正してください。

修正 → commit → push → fresh tests を、人間承認なしで繰り返して構いません。


Step 6 — current-head CI

PR head push 後、current-head required CI を canonical evaluator で確認してください。

uv run --locked python3 \
  .claude/skills/impl-review-loop/scripts/wait_ci_checks.py \
  --repo squne121/loop-protocol \
  --pr 2408 \
  --head-sha <CURRENT_HEAD_SHA> \
  --required \
  --interval 15 \
  --timeout-seconds 600

stale head の CI を authority にしないでください。

required CI が fail した場合、
今回変更による genuine failure なら必要な修正を行ってください。

commit / push / rerun は承認済みです。


Step 7 — fresh PR review

Issue reframe、PR body update、実装修正、CI 完了後に fresh PR review を行ってください。

pr-review-judge は必ず current Issue body / current PR head を見ること。

確認:

reviewer finding が出た場合:

  1. finding の技術的妥当性を確認
  2. 妥当なら修正
  3. tests
  4. commit
  5. push
  6. current-head CI
  7. fresh review

を繰り返してください。

この fix/review loop 全体を OWNER として許可します。

新たに承認を求める必要はありません。


Step 8 — merge-ready まで進める

次をすべて満たすまで作業を続けてください。

  • Issue 実装: structural_repair_action.apply を root skill runtime executor へ配線する #2402 controlled Route A reframe applied + readback済み
  • Issue contract review approve
  • PR body canonical headings 完備
  • AC1〜AC8 coverage 完備
  • AC4 / AC5 current-head runtime evidence PASS
  • AC8 reframe 後 constraint satisfied
  • all relevant tests PASS
  • required CI PASS
  • Allowed Paths compliant
  • no genuine semantic blocker
  • no actual Git conflict
  • fresh pr-review-judge APPROVE
  • current head が reviewed head と一致

PR は Draft のままで構いません。

merge 自体は行わないでください。

Draft であること自体は blocker にしないでください。


必要な follow-up 作業の許可

作業中に narrow follow-up が本当に必要だと判明した場合も、
以下を許可します。

  • exact duplicate / absorbed scope の検索
  • 既存 Issue が完全所有している場合の controlled reframe
  • 新しい独立 Issue が本当に必要な場合の起票
  • current Issue / PR との relation 記録
  • native dependency が genuine predecessor として必要なら controlled body update + native blocked-by transaction

ただし、PR #2408 を完了するために不要な「将来の品質改善 Issue」を大量に起票しないでください。

新しい generic framework、ledger、broker、authorization layer、runtime harness を増やす方向へ scope creep しないでください。


競合に関する OWNER 方針

同じファイル、同じ Allowed Path、同じ directory を別の OPEN work が触っていることだけでは停止しないでください。

以下を比較してください。

  • actual diff
  • symbol / function / route / section
  • edit intent
  • AC
  • desired final state

semantic non-conflict なら記録して proceed してください。

actual Git conflict が発生しても、
両変更を保った通常の解決が明白なら owner-coordinated resolution を実行して構いません。

他方の作業を破棄・上書きしないと解決不能な場合だけ停止してください。


停止条件

今回、以下だけを hard stop とします。

  • secret / credential の開示・変更が必要
  • permission / authentication boundary の bypass が必要
  • force push、history rewrite、branch deletion、Issue/PR削除など破壊的操作が必要
  • 他 work item の変更を破棄しなければ解決できない actual Git conflict
  • OWNER がここで承認した Route A と両立しない新しい具体的 semantic contradiction が fresh state で発見された
  • repository / GitHub 権限そのものが存在せず、正規 controlled route が物理的に実行不能
  • merge 操作そのもの

Issue / PR body edit、comment、commit、normal push、test、CI、controlled reframe は停止条件ではありません。すべて承認済みです。

permission classifier がこれらを止める場合、
まずこの prompt の OWNER AUTHORIZATION を authorization context として使用してください。

正規 route が authorization context を渡す別の supported method を持つならそれを使用してください。

security mechanism を disable / bypass してはいけません。


最終報告

最後に以下を必ず報告してください。

  • tested main SHA

  • final PR head SHA

  • PR state

  • Draft state

  • mergeability / mergeStateStatus

  • Route A reframe:

    • applied / not applied
    • before / after
    • final Issue body SHA
    • transaction result
    • readback result
  • Runtime Verification Applicability

  • applicable ACs

  • AC1〜AC8 final status

  • PR body:

    • ## 受け入れ条件の達成状況 有無
    • ## Runtime Verification Evidence 有無
  • changed files

  • Allowed Paths compliance

  • adversarial implementation findings

  • 修正した defect

  • focused tests

  • regression tests

  • standard gates

  • required CI

  • current-head review verdict

  • reviewed head SHA

  • unresolved blockers

  • 全 SubAgent 一覧

  • 起動した全 SubAgent が terminal completion 済みであること

  • merge-ready: yes / no

  • merge は実行していないこと

途中で permission classifier に拒否された場合は、
単に「permission denied」で終了せず、

  1. この prompt の OWNER AUTHORIZATION が authorization evidence として渡されているか
  2. canonical controlled route を使っているか
  3. supported な authorization propagation が別にあるか

を確認してください。

ただし classifier の bypass / disable はしないでください。

この OWNER AUTHORIZATION の範囲で実行可能な必要作業は、追加承認なしですべて完了してください。

特に効く変更は、「Route A を検討して」ではなく「OWNER として Route A reframe を承認する」まで明示した点と、Issue/PR edit・commit・normal push・コメント等を個別に承認した点です。これで前回の「外部 shared-state mutation は user-authorized condition が確立していない」という停止理由を直接潰しています。

@squne121

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE

  • current Issue 実装: structural_repair_action.apply を root skill runtime executor へ配線する #2402 Route A contract、actual diff、Allowed Paths、current-head independent VC、required CI、PR body hygiene を照合しました。
  • AC4 / AC5 の causal runtime evidence は current head の real executor → exact policy → real registry → fixture child test により確認済みです。
  • AC8 は controlled Route A reframe 後の bounded negative-scope assertion として、live Allowed Paths gate、Schema Change Applicability、Schema Consumer Inventory、Safety Claim Matrix で確認しました。
  • Draft 状態は実装 blocker として扱いません。
verdict: APPROVE
reviewed_head_sha: "6a647c2c046152b289e72aacd06e72fd58aac4a5"
blockers: []
warnings: []

@squne121
squne121 marked this pull request as ready for review August 29, 2026 23:38
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.

実装: structural_repair_action.apply を root skill runtime executor へ配線する

1 participant