Skip to content

実装: trusted human contract feedback を controlled editor handoff に接続する #2620

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: none
goal_ref: "trusted direct human context の substantive contract feedback を、provenance/binding/fail-closed を維持したまま既存 issue-editor controlled transaction に安全に handoff 可能にする"
change_kind: workflow
dedupe_key: "trusted-human-contract-feedback-controlled-editor-handoff:v1"

Parent Issue

なし(単独改善)

Parent Goal Ref

Current Validated Scope

  • preflight.run.with_human_context は trusted direct human context の substantive contract feedback を認識できる。
  • 既存コードは decide_rewrite_route.py の decide_scope_reframe_contract_route() により、revised acceptance criteria 等の contract section marker から Acceptance Criteria 等の section-bound CONTRACT_PATCH_PLAN_V1 を生成できる。また同関数は承認済み scope reframe を route: issue_editor_required(reason_code: approved_scope_requires_full_contract_rewrite、operations: [])として run_refinement_preflight.py の consume_trusted_anchor_contract_patch_plan() へ返す唯一の既存 producer である。
  • 本 Issue が扱う gap は、既存の section-bound patch derivation でも表現不能で、かつ既存 scope-reframe full-rewrite route(issue_editor_required, operations: [])にも該当しない、explicit trusted human contract directive に限定される。該当しない場合、現状の contract_update.run.with_human_context は PLANNER_FAIL_CLOSED、writes=0 に停止する。
  • 既存の issue-editor SubAgent(.claude/agents/issue-editor.md)はすでに issue_number + reviewer_feedback_url(または reviewer_feedback_text)を正式入力として受け取り、candidate body を生成して既存 edit_issue_txn.py controlled transaction に渡せる。本 Issue はこの既存経路を再実装せず、control-plane 側の routing 判定だけを拡張する。

Remaining Parent Gaps

Outcome

preflight.run.with_human_context / contract_update.run.with_human_context が、既存の authority_category == human_review_directive かつ explicit directive かつ with_human_context かつ trusted principal(既存 human_review_directive predicate が扱う trust 範囲。OWNER/MEMBER/COLLABORATOR を含み、#2620 固有の OWNER-only 新設ポリシーは導入しない)かつ same-target/provenance/anchor binding valid という 既存 predicate の組み合わせだけを eligibility の SSOT として、safe section-bound patch representation が存在しない substantive contract feedback を検出した場合に、preflight / contract_update 自身が controlled transaction を実行するのではなく、writes=0 のまま既存 NEXT_ACTION: issue_editor_required を返す状態にする。

issue_editor_required を受け取った root/main thread が、既存 issue-editor SubAgent を issue_number + canonical reviewer_feedback_url(anchor comment の URL。raw anchor_comment.snapshot 本文を reviewer_feedback_text として転送しない)で起動する。candidate body の意味論的生成は issue-editor、mutation/precondition/readback は既存 edit_issue_txn.py、rewrite 後の authorization は既存 fresh preflight/review/readiness gate、という現在の責務分割(control-plane routing と data-plane mutation の分離)を維持する。

Runtime Verification Applicability

  • decision: immediate
  • reason: 本 Issue の Allowed Paths が .claude/skills/issue-refinement-loop/SKILL.md および .claude/skills/issue-refinement-loop/scripts/** を含み、docs/dev/extension-surface-runtime-policy.yaml の skill-invocation-procedure-or-contract-change / subagent-lifecycle-start-stop-delegation-fallback rule(default_decision: immediate)に一致するため、静的検証だけでは不十分であり、real run_preflight() の production-reachable path を通した確認が必要。
    applicable_acs: AC1, AC6
    execution_environment: repo checkout 内で uv run pytest を実行できるローカル/CI 環境。外部ネットワーク・live GitHub API 呼び出し・実 GitHub write は不要(deterministic fixture のみ)。
    skip_conditions: uv / pytest 実行環境が利用できない場合は SKIP(exit 77)とし、test-runner が Stop Condition を発火して人間にエスカレーションする。
    fallback_policy: fallback 経由でのみ issue_editor_required に到達した結果、または _*_fallback: true を含む結果は PASS として扱わず FAIL とする。
    artifact_requirements: test-runner が real run_preflight() 実行の stdout/exit code ログを artifacts/<issue_number>/runtime-verification/ 配下に保存し、PR ## Runtime Verification Evidence セクションに redact 済み要約(NEXT_ACTION 値、mutation 回数、PASS/FAIL/SKIP のみ。raw stdout 全文や secret は貼らない)を引用する。

Background

#2619 の refinement で control-plane gap を確認した。preflight.run.with_human_context は trusted direct human context の substantive contract feedback を認識しても、既存の section-bound CONTRACT_PATCH_PLAN_V1 生成(decide_scope_reframe_contract_route())でも表現できず、かつ既存の承認済み scope-reframe full-rewrite route にも該当しない場合、contract_update.run.with_human_context は PLANNER_FAIL_CLOSED、writes=0 で停止する。

最小案は、既存の human-context provenance・anchor binding・fail-closed 判定を通過した substantive feedback だけを、既存 NEXT_ACTION: issue_editor_required の eligibility 拡張として検出し、control-plane(preflight/contract_update)は writes=0 のまま routing 判定だけを返すこととする。preflight が edit_issue_txn.py を直接呼び出す実装、または新しい editor transaction route を作る実装は既存の control-plane/data-plane 分離を破るため採用しない。root/main thread が issue_editor_required を受けて既存 issue-editor SubAgent を起動する既存パターンをそのまま再利用する。

運用上 #2619 の暫定例外として direct issue-editor 更新を行った案は一般化・恒久 route にしない。raw mutation や新しい parser/executor/security machinery、新しい substantive feedback 判定 heuristic/classifier を追加する案は、より広い権限・schema surface を増やすため採用しない。

関連根拠: #2619、anchor comment https://github.com/squne121/loop-protocol/issues/2619#issuecomment-5615784499、review anchor comment https://github.com/squne121/loop-protocol/issues/2620#issuecomment-5616372032、`run_refinement_preflight.py:8557-8712`、`decide_rewrite_route.py` の decide_scope_reframe_contract_route()(約800行目)。

In Scope

  • preflight.run.with_human_context / contract_update.run.with_human_context の既存 human-context lane 内に、safe section-bound patch representation が存在しない explicit trusted human_review_directive を検出した場合に既存 NEXT_ACTION: issue_editor_required を返す最小の明示 routing 判定を追加する(decide_rewrite_route.py の routing SSOT を拡張し、run_refinement_preflight.py にのみ ad-hoc な分岐を追加して routing SSOT を二重化しない)。
  • eligibility 判定は新しい classifier/heuristic を作らず、既存の authority_category == human_review_directive、explicit directive confidence、with_human_context、trusted principal(既存 predicate の trust 範囲をそのまま使用)、same-target/provenance/anchor binding valid、という既存 predicate の組み合わせだけを使う。
  • route の入口で既存の trusted direct human-context provenance、target issue/anchor URL/body binding、fresh precondition/readback を要求し、満たせない場合は issue_editor_required を返さず既存 fail-closed のまま writes=0 にする。
  • scope reframe/freeform exact allowed-path delta 専用の CONTRACT_PATCH_PLAN_V1 生成に依存しない handoff 判定を実現する。ただし既存 section-bound patch route・既存 scope-reframe full-rewrite route の意味・validation・fail-closed 挙動は変更しない(regression させない)。
  • issue_editor_required の handoff payload として canonical reviewer_feedback_url を伝搬する経路を保証する(raw anchor comment body を reviewer_feedback_text として転送しない)。
  • .claude/skills/issue-refinement-loop/SKILL.md および .claude/skills/issue-refinement-loop/references/loop-state.md の issue_editor_required 記述を、「approved scope reframe + empty operations[] 限定」から「既存 section-bound patch derivation でも表現不能で、かつ既存 scope-reframe full-rewrite route にも該当しない explicit trusted human_review_directive を含む」に更新する。
  • focused deterministic regression を追加し、既存 controlled editor transaction は injected callback/fixture で観測し、raw GitHub mutation を行わない。real run_preflight() の production-reachable path から result/stdout の NEXT_ACTION: issue_editor_required までを少なくとも1本、fixture/deterministic 環境で確認する。

Out of Scope

Acceptance Criteria

  • AC1: safe section-bound patch representation が存在しない explicit trusted human_review_directive(既存 predicate: authority_category == human_review_directive かつ explicit directive かつ with_human_context かつ trusted principal かつ same-target/provenance/anchor binding valid)が検出された場合、preflight.run.with_human_context / contract_update.run.with_human_context は controlled transaction を自ら実行せず、writes=0 のまま既存 NEXT_ACTION: issue_editor_required を返す。route input には同一 target issue と canonical reviewer_feedback_url(raw anchor comment body ではない)が含まれる。
  • AC2: 既存の section-bound patch representation が存在しない(=CONTRACT_PATCH_PLAN_V1 を section-bound patch として安全に生成できない)valid な explicit trusted human directive でも、新しい patch plan を捏造せず AC1 の issue_editor_required に到達できる。
  • AC3: untrusted human context、invalid anchor、target issue または anchor URL/body の mismatch、provenance 不一致はすべて fail-closed のまま writes=0 であり、issue_editor_required route を選ばない。
  • AC4: 曖昧な自由文または既存 predicate の組み合わせで trusted explicit human_review_directive と判定できない入力は fail-closed のまま writes=0 であり、自動 body rewrite も issue_editor_required への到達も行わない。
  • AC5: 既存 CONTRACT_PATCH_PLAN_V1 scope-reframe full-rewrite route および existing section-bound / freeform exact allowed-path-delta route の validation と fail-closed behavior は regression しない。
  • AC6:
    focused deterministic tests は、helper/callback 単体テストに加えて real run_preflight() の production-reachable path から result/stdout の NEXT_ACTION: issue_editor_required に到達すること、および preflight 自体の mutation 回数が0回であることを確認する。AC3/AC4 の negative case も fixture callback で検証し、raw GitHub mutation・巨大な新規 E2E/live GitHub harness は追加しない。

Verification Commands

# AC1
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_preflight_run_with_anchor.py
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_decide_rewrite_route_human_review_directive.py
# AC2
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_decide_rewrite_route_human_review_directive.py
# AC3
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_preflight_run_with_anchor.py
# AC4
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_preflight_run_with_anchor.py
# AC5
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_delta_authority_e2e.py
# AC6
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_preflight_run_with_anchor.py -k "production_reachable or issue_editor_required"

Allowed Paths

  • .claude/skills/issue-refinement-loop/SKILL.md
  • .claude/skills/issue-refinement-loop/references/loop-state.md
  • .claude/skills/issue-refinement-loop/scripts/decide_rewrite_route.py
  • .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py
  • .claude/skills/issue-refinement-loop/tests/test_preflight_run_with_anchor.py
  • .claude/skills/issue-refinement-loop/tests/test_scope_delta_authority_e2e.py
  • .claude/skills/issue-refinement-loop/tests/test_decide_rewrite_route_human_review_directive.py

Stop Conditions

  • 動作検証 AC の VC が SKIP(exit 77)を返した場合(実行環境不可のためエスカレーション)
  • fallback 経由でのみ「成功」する場合(FAIL として扱い、実行環境を確認)
  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • run_refinement_preflight.py に ad-hoc な分岐を追加しないと実現できず、decide_rewrite_route.py の routing SSOT を二重化せざるを得ないと判明した場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合

Required Skills

なし

Required Design References

  • docs/dev/agent-skill-boundaries.md
  • .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py:8557-8712
  • .claude/skills/issue-refinement-loop/scripts/decide_rewrite_route.py(decide_scope_reframe_contract_route()、約800行目)
  • .claude/skills/issue-refinement-loop/scripts/scope_signal_delta.py(run_trusted_anchor_iteration_zero())
  • .claude/agents/issue-editor.md
  • .claude/skills/edit-issue/scripts/edit_issue_txn.py

Scope Delta(任意)

N/A

Notes for Reviewer

Delivery Rule

  • 1 Issue = 1 PR を原則とする。
  • worktree を切って作業し、Draft PR を既定とする。

Activity

  1. added
    phase/implementation
    agent/implementer
    enhancement
    workflow
    test
    follow-up
    on Sep 10, 2026
  2. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    結論

    #2620 は REQUEST CHANGES 相当です。 問題設定自体は妥当で、#2619 から transport/PATCH 問題を分離したのも正しいです。ただし現在の契約には、実装者が run_refinement_preflight.py から直接 edit_issue_txn.py を呼ぶ実装に進めてしまう余地があります。これは既存 architecture と衝突します。

    このリポジトリでは、orchestrator は control-plane の routing に限定し、Issue 本文編集は issue-editor SubAgent に委譲するのが既存 SSOT です。issue-editor はすでに issue_number + reviewer_feedback_url | reviewer_feedback_text を受け取り、candidate body を生成して既存 controlled transaction に渡せます。

    したがって #2620 で作るべきものは新しい editor transaction route ではなく、既存 NEXT_ACTION: issue_editor_required の eligibility 拡張です。

    敵対的レビュー

    Severity | 指摘 | 問題 | 推奨 -- | -- | -- | -- BLOCKER | handoff の終点が曖昧 | Issue は「existing issue-editor controlled transaction へ handoff」と書いていますが、preflight が transaction を直接実行するのか、issue-editor へ routing するのか固定されていません。前者だと control-plane/data-plane 分離を破ります。 | preflight は writes=0 のまま NEXT_ACTION: issue_editor_required を返すだけにする。main-thread が issue-editor(issue_number, reviewer_feedback_url=anchor_url) を起動する。 BLOCKER | Allowed Paths に SKILL.md がない | 現行 SKILL.md は issue_editor_required を「approved scope reframe + empty operations」に限定して説明しています。#2620 が別種の feedback に拡張すると正本が即座に stale になります。 | .claude/skills/issue-refinement-loop/SKILL.md を Allowed Paths に追加。references/anchor-comment-handling.md も route semantics を更新するなら追加。 HIGH | Current Validated Scope の前提が正確でない | 「CONTRACT_PATCH_PLAN_V1 は scope reframe / exact allowed-path delta からしか生成されない」は広すぎます。既存コードは revised acceptance criteria 等を contract section marker として認識し、Acceptance Criteria の section patch を生成できます。 | gap を「既存の section-bound patch derivation でも表現不能で、既存 scope-reframe full-rewrite route にも該当しない explicit human contract directive」に限定する。 HIGH | substantive contract feedback が型付けされていない | 新しい heuristic を preflight に入れれば Out of Scope の parser/classifier 変更になります。単なる長文レビューや箇条書きを誤って body rewrite authority にできます。 | 新 classifier は作らず、既存の authority_category == human_review_directive、explicit directive、with_human_context、same-target binding を eligibility の SSOT にする。 HIGH | direct owner feedback が既存 trust model より狭い | #2086 系では human review directive は trusted OWNER/MEMBER/COLLABORATOR を既存カテゴリとして扱っています。#2620 だけ OWNER-only にすると隠れた二重ポリシーになります。 | 既存 human_review_directive predicate をそのまま再利用。OWNER-only に変えるなら「意図的な trust-policy change」と明文化する。 HIGH | raw feedback の handoff 方法が未固定 | 既存ルールは raw anchor_comment.snapshot を Step 4 の reviewer_feedback_text に流すことを明示的に禁止しています。 | raw body ではなく canonical reviewer_feedback_url を渡す。これなら issue-editor が fresh source を読み直せます。 MEDIUM | AC6 が callback-only false-green になり得る | #2048/PR #2057 では helper-level test が production reachability を証明できない問題を実際に踏み、最終的に canonical path E2E まで追加しています。 | 新しい巨大 E2E harness は不要。ただし real run_preflight() → result/stdout の issue_editor_required までは通し、contract-patch mutation が0回であることを確認する。 MEDIUM | freshness 責務が重複しそう | #2583 は source anchor を transaction dispatch 直前に再取得して identity/revision を検証する既存先例があります。editor transaction 自体も precondition/readback を所有しています。 | preflight は human-context provenance + anchor binding まで。current Issue body の stale-write 防止/readback は既存 editor transaction、rewrite 後の authorization は既存 fresh preflight/review/readiness gate に任せる。

    推奨する routing

    実装の中心はこの程度に抑えるのがよいです。

    preflight.run.with_human_context
            │
            ├─ existing section-bound CONTRACT_PATCH_PLAN is possible
            │      → existing contract_update route
            │
            ├─ existing approved scope-reframe full rewrite
            │      → existing issue_editor_required
            │
            ├─ explicit trusted human_review_directive
            │    + same-target/provenance/anchor binding valid
            │    + existing safe patch representation unavailable
            │      → issue_editor_required
            │         writes = 0 at preflight
            │
            └─ ambiguous / untrusted / binding mismatch
                   → existing fail-closed

    issue_editor_required を受けた root/main thread が、canonical anchor URL を reviewer_feedback_url として既存 issue-editor に渡す。candidate body の意味論的生成は issue-editor、mutation/precondition/readback は edit_issue_txn.py、その後の fresh gate は既存 refinement loop、という現在の責務分割を維持します。

    これなら #2620 の Out of Scope に書かれている「parser/executor/security harness を増やさない」「曖昧な自由文を自動 rewrite しない」にも整合します。

    WEB側の仕様確認

    GitHub 側にも追加機構は不要です。GitHub REST の issue-comment GET は comment_id による直接取得ができ、response に html_url、raw Markdown body、updated_at、issue_url、author_association が含まれます。つまり現在使っている anchor identity / target binding / freshness 確認の材料は公式 API だけで十分あります。(GitHub Docs)

    また GitHub CLI の gh issue edit は --body-file を正式に提供しています。したがって、既存 controlled executor の上に ETag/CAS service、approval ledger、別 publisher、permission service を追加する技術的理由は見当たりません。(GitHub CLI)

    個人趣味開発という前提なら、セキュリティ機構を増やすより「既存 trust classification → 既存 routing → 既存 issue-editor → 既存 transaction」を一本化する方が品質と完走率の双方に効きます。#2619 の元レビューも、同じ思想で新 parser・receipt・permission/security harness・mandatory live GitHub test を増やさない方針でした。

    #2620 に入れる最小修正

    Issue body は大規模に書き直す必要はなく、次の6点で十分です。

    1. Outcome/AC1 を「controlled transaction を preflight が実行する」ようにも読める表現から、NEXT_ACTION: issue_editor_required を返す control-plane handoff に変更する。

    2. SKILL.md を Allowed Paths に追加し、issue_editor_required の eligibility が scope reframe 限定ではなくなったことを正本へ反映する。

    3. Current Validated Scope の CONTRACT_PATCH_PLAN_V1 に関する記述を、existing section-bound patch でも表現できない feedback に限定して修正する。

    4. substantive contract feedback の判定を新 heuristic にせず、既存 human_review_directive + explicit + with_human_context + same-target binding に固定する。

    5. handoff payload は raw comment body ではなく canonical reviewer_feedback_url とする。

    6. AC6 は real run_preflight() で NEXT_ACTION: issue_editor_required / preflight writes=0 /既存 patch route非回帰を確認する。新しい live GitHub test や agent-guard subsystem は追加しない。

    この修正後なら、APPROVE にかなり近い narrow workflow fix です。現在の最大の問題は安全性不足ではなく、既存 issue_editor_required を再利用するのか、それとは別に transaction を呼ぶのかが契約上固定されていないことです。そこを一本化するのが最優先です。

    ## 結論

    #2620 は REQUEST CHANGES 相当です。 問題設定自体は妥当で、#2619 から transport/PATCH 問題を分離したのも正しいです。ただし現在の契約には、実装者が run_refinement_preflight.py から直接 edit_issue_txn.py を呼ぶ実装に進めてしまう余地があります。これは既存 architecture と衝突します。

    このリポジトリでは、orchestrator は control-plane の routing に限定し、Issue 本文編集は issue-editor SubAgent に委譲するのが既存 SSOT です。issue-editor はすでに issue_number + reviewer_feedback_url | reviewer_feedback_text を受け取り、candidate body を生成して既存 controlled transaction に渡せます。

    したがって #2620 で作るべきものは新しい editor transaction route ではなく、既存 NEXT_ACTION: issue_editor_required の eligibility 拡張です。

    敵対的レビュー

    Severity 指摘 問題 推奨
    BLOCKER handoff の終点が曖昧 Issue は「existing issue-editor controlled transaction へ handoff」と書いていますが、preflight が transaction を直接実行するのか、issue-editor へ routing するのか固定されていません。前者だと control-plane/data-plane 分離を破ります。 preflight は writes=0 のまま NEXT_ACTION: issue_editor_required を返すだけにする。main-thread が issue-editor(issue_number, reviewer_feedback_url=anchor_url) を起動する。
    BLOCKER Allowed Paths に SKILL.md がない 現行 SKILL.md は issue_editor_required を「approved scope reframe + empty operations」に限定して説明しています。#2620 が別種の feedback に拡張すると正本が即座に stale になります。 .claude/skills/issue-refinement-loop/SKILL.md を Allowed Paths に追加。references/anchor-comment-handling.md も route semantics を更新するなら追加。
    HIGH Current Validated Scope の前提が正確でない 「CONTRACT_PATCH_PLAN_V1 は scope reframe / exact allowed-path delta からしか生成されない」は広すぎます。既存コードは revised acceptance criteria 等を contract section marker として認識し、Acceptance Criteria の section patch を生成できます。 gap を「既存の section-bound patch derivation でも表現不能で、既存 scope-reframe full-rewrite route にも該当しない explicit human contract directive」に限定する。
    HIGH substantive contract feedback が型付けされていない 新しい heuristic を preflight に入れれば Out of Scope の parser/classifier 変更になります。単なる長文レビューや箇条書きを誤って body rewrite authority にできます。 新 classifier は作らず、既存の authority_category == human_review_directive、explicit directive、with_human_context、same-target binding を eligibility の SSOT にする。
    HIGH direct owner feedback が既存 trust model より狭い #2086 系では human review directive は trusted OWNER/MEMBER/COLLABORATOR を既存カテゴリとして扱っています。#2620 だけ OWNER-only にすると隠れた二重ポリシーになります。 既存 human_review_directive predicate をそのまま再利用。OWNER-only に変えるなら「意図的な trust-policy change」と明文化する。
    HIGH raw feedback の handoff 方法が未固定 既存ルールは raw anchor_comment.snapshot を Step 4 の reviewer_feedback_text に流すことを明示的に禁止しています。 raw body ではなく canonical reviewer_feedback_url を渡す。これなら issue-editor が fresh source を読み直せます。
    MEDIUM AC6 が callback-only false-green になり得る #2048/PR #2057 では helper-level test が production reachability を証明できない問題を実際に踏み、最終的に canonical path E2E まで追加しています。 新しい巨大 E2E harness は不要。ただし real run_preflight() → result/stdout の issue_editor_required までは通し、contract-patch mutation が0回であることを確認する。
    MEDIUM freshness 責務が重複しそう #2583 は source anchor を transaction dispatch 直前に再取得して identity/revision を検証する既存先例があります。editor transaction 自体も precondition/readback を所有しています。 preflight は human-context provenance + anchor binding まで。current Issue body の stale-write 防止/readback は既存 editor transaction、rewrite 後の authorization は既存 fresh preflight/review/readiness gate に任せる。

    推奨する routing

    実装の中心はこの程度に抑えるのがよいです。

    preflight.run.with_human_context
            │
            ├─ existing section-bound CONTRACT_PATCH_PLAN is possible
            │      → existing contract_update route
            │
            ├─ existing approved scope-reframe full rewrite
            │      → existing issue_editor_required
            │
            ├─ explicit trusted human_review_directive
            │    + same-target/provenance/anchor binding valid
            │    + existing safe patch representation unavailable
            │      → issue_editor_required
            │         writes = 0 at preflight
            │
            └─ ambiguous / untrusted / binding mismatch
                   → existing fail-closed
    

    issue_editor_required を受けた root/main thread が、canonical anchor URL を reviewer_feedback_url として既存 issue-editor に渡す。candidate body の意味論的生成は issue-editor、mutation/precondition/readback は edit_issue_txn.py、その後の fresh gate は既存 refinement loop、という現在の責務分割を維持します。

    これなら #2620 の Out of Scope に書かれている「parser/executor/security harness を増やさない」「曖昧な自由文を自動 rewrite しない」にも整合します。

    WEB側の仕様確認

    GitHub 側にも追加機構は不要です。GitHub REST の issue-comment GET は comment_id による直接取得ができ、response に html_url、raw Markdown body、updated_at、issue_url、author_association が含まれます。つまり現在使っている anchor identity / target binding / freshness 確認の材料は公式 API だけで十分あります。([GitHub Docs]1)

    また GitHub CLI の gh issue edit は --body-file を正式に提供しています。したがって、既存 controlled executor の上に ETag/CAS service、approval ledger、別 publisher、permission service を追加する技術的理由は見当たりません。([GitHub CLI]2)

    個人趣味開発という前提なら、セキュリティ機構を増やすより「既存 trust classification → 既存 routing → 既存 issue-editor → 既存 transaction」を一本化する方が品質と完走率の双方に効きます。#2619 の元レビューも、同じ思想で新 parser・receipt・permission/security harness・mandatory live GitHub test を増やさない方針でした。

    #2620 に入れる最小修正

    Issue body は大規模に書き直す必要はなく、次の6点で十分です。

    1. Outcome/AC1 を「controlled transaction を preflight が実行する」ようにも読める表現から、NEXT_ACTION: issue_editor_required を返す control-plane handoff に変更する。
    2. SKILL.md を Allowed Paths に追加し、issue_editor_required の eligibility が scope reframe 限定ではなくなったことを正本へ反映する。
    3. Current Validated Scope の CONTRACT_PATCH_PLAN_V1 に関する記述を、existing section-bound patch でも表現できない feedback に限定して修正する。
    4. substantive contract feedback の判定を新 heuristic にせず、既存 human_review_directive + explicit + with_human_context + same-target binding に固定する。
    5. handoff payload は raw comment body ではなく canonical reviewer_feedback_url とする。
    6. AC6 は real run_preflight() で NEXT_ACTION: issue_editor_required / preflight writes=0 /既存 patch route非回帰を確認する。新しい live GitHub test や agent-guard subsystem は追加しない。

    この修正後なら、APPROVE にかなり近い narrow workflow fix です。現在の最大の問題は安全性不足ではなく、既存 issue_editor_required を再利用するのか、それとは別に transaction を呼ぶのかが契約上固定されていないことです。そこを一本化するのが最優先です。

  3. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    推奨アクション

    #2620 は、このコメントを operator_asserted_human_context として採用し、Issue本文を in-place refinement するのが妥当です。対象コメントは #2620 に属する OWNER コメントで、run_refinement_preflight.py が transaction を直接呼ぶ設計を否定し、NEXT_ACTION: issue_editor_required の eligibility 拡張へ契約を修正するよう明示しています。

    特に、コメント記載の6点だけでなく、current-main では references/loop-state.md も issue_editor_required を「approved scope reframe + empty operations[]」に限定しています。さらに decide_rewrite_route.py 自体も同じ前提で full-body-rewrite fallback を定義しています。したがって まず codebase-investigator に実際の routing SSOT を確認させ、必要なら #2620 の Allowed Paths をその最小集合まで拡張するべきです。run_refinement_preflight.py だけに局所分岐を追加して SSOT を二重化するのは避けるべきです。

    また issue-editor は既に issue_number + reviewer_feedback_url を正式入力として持ち、本文 mutation を controlled executor に委譲する責務分割になっています。root/main thread が本文を書き換えたり edit_issue_txn.py を直接呼ぶ必要はありません。

    以下を、そのまま既に auto mode の Claude Code に投入するのを推奨します。

    Issue #2620 を、以下の anchor comment を direct human context として扱い、.claude/skills/issue-refinement-loop で refinement 完了まで進めてください。

    Target Issue:
    #2620

    Anchor comment:
    #2620 (comment)

    この対話プロンプトは operator からの明示的な direct human instruction です。
    対象 anchor は operator_asserted_human_context として preflight.run.with_human_context lane で処理してください。
    with_agent_report や unlabeled with_anchor として扱わないでください。

    既に Claude Code は auto mode で起動済みです。
    通常の refinement iteration、調査、レビュー、Issue本文修正について人間承認を求めず自動継続してください。
    ただし Claude Code 自体の permission mode を変更したり、dangerous permission bypass flag を追加したりしないでください。
    repository の canonical workflow / skill contract は維持してください。

    Operator decisions

    anchor comment の REQUEST CHANGES と推奨方向を採用します。

    #2620 は新規 Issue へ分割せず、現在の Issue を in-place refinement してください。

    architecture の決定は以下で固定します。

    • preflight.run.with_human_context は Issue body mutation を直接実行しない。
    • preflight 側の該当 route は writes=0 のまま NEXT_ACTION: issue_editor_required を返す control-plane handoff とする。
    • NEXT_ACTION: issue_editor_required を受けた root/main thread が既存 issue-editor SubAgent を起動する。
    • issue-editor には issue_number: 2620 と、この canonical anchor URLを reviewer_feedback_url として渡す。
    • raw anchor_comment.snapshot を reviewer_feedback_text として転送しない。
    • candidate body の意味論的生成は issue-editor、mutation/precondition/readback は既存 controlled transaction の責務とする。
    • run_refinement_preflight.py から edit_issue_txn.py を直接実行する新 route は作らない。
    • 新しい parser/classifier、receipt、ledger、publisher、permission/security subsystem、live GitHub test harness は追加しない。

    eligibility は新 heuristic を作らず、既存 trust/authority model を再利用してください。

    • authority_category == human_review_directive
    • directive confidence が既存判定で explicit
    • with_human_context
    • trusted principal の既存 predicate
    • same-target / provenance / anchor binding が valid

    OWNER-only の新しい trust policy は作らず、current-main の既存 human_review_directive predicate を SSOT としてください。

    routing priority は概ね次を維持してください。

    1. existing section-bound CONTRACT_PATCH_PLAN_V1 で安全に表現可能
      → existing contract-update route

    2. existing approved scope-reframe full-rewrite case
      → existing issue_editor_required

    3. explicit trusted human_review_directive

      • human-context/provenance/same-target binding valid
      • existing section-bound safe patch representation unavailable
        → issue_editor_required
        → preflight writes=0
    4. ambiguous / untrusted / invalid anchor / binding mismatch
      → existing fail-closed
      → writes=0

    Investigation — SubAgent required

    最初に codebase-investigator SubAgent を使って current-main を read-only 調査してください。
    SubAgent の完了を必ず待ってから、その結果を main thread で consume してください。

    最低限、次を確認してください。

    • .claude/skills/issue-refinement-loop/SKILL.md
    • .claude/skills/issue-refinement-loop/references/loop-state.md
    • .claude/skills/issue-refinement-loop/references/anchor-comment-handling.md
    • .claude/skills/issue-refinement-loop/references/scope-signal-guard.md
    • .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py
    • .claude/skills/issue-refinement-loop/scripts/decide_rewrite_route.py
    • .claude/skills/issue-refinement-loop/scripts/scope_signal_delta.py
    • .claude/agents/issue-editor.md
    • .claude/skills/edit-issue/scripts/edit_issue_txn.py
    • relevant focused tests

    特に、issue_editor_required の eligibility / reason code / routing semantics の production SSOT がどこにあるかを確認してください。

    anchor comment は SKILL.md の Allowed Paths 追加を指摘していますが、current-main の references/loop-state.md や routing helper も scope-reframe-only semantics を持っている可能性があります。

    必要な場合は、Issue #2620 の Allowed Paths を「今回の narrow eligibility 拡張を一貫して実装・文書化・検証するための最小 SSOT集合」に更新してください。

    これは今回の owner-approved refinement scope 内の修正として扱い、単に現在の Allowed Paths 外だからという理由だけで human escalation しないでください。
    ただし unrelated subsystem まで広げないでください。

    たとえば調査結果次第では以下が候補です。

    • .claude/skills/issue-refinement-loop/SKILL.md
    • .claude/skills/issue-refinement-loop/references/loop-state.md
    • .claude/skills/issue-refinement-loop/references/anchor-comment-handling.md
    • .claude/skills/issue-refinement-loop/scripts/decide_rewrite_route.py
    • 対応する focused routing test

    実際に必要かどうかは current-main の production call path を確認して決めてください。
    run_refinement_preflight.py にだけ ad-hoc branch を追加して routing SSOT を二重化する実装にはしないでください。

    Issue contract refinement

    anchor comment の指摘を Issue body に反映してください。

    特に以下を明確化してください。

    • Outcome / AC1:
      controlled transaction の直接実行ではなく
      NEXT_ACTION: issue_editor_required を返す control-plane handoff であること。

    • Current Validated Scope:
      gap を「CONTRACT_PATCH_PLAN_V1 が scope reframe / allowed-path delta しか扱えない」と広く表現しない。
      existing section-bound patch derivation でも表現不能で、既存 scope-reframe full-rewrite route にも該当しない explicit trusted human contract directive に限定する。

    • AC2:
      section-bound safe patch representation が存在しない explicit trusted human directive でも、新しい patch plan を捏造せず issue_editor_required に到達すること。

    • AC3/AC4:
      untrusted、ambiguous、invalid/mismatched binding は従来どおり fail-closed / writes=0。

    • AC5:
      existing contract-patch route と existing approved-scope-reframe route を regression させない。

    • AC6:
      helper callback 単体だけでなく real run_preflight() production-reachable path から
      result/stdout の NEXT_ACTION: issue_editor_required まで確認する。
      preflight mutation が0回であることも確認する。
      巨大な新規E2E/live GitHub harness は追加しない。

    • handoff payload:
      raw feedback text ではなく canonical reviewer_feedback_url。

    • trust:
      current-main の existing human_review_directive predicate を再利用し、実装: trusted human contract feedback を controlled editor handoff に接続する #2620 固有の OWNER-only policy は新設しない。

    #2619 の Contract Snapshot transport/PATCH reconciliation は引き続き別 scope とし、#2620 に取り込まないでください。

    Rewrite execution

    canonical refinement result が issue_editor_required を返した場合、root/main thread 自身で Issue body を編集しないでください。

    issue-editor SubAgent を起動し、

    を渡してください。

    issue-editor の完了を必ず待ってください。
    その compact result / readback を受け取ってから次の fresh preflight / review に進んでください。

    SubAgent を fire-and-forget にしないでください。
    起動した全 SubAgent は、main thread が次の routing decision を行う前に completion join してください。
    nested SubAgent delegation は行わず、必要な sequential orchestration は root/main thread が担当してください。

    planner が web research を必要と判定した場合は web-researcher SubAgent を使用し、その完了も待ってからレビューへ進んでください。

    canonical Step 2 が root-owned review pipeline である場合、legacy issue-reviewer SubAgent を独自に追加して二重レビュー経路を作らないでください。

    Loop policy

    needs-fix が残る限り、skill の canonical iteration policy に従って自動継続してください。
    各 iteration で人間承認を求めないでください。

    rewrite 後は必ず fresh Issue body / anchor state を取得し、fresh preflight → review/readiness を再実行してください。
    mutation 前の approval/readiness を再利用しないでください。

    target comment の指摘を表面的に文章へ追記するだけではなく、Outcome / Scope / AC / Allowed Paths / Verification Commands / Notes が互いに矛盾しない状態まで refinement してください。

    Stop policy

    通常の needs-fix、Issue本文更新、SubAgent dispatch、focused test planningでは停止しないでください。

    停止するのは以下のような canonical non-overridable condition のみです。

    • destructive/non-idempotent operation が必要
    • secret / credential の取得・露出が必要
    • permission boundary / external-service boundary の実質変更が必要
    • target comment と current-main の事実が両立せず、上記 Operator decisions でも一意に解決できない
    • unrelated architecture まで変更しなければ成立せず、本当に別 Issue が必要
    • concurrent unmerged change と同一 routing SSOT を競合編集しており、安全な refinement contract を確定できない

    単なる「人間承認が未取得」は停止理由にしないでください。このプロンプトに記載した Operator decisions は今回の human decision として扱ってください。

    Completion condition

    Issue #2620 の本文が anchor comment の BLOCKER/HIGH 指摘を解消し、current-main の routing SSOT と整合し、fresh refinement review が implementation-ready と判断できるところまで完了してください。

    今回の作業は Issue refinement です。
    #2620 の実装、実装用 branch 作成、implementation PR 作成には進まないでください。

    最後に簡潔に以下を報告してください。

    • final refinement verdict
    • Issue body を更新したか
    • anchor comment をどの authority/origin lane で処理したか
    • 使用して completion join した SubAgent
    • issue_editor_required がどの責務境界として Issue contract に固定されたか
    • Allowed Paths の変更内容と理由
    • remaining blocker の有無
    • implementation-ready かどうか

    このプロンプトでは、コメントの指摘をそのまま適用するだけでなく、current-main の routing SSOT を調べてから Allowed Paths を確定する点を追加しています。現状の Issue は実装対象を run_refinement_preflight.py と一部テストに限定していますが、既存 architecture では issue_editor_required の意味が複数の正本に記載されているため、ここを refinement 時点で整合させるのが重要です。

  4. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    Refinement Loop 完了報告(#2620)

    Verdict: approved(implementation-ready)

    anchor comment https://github.com/squne121/loop-protocol/issues/2620#issuecomment-5616372032(OWNER, REQUEST CHANGES 相当、operator_asserted_human_context として preflight.run.with_human_context レーンで処理)の BLOCKER×2 / HIGH×5 / MEDIUM×2 指摘をすべて Issue 本文へ反映しました。

    • Outcome/AC1: preflight / contract_update は writes=0 のまま NEXT_ACTION: issue_editor_required を返す control-plane handoff に限定し、実行主体(issue-editor SubAgent + 既存 edit_issue_txn.py)を root/main thread 側に明確化。
    • Allowed Paths: current-main の routing SSOT 調査(decide_rewrite_route.py::decide_scope_reframe_contract_route()、references/loop-state.md)に基づき、SKILL.md / references/loop-state.md / decide_rewrite_route.py / 新規 focused test を追加。run_refinement_preflight.py への ad-hoc 分岐でSSOTを二重化しないことを Stop Conditions/Notes に明記。
    • Current Validated Scope: CONTRACT_PATCH_PLAN_V1 が生成可能な範囲を正確化し、gap を「既存 section-bound patch derivation でも表現不能かつ既存 scope-reframe full-rewrite route にも非該当な explicit trusted human_review_directive」に限定。
    • AC2/AC5/AC6: patch plan 捏造禁止、既存route非regression、real run_preflight() production-reachable path + preflight mutation回数0の確認をAC6に明記。
    • eligibility: 新規 heuristic を作らず既存 human_review_directive predicate(OWNER/MEMBER/COLLABORATOR含む既存trust範囲)を再利用。#2620固有のOWNER-only新設なし。
    • handoff payload: canonical reviewer_feedback_url に固定、raw snapshotは転送しない。
    • 実装: Contract Snapshot publish の transport round-trip と PATCH reconciliation を修正する #2619 との分離を維持(Out of Scope)。

    Allowed Paths 拡張の結果、docs/dev/extension-surface-runtime-policy.yaml の risk-trigger policy(skill-invocation-procedure-or-contract-change / subagent-lifecycle-start-stop-delegation-fallback、default_decision: immediate)に一致したため、Runtime Verification Applicability を immediate に更新し、必須フィールド(applicable_acs/execution_environment/skip_conditions/fallback_policy/artifact_requirements)と対応 Stop Conditions を追加しています。

    Fix_delta 1周: 初回 rewrite で Allowed Paths の1エントリ(anchor-comment-handling.md)に条件付き注釈がpath literalへ結合される不整合を検出し、調査の結果このファイルは本Issueのnarrow scopeで変更確証がないため削除。fresh preflight/review で解消確認済み。

    Final body_sha256: sha256:441e17514d9452b54286d07fea132abe30709b698ca791b085e407627092f96c

    fresh preflight(preflight.run.with_human_context): STATUS: pass / NEXT_ACTION: proceed
    fresh Step 2 review(run_root_review_pipeline.py produce): canonical_step2_route: step_2_5 / verdict: approve / blocking_issues: [] / 全 deterministic checks pass


    Note: 本 iteration は operator 指示により Issue refinement のみを対象としており、実装・実装用 branch 作成・implementation PR 作成には進んでいません(impl-review-loop への自動 handoff LOOP_HANDOFF_RESULT_V1 marker は本コメントでは意図的に出力していません)。実装は別途フェーズとして開始してください。

  5. self-assigned this
    on Sep 10, 2026
  6. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    推奨は そのまま #2620 の impl-review-loop を開始です。refinement は既に approved (implementation-ready) まで完了しており、直近レポートでも実装フェーズには未着手と明示されています。

    Issue 契約も、実装の中心を decide_rewrite_route.py の routing SSOT 拡張に限定し、run_refinement_preflight.py 側だけに ad-hoc 分岐を作らないこと、preflight 自身は writes=0 のまま issue_editor_required を返すことを固定済みです。 現時点の main は f36f41a7... で、open PR #2621 は #2619 の impl-review-loop/scripts/ensure_contract_snapshot.py とそのテストを変更するものなので、#2620 の Allowed Paths との直接衝突は確認できません。

    impl-review-loop 自体も、root/main thread が control-plane を担当し、Implementation → Verification → PR Review を SubAgent に委譲し、APPROVE と live mergeability を満たすまで循環する設計です。最終 approved 境界では PR のマージ判断を人間に残します。

    以下を、既に auto mode で起動している対話的 Claude Code にそのまま投入するのを推奨します。

    Issue #2620 を対象に、.claude/skills/impl-review-loop を使用して、実装・検証・PR作成・PRレビュー・レビュー修正ループを、canonical skill contract に従って実行してください。

    Target:
    #2620

    直近の refinement completion report:
    #2620 (comment)

    Claude Code は既に auto mode で起動済みです。
    通常の調査、worktree/branch作成、実装、テスト、commit、push、Draft PR作成、PR本文修正、CI確認、レビュー、レビュー指摘修正、再検証、再レビューについて、人間承認を求めず自律的に継続してください。

    ただし .claude/skills/impl-review-loop および live Issue に定義された実 hard stop / human escalation 条件は勝手に無効化しないでください。
    routine confirmation と canonical hard stop を混同しないでください。

    最終停止点は .claude/skills/impl-review-loop の route: approved / IMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_ready 相当、すなわち人間が最終マージ判断できる状態です。
    PR の merge 自体は実行しないでください。
    auto-merge も有効化しないでください。

    0. Fresh entry / collision check

    開始時に必ず live state を再取得してください。

    過去の body SHA、contract snapshot、artifact、今回プロンプト記載時点の main SHA を Step 1 authorization として再利用しないでください。

    #2620 の Notes に従い、current-main と open PR を fresh に再確認してください。
    実際に #2620 の Allowed Paths を変更している unmerged PR があれば、canonical conflict handling に従ってください。
    単なる関連 Issue、advisory overlap、別パスの変更だけを理由に停止しないでください。

    直近 refinement report
    #2620 (comment)
    を intake に渡す必要がある場合は agent_report_comment_urls として扱ってください。
    human_context_comment_urls として扱わないでください。

    以前の review comment
    #2620 (comment)
    の substantive feedback は既に live Issue body に反映済みです。
    実装 authority は fresh live Issue contract を正本にしてください。

    1. Root-owned synchronous entry transition

    .claude/skills/impl-review-loop の Root-Owned Synchronous Entry Transition を省略しないでください。

    root/main thread 自身が、一続きの invocation 内で、

    1. capability preflight
    2. live Issue fetch
    3. current-run issue-contract-review
    4. live Issue 再取得
    5. routing decision
    6. 条件成立時のみ Step 1 SubAgent dispatch

    まで実行してください。

    古い contract snapshot、古い review report、artifact、digest、comment marker だけを implementation entry authorization として使用しないでください。

    2. SubAgent execution contract

    root/main thread は control-plane / state tracking / routing に徹してください。

    各実作業は .claude/skills/impl-review-loop が規定する SubAgent に委譲してください。

    少なくとも以下を守ってください。

    • Step 1: implementation-worker SubAgent を起動する

    • Step 1 SubAgent の完了を必ず待つ

    • compact result / actual changed paths / HEAD / PR binding を受領してから次へ進む

    • Step 2: test-runner SubAgent を起動する

    • test-runner の完了を必ず待つ

    • VC_ADJUDICATION_RESULT_V1 等の canonical result を受領してから次へ進む

    • Step 4: pr-reviewer SubAgent を起動する

    • pr-reviewer の完了を必ず待つ

    • verdict / reviewed_head_sha / blockers / warnings を受領してから Step 5 を判定する

    • REQUEST_CHANGES の修正、update_branch、body-only remediation 等を worker に再委譲した場合も、その SubAgent の完了を必ず待つ

    SubAgent を fire-and-forget にしないでください。
    完了前に次 Step に進まないでください。
    root/main thread が SubAgent の作業を横取りして直接実装しないでください。

    また、#2620 の Stop Conditions にある nested SubAgent delegation は避けてください。
    root/main thread → SubAgent の委譲とし、SubAgent 自身にさらに別 SubAgent を起動させないでください。

    3. #2620 implementation constraints

    live Issue の Acceptance Criteria / Allowed Paths / Out of Scope を正本として実装してください。

    特に以下は必須です。

    Routing SSOT

    中心となる変更は
    .claude/skills/issue-refinement-loop/scripts/decide_rewrite_route.py
    の既存 routing SSOT の拡張です。

    run_refinement_preflight.py にだけ ad-hoc な特例分岐を追加して routing SSOT を二重化しないでください。

    routing priority は既存 contract を維持してください。

    1. existing section-bound CONTRACT_PATCH_PLAN_V1 で安全に表現可能
      → existing contract-update route

    2. existing approved scope-reframe full rewrite / empty operations[]
      → existing issue_editor_required

    3. safe section-bound representation が存在しない explicit trusted human_review_directive

      • with_human_context
      • existing trusted principal predicate
      • same-target / provenance / anchor binding valid
        → existing issue_editor_required
        → preflight / contract_update writes = 0
    4. ambiguous / untrusted / invalid binding
      → existing fail-closed
      → writes = 0

    既存 route を新 route が横取りしないようにしてください。

    Eligibility

    新しい semantic classifier / heuristic / parser を作らないでください。

    既存の、

    • authority_category == human_review_directive
    • explicit directive
    • with_human_context
    • existing trusted principal predicate
    • same-target binding
    • provenance binding
    • anchor binding

    の組み合わせだけを eligibility SSOT としてください。

    #2620 固有の OWNER-only trust policy を作らないでください。
    既存 predicate の OWNER/MEMBER/COLLABORATOR を含む trust model を維持してください。

    Handoff

    preflight / contract_update 自身から edit_issue_txn.py や issue-editor を直接実行しないでください。

    control-plane は writes=0 のまま NEXT_ACTION: issue_editor_required を返すだけにしてください。

    handoff payload は canonical reviewer_feedback_url を使用してください。

    raw anchor_comment.snapshot body を reviewer_feedback_text として転送しないでください。

    candidate body の semantic generation は既存 issue-editor、
    mutation / precondition / readback は既存 edit_issue_txn.py、
    rewrite 後 authorization は fresh refinement gates、
    という既存責務分割を維持してください。

    Scope

    #2619 の Contract Snapshot transport/PATCH reconciliation を #2620 に取り込まないでください。

    以下を新設・変更しないでください。

    • raw GitHub mutation route
    • edit_issue_txn.py
    • publisher/executor
    • new receipt/ledger/state schema
    • new parser/classifier
    • new security/permission subsystem
    • live GitHub write E2E harness

    Allowed Paths を厳守してください。
    Allowed Paths 外の変更が本当に必要なら勝手に scope expansion せず、Issue の Stop Conditions に従ってください。

    4. Tests / runtime verification

    Issue に記載された Verification Commands をすべて実行してください。

    最低限、

    • test_preflight_run_with_anchor.py
    • test_decide_rewrite_route_human_review_directive.py
    • test_scope_delta_authority_e2e.py

    を対象にしてください。

    新規 focused test file が current-main に存在しない場合は、Allowed Paths 内なので必要に応じて作成してください。

    AC6 は helper-only test で済ませないでください。

    real run_preflight() の production-reachable path を通して、

    • NEXT_ACTION: issue_editor_required
    • preflight mutation count == 0
    • canonical reviewer_feedback_url propagation

    を確認してください。

    AC3 / AC4 negative cases について、

    • untrusted
    • invalid anchor
    • target mismatch
    • provenance mismatch
    • ambiguous/non-explicit input

    が issue_editor_required に到達せず、writes=0 の既存 fail-closed を維持することを確認してください。

    既存 section-bound patch route、
    approved scope-reframe full-rewrite route、
    freeform exact allowed-path-delta route
    の regression も確認してください。

    Runtime Verification Applicability は immediate です。
    必要な runtime evidence を
    artifacts/2620/runtime-verification/
    へ保存してください。

    PR の ## Runtime Verification Evidence には、Issue contract に従って redact 済みの、

    • NEXT_ACTION
    • mutation count
    • PASS / FAIL / SKIP

    の要約だけを記載してください。
    raw stdout 全文や秘密情報は貼らないでください。

    SKIP exit 77 や fallback-only success は PASS とみなさないでください。

    5. PR creation

    原則 1 Issue = 1 PR としてください。

    専用 worktree / branch を使用してください。
    既存の #2620 branch / PR が fresh discovery で見つかった場合は重複作成せず canonical resume/rebind を行ってください。

    新規作成なら Draft PR を基本とし、PR body に必ず、

    Closes #2620

    を入れてください。

    PR description には最低限、

    • Summary
    • Checks / Verification
    • Runtime Verification Evidence
    • scope / Allowed Paths conformity
    • relevant architectural invariants

    を明示してください。

    6. Review loop

    PR 作成後に終了しないでください。

    Step 2 verification → Step 4 PR review → Step 5 routing を繰り返してください。

    pr-reviewer が REQUEST_CHANGES の場合:

    1. blockers を具体的な fix_delta に変換
    2. implementation-worker に委譲
    3. worker 完了を待つ
    4. head-changing change なら再検証
    5. current head で PR review を再実行
    6. Step 5 を再判定

    してください。

    reviewed HEAD と current PR HEAD がずれた場合は人間に聞かず current head で re-review してください。

    BEHIND の場合は canonical update_branch action を implementation-worker に委譲し、完了を待ち、その後 verification と PR review を再実行してください。

    単なる human_review_required: true という SubAgent 自己申告だけを routine stop にしないでください。
    canonical skill の正式な routing result に従ってください。

    CI / mergeability の一時的な UNKNOWN、BLOCKED、UNSTABLE 等も、skill が定める bounded retry / current-head re-evaluation を実行し、即座に人間承認へ逃げないでください。

    7. Human approval policy

    以下については routine human approval を要求しないでください。

    • codebase investigation
    • worktree creation
    • branch creation
    • Allowed Paths 内の編集
    • tests / lint / typecheck / build
    • runtime verification
    • commit
    • push
    • Draft PR creation
    • PR body updates
    • review execution
    • REQUEST_CHANGES fixes
    • update_branch
    • CI rerun
    • stale-head re-review
    • mergeability re-evaluation

    auto mode の範囲で自動継続してください。

    ただし、live Issue / skill が規定する実 hard stop、
    secret/protected-path gate、
    actual Git conflict、
    permission failure、
    明示的 owner veto、
    max-iteration 等の canonical escalation 条件が成立した場合は、その事実を隠さず停止してください。

    8. Completion condition

    以下が揃うまで作業完了扱いにしないでください。

    • 実装: trusted human contract feedback を controlled editor handoff に接続する #2620 AC が満たされている
    • Allowed Paths gate が満たされている
    • required verification が current head で成功
    • required CI が current head に対して評価済み
    • pr-reviewer verdict が APPROVE
    • blockers == []
    • reviewed_head_sha が current PR head と一致
    • live mergeability が canonical approved 条件を満たす
    • Closes #2620 が PR に存在
    • runtime verification evidence が PR に記載済み
    • unresolved review blocker がない
    • .claude/skills/impl-review-loop の Step 5 が route: approved に到達

    ここまで到達したら、PRをマージせず停止してください。

    最後に compact に、

    • PR URL / number
    • branch
    • final HEAD SHA
    • changed files
    • tests / CI
    • runtime verification result
    • final reviewer verdict
    • live mergeability
    • unresolved blockers
    • IMPL_REVIEW_LOOP_RESULT_V1
    • 「人間に残っている操作 = final merge judgment」

    を報告してください。

    このプロンプトでは、特に 「SubAgent を起動したら必ず join する」「root が実装を横取りしない」「routine な human_review_required 自己申告で止まらない」「最終 merge だけ残す」 を強く固定しています。一方で、#2620 自身や skill が定義する本物の hard stop まで無効化はしていません。これが現在のリポジトリ契約との整合性が最も高い運用です。

  7. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

  8. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-09-10T10:30:12Z)

    • PR: feat: trusted human contract feedback を controlled editor handoff に接続する #2623
    • Worktree: .claude/worktrees/issue-2620-trusted-human-editor-handoff
    • Branch: worktree-issue-2620-trusted-human-editor-handoff
    • Verification: 4/4 VC PASS(AC1〜AC6)、skill 全体回帰 2076/2081 PASS(残り5件は本変更と無関係な pre-existing environment 依存 failure、詳細は PR Checks 参照)
    • 後続: PR レビュー(pr-review-judge)→ マージ → post-merge-cleanup
  9. added a commit that references this issue on Sep 10, 2026
    7c15a87
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent/implementerenhancementfollow-upphase/implementationtestworkflow

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions