Skip to content

実装: Claude-GPT issue-refinement preflight の anchor comment 取得を credentialless transport へ統一する #2257

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "Issue #2197 の anchor-comment preflight が isolated Claude-GPT profile で split-brain transport により実在するanchor commentを誤って missing と判定する regression を修正する"
change_kind: code

Parent Issue

なし(単独改善)

Parent Goal Ref

  • Goal: isolated Claude-GPT session の issue-refinement-loop preflight が、実在する anchor comment を transport failure により missing と誤判定しない状態にする。
  • Desired Destination: run_refinement_preflight.py の Issue/comments/anchor 取得が単一の read authority(isolated 時は credentialless transport)に統一される。

Current Validated Scope

  • 設計方針: 1 invocation につき 1 回だけ read authority(GitHubReadTransport 相当の adapter。isolated Claude-GPT 時は credentialless transport、通常時は既存 gh 経路)を選択し、その同一 adapter を issue 本体取得・comments 一覧取得・(trusted-anchor contract update 等で fresh read が必要な場合のみ)single-comment 取得の全てに使う契約に統一する(単に _fetch_single_comment へ isolated 分岐を局所追加するパッチではない)。
  • initial anchor は必ず complete comments traversal(一覧取得結果)から解決する。single-comment 取得は fresh readback が明示的に必要な場合のみ、同一 adapter 経由で行う。_fetch_single_comment() は initial anchor 解決だけでなく、trusted-anchor contract update の fresh readback/TOCTOU 検証(run_refinement_preflight.py 内の別呼び出し箇所)でも使われるため、この統一を怠るとその経路でも split-brain が残る。
  • helper 単位での authority 再選択・gh api への silent fallback を禁止する。
  • scripts/agent-guards/github_credentialless_read.py に single-comment 取得関数を追加し、transport error taxonomy を closed enum(HTTPError だけでなく URLError/DNS/接続失敗/timeout/JSON decode failure/unicode decode failure を含む)に拡張し、_validate_pagination_target() の pagination hardening を強化する。
  • write-capable scope は ## Allowed Paths のみに限定する。

Remaining Parent Gaps

なし。この Issue は単独の regression 修正であり、#2197 の Git protocol 実装、authenticated broker/rate-limit workaround、launcher/credential forwarding 変更、Spark delegation follow-up、#2190 の DAG reframe、command registry semantic redesign はそれぞれ既存トラックまたは別 Issue の責務に残す。

Outcome

isolated Claude-GPT session の canonical preflight(preflight.run.with_human_context production command graph)が、Issue 本体・comments 一覧・initial anchor comment を単一の read authority による complete paginated traversal から一貫して解決し、実在する anchor comment が gh 未認証等の transport failure により ANCHOR_COMMENT_NOT_FOUND や semantic blocker に誤分類されない状態にする。credential isolation boundary(isolated HOME/GH_CONFIG_DIR/token unset)はそのまま維持する。normal(非 isolated)profile の既存 gh 経路は退行させない。修正は scripts/agent-guards/github_credentialless_read.py と .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py へのコード変更、対応する回帰テストの追加、Draft PR の作成として結実する。

Runtime Verification Applicability

decision: immediate
reason: "exact incident replay は実際の production command graph(preflight.run.with_human_context)を fresh isolated HOME・empty GH_CONFIG_DIR・token unset の環境で実行して検証する必要があるため。外部 rate limit/outage は environment_failure として記録し成功と偽装しない。network SKIP を PASS に昇格させない。"
applicable_acs:
  - AC5
  - AC6
  - AC7
execution_environment:
  cli_tools:
    - python3
    - uv
    - gh
  auth_required: false
  network_required: true
skip_conditions:
  - "GitHub API へのネットワーク到達性がない場合は SKIP ではなく environment_failure として扱う"
fallback_policy:
  fallback_success_is_pass: false
  notes: "fallback 経由の成功(native web fallback 等)を PASS に変換しない"
artifact_requirements:
  - "refinement_preflight_result_v1.json"
  - "gh invocation marker log"

Background

Issue #2197 の issue-refinement-loop preflight で、isolated Claude-GPT session が anchor comment(issue #2197 comment ID 5315264311)の解決に失敗した。

root cause(.claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py):

  • _fetch_issue()(2983行)・_fetch_issue_comments()(3025行)は _is_isolated_claude_gpt_profile() 分岐を持ち、isolated 時は scripts/agent-guards/github_credentialless_read.py の credentialless REST transport を使う。
  • しかし _fetch_single_comment(repo, comment_id)(3064-3067行)だけはこの分岐を持たず、無条件で subprocess.run(["gh","api",f"repos/{repo}/issues/comments/{comment_id}"]) を実行する(split-brain transport)。
  • isolated Claude-GPT では host の gh credential を意図的に渡していない(scripts/claude-gpt/launch.sh:936-943 で HOME/GH_CONFIG_DIR を隔離、GH_TOKEN 等を unset — これは意図された security boundary であり変更しない)。この状態で gh api を叩くと exit code 4(未認証)で失敗することを実機再現で確認済み。
  • _validate_anchor_comment_url()(3438行)の live mode(fixture_comments is None)で 3494-3496: comment_data, err = _fetch_single_comment(...); if comment_data is None: return False, [BLOCKER_ANCHOR_COMMENT_NOT_FOUND, BLOCKER_ANCHOR_NOT_IN_ISSUE] — ここで失敗理由 err("gh_exit_4: ..."等)が一切参照されず捨てられ、認証失敗・timeout・404・rate limit・malformed response の全てが同一の ANCHOR_COMMENT_NOT_FOUND semantic blocker(human_judgment_required)に丸められる。実在する正当な anchor comment がこのバグにより存在しないと誤分類される。
  • 同様の握りつぶしが 5978-5992 にも存在する(優先度は低いがついでに修正)。
  • 既存テスト test_run_refinement_preflight_credentialless_transport.py は _fetch_issue/_fetch_issue_comments の isolated profile のみをカバーし、_fetch_single_comment を一切テストしていない。さらに _fetch_single_comment に言及する唯一のテスト test_trusted_anchor_iteration_zero.py はこの関数を丸ごと mock.patch.object しており、isolated profile 分岐の実挙動は一切検証されていない。これがバグを見逃した直接原因。
  • github_credentialless_read.py には単一 comment 取得関数は存在しないが、list_issue_comments()(pagination込みで comments 全件取得)が既に存在し転用可能。
  • 再現条件: isolated Claude-GPT profile かつ anchor_comment_urls を伴う issue-refinement-loop 実行時のみ到達する(fixture_comments を渡す既存テスト経路では再現しない)。

上記は独立2系統の調査 + adversarial review で実コード確認・実機再現済み(現 HEAD e832322)。

Scope Overlap Note(overlap preflight C1: allowed_paths directory-level match)

overlap preflight は .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py 等のディレクトリレベル一致により #2195(実装: fix: recover source evidence before refinement human escalation)を C1 として検出した。#2195 は REPO_EVIDENCE_REF_V1 acquisition failure の taxonomy・recovery routing(acquisition_status/failure_layer/semantic_verdict、eligible_routes/attempted_routes)を扱う別の抽象化層の改善であり、本 Issue が扱う _fetch_single_comment の split-brain transport(credentialless 統一)とは同一ファイル内でも別の関数・別の concern である。両者は完全一致でも semantic duplicate でもないため、本 Issue は独立して起票する。実装着手時に同一ファイルへの並行変更が判明した場合は Stop Conditions に従う。

In Scope

  • github_credentialless_read.py の typed/sanitized transport error taxonomy と complete pagination hardening
  • run_refinement_preflight.py の single authority 化、snapshot-first anchor resolution、error propagation、early failure artifact
  • 対応する result schema と focused tests
  • 変更境界を反映する最小 docs 更新

Out of Scope

Acceptance Criteria

  • AC1: preflight は Issue/comments/initial anchor を単一の read authority(isolated 時は credentialless transport、通常時は既存 gh 経路)から解決し、_fetch_single_comment の isolated 呼び出し内で authority を途中で切り替えない(gh api への fallback 禁止)。
  • AC2: complete paginated traversal 取得後に anchor ID が実在しない場合のみ semantic not-found(既存 BLOCKER_ANCHOR_COMMENT_NOT_FOUND 相当、後方互換マッピング明記)にする。
  • AC3: transport failure(認証依存, 401/403, 429, 5xx, DNS, connection, timeout, non-JSON, incomplete pagination, read authority divergence)は sanitize された environment_failure(reason code に err 由来の分類を保持、None 化して握りつぶさない)として、semantic missing と明確に区別する。transport 層は closed enum の reason code へ変換し、preflight は例外文字列(str(exc)、URLError.reason が例外オブジェクトである場合を含む)を artifact/stdout に一切転記しない。分類不能な例外は固定コード transport_internal_error に落とす。
  • AC4: sanitize された reason code/source/operation は canonical result artifact と stdout に一貫して現れ、credential/token/header/raw response/OS error 詳細は一切出力しない。AC3 の closed enum 変換と transport_internal_error フォールバックが result artifact/stdout の両方で一貫していることを含む。
  • AC5: exact incident replay — Issue 実装: control-plane preflight の remote default-ref OID observe/fetch/pin/verify プロトコルを実装する #2197 + 実装: control-plane preflight の remote default-ref OID observe/fetch/pin/verify プロトコルを実装する #2197 (comment) を対象に、fresh isolated HOME、empty GH_CONFIG_DIR、token unset の環境で skill_runtime_exec.py --command-id preflight.run.with_human_context の実 subprocess を起動し、anchor comment 5315264311 が正しく解決されることを確認する。result artifact のスキーマと stdout の整合を確認する。
  • AC6: AC5 の実行中 、trusted effective PATH 上に仕込んだ fail-on-use の gh marker の invocation 回数が 0 であること(single-comment gh api endpoint の直接呼び出しが 0 であることを含む)を確認する。
  • AC7: fault-injection matrix (認証失敗/404/429/5xx/DNS/connection/timeout/invalid JSON/incomplete pagination)が transport→preflight→artifact/stdout/exit の mapping を検証する回帰テストを持つ。存在しない wrong-issue の anchor は semantic mismatch として reject する。さらに以下5種類の negative control を追加する: (a) 同一ホスト上の別 repository/別 issue/別 endpoint を指す Link: rel="next" の reject、(b) malformed Link header の reject、(c) pagination cycle 検出、(d) non-progressing page 検出、(e) duplicate comment ID の dedupe。
  • AC8: normal(非 isolated)profile の既存 gh 経路の挙動を回帰させないことを確認する既存テストが通り続ける。
  • AC9: 403 レスポンスを無条件で RateLimitedRejected に分類しない。x-ratelimit-remaining 等の safe header metadata が利用可能ならそれを使い(primary rate limit は 403/429 かつ x-ratelimit-remaining: 0、secondary rate limit は別条件で判定)、利用できない場合は保守的に http_403_forbidden として分類する。raw response body を taxonomy 判定の必須入力にしない。
  • AC10: .claude/skills/issue-refinement-loop/schemas/refinement_preflight_result_v1.schema.json に status: environment_failure の場合の structured projection(reason_code/source/operation の3フィールド、closed enum、status == environment_failure のときのみ必須・それ以外では禁止という conditional contract)を追加する。early failure 時に raw_issue_snapshot / planner_input artifact が存在しない場合、それらの artifact path/hash を「存在したことにしない」(フィールド自体を出力しない)。

Verification Commands

# AC1
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_run_refinement_preflight_credentialless_transport.py -v
# AC2
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_run_refinement_preflight_credentialless_transport.py -v
# AC3
$ uv run --locked pytest scripts/agent-guards/tests/test_credentialless_github_read.py -v
# AC4
$ uv run --locked pytest scripts/agent-guards/tests/test_credentialless_github_read.py -v
# AC5
$ uv run --locked pytest scripts/agent-guards/tests/test_isolated_anchor_single_authority.py::test_isolated_anchor_comment_resolves_via_single_credentialless_authority -v
# AC6
$ uv run --locked pytest scripts/agent-guards/tests/test_isolated_anchor_single_authority.py::test_isolated_anchor_comment_resolves_via_single_credentialless_authority -v
# AC7
$ uv run --locked pytest scripts/agent-guards/tests/test_credentialless_github_read.py -v
# AC8
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_trusted_anchor_iteration_zero.py -v
# AC9
$ uv run --locked pytest scripts/agent-guards/tests/test_credentialless_github_read.py -v
# AC10
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_run_refinement_preflight_credentialless_transport.py -v
# Standard gate: typecheck
$ pnpm typecheck
# Standard gate: lint
$ pnpm lint
# Standard gate: test
$ pnpm test
# Standard gate: build
$ pnpm build
# Standard gate: model routing
$ uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py

Allowed Paths

  • scripts/agent-guards/github_credentialless_read.py
  • scripts/agent-guards/tests/test_credentialless_github_read.py
  • scripts/agent-guards/tests/test_skill_runtime_exec_anchor.py
  • scripts/agent-guards/tests/test_isolated_anchor_single_authority.py
  • .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py
  • .claude/skills/issue-refinement-loop/schemas/refinement_preflight_result_v1.schema.json
  • .claude/skills/issue-refinement-loop/tests/test_run_refinement_preflight_credentialless_transport.py
  • .claude/skills/issue-refinement-loop/tests/test_trusted_anchor_iteration_zero.py
  • docs/dev/workflow.md
  • .claude/skills/issue-refinement-loop/SKILL.md

Stop Conditions

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

Required Skills

なし

Required Design References

  • docs/dev/workflow.md
  • .claude/skills/issue-refinement-loop/SKILL.md

Scope Delta(任意)

N/A

Notes for Reviewer

以下は絶対に避けるべき修正方向として人間から明示された禁止事項である:

  • Claude-GPT isolated profile 内で gh auth login を要求すること
  • host の GH_TOKEN/GITHUB_TOKEN を Claude-GPT へコピーすること
  • host の .config/gh を isolated GH_CONFIG_DIR へコピー・bind・symlink すること
  • credential isolation を無効化すること
  • credentialless read と authenticated gh api の split-brain を残すこと(anchor 取得だけ別経路のままにする修正は不可)
  • 実在する anchor comment を transport failure から missing と推定すること

_fetch_single_comment に唯一言及する既存テスト test_trusted_anchor_iteration_zero.py がこの関数を丸ごと mock.patch.object しているため、isolated profile 分岐の実挙動を検証する新規テストが必須である。既存の mock 化されたテストだけでは今回の regression(split-brain transport)は検出できない。この新規テストは新規ファイル scripts/agent-guards/tests/test_isolated_anchor_single_authority.py として追加し(既存の test_skill_runtime_exec_anchor.py が持つ、skill_runtime_exec.py → command registry → preflight subprocess の production command graph を実際に実行する subprocess 起動 helper を再利用してよい)、AC5/AC6 の Verification Command から参照する(fresh isolated HOME・empty GH_CONFIG_DIR・token unset で実 subprocess を起動し、fail-on-use の gh marker invocation 回数 0 を assert する)。

Activity

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

    @squne121
    OwnerAuthor

    判定

    verdict: REQUEST_CHANGES
    disposition: reframe_in_place
    implementation_allowed: false
    confidence: high

    Issue #2257 の問題認識そのものは正しいです。current main では _fetch_issue() と _fetch_issue_comments() が isolated Claude-GPT 時に credentialless transport を使う一方、_fetch_single_comment() だけが無条件に gh api を呼びます。さらに anchor validation では、その取得失敗の err を捨てて ANCHOR_COMMENT_NOT_FOUND に変換しています。

    ただし、Issue 契約はまだ implementation-ready ではありません。現時点で #2257 自体にコメントはなく、契約上の矛盾を実装者側の裁量で埋める状態です。

    1. P0-1 — AC5/AC6 の Verification Command が、要求している production graph を一切証明していません。 実装: Claude-GPT issue-refinement preflight の anchor comment 取得を credentialless transport へ統一する #2257 は「fresh isolated HOME / empty GH_CONFIG_DIR / token unset で preflight.run.with_human_context の full production command graph」を AC5 に要求していますが、VC は test_trusted_anchor_iteration_zero.py を実行するだけです。しかもその既存テストは _fetch_single_comment を mock.patch.object() しており、今回のバグを通りません。 一方、リポジトリには既に skill_runtime_exec.py → command registry → preflight subprocess を検証する scripts/agent-guards/tests/test_skill_runtime_exec_anchor.py がありますが、実装: Claude-GPT issue-refinement preflight の anchor comment 取得を credentialless transport へ統一する #2257 の Allowed Paths には入っていません。 PR fix: Claude-GPT isolated session の trusted uv toolchain 解決を HOME 分離から独立させる (#2241) #2247 の敵対的レビューでも、helper 単体や単なる process-exit=0 を canonical preflight の証拠へ昇格させないことが既に指摘されています。 必須修正は、executor-level test を Allowed Paths に追加し、production command ID を本当に実行する VC に差し替えることです。gh marker=0、child exit、anchor ID 5315264311、result artifact schema、stdout/result 整合まで assert すべきです。

    2. P0-2 — 「single authority」の実装方式が Issue 内で矛盾しています。 Current Validated Scope は「_fetch_single_comment に isolated 分岐を追加」と読めますが、Outcome/In Scope/AC2 は「initial anchor は complete comments snapshot から解決」と要求しています。さらに _fetch_single_comment() は initial anchor だけでなく、trusted-anchor contract update の fresh readback/TOCTOU 検証でも使われています。 したがって symptom patch として _fetch_single_comment() にだけ分岐を足す設計では不十分です。invocation 開始時に GitHubReadTransport を一度だけ選択し、その同一 adapter を read_issue / list_issue_comments / fresh read_issue_comment の全 read に渡す契約へ固定してください。initial anchor は既取得 comments から解決し、mutation 前など fresh read が本当に必要な箇所だけ同じ adapter の single-comment GET を使う形が整合的です。

    3. P0-3 — transport error の sanitization が producer 境界まで閉じていません。 現実装の credentialless reader は HTTPError しか分類せず、URLError、DNS/connection failure、timeout、JSON decode failureなどはそのまま外へ出得ます。さらに preflight 側には broad except Exception as exc から str(exc) を error text に含める経路があります。 Python の URLError.reason は文字列だけでなく別 exception 自体になり得るため、これをそのまま artifact/stdout に出す方式は 実装: Claude-GPT issue-refinement preflight の anchor comment 取得を credentialless transport へ統一する #2257 AC4 の「raw OS error detail を出さない」と両立しません。([Python documentation]1) json.loads() も malformed JSON では JSONDecodeError、不正 encoding では UnicodeDecodeError を送出します。([Python documentation]2) transport 層で closed enum の reason code へ変換し、preflight は例外文字列を解析・転記しない契約が必要です。unknown exception も固定コード transport_internal_error 相当だけに落とし、str(exc) は artifact/stdout に出さないべきです。

    4. P1-1 — pagination hardening の trust boundary がまだ不足しています。 現実装の _validate_pagination_target() は https と api.github.com しか検査しておらず、同じ host 上の別 repository / 別 issue / 別 endpoint を指す Link: rel="next" を通せます。 GitHub は pagination の次ページ URL を Link header として返し、endpoint ごとに query parameter が異なり得る仕様です。([GitHub Docs]3) 実装: Claude-GPT issue-refinement preflight の anchor comment 取得を credentialless transport へ統一する #2257 AC7 には「incomplete pagination」だけでなく、same-host foreign-repo path、wrong issue、malformed Link、cycle、non-progressing page、duplicate comment ID の negative control を入れるべきです。Issue-specific comments endpoint は per_page 最大100、page パラメータを持つため、この endpoint に限定した canonical URL validation は実装可能です。([GitHub Docs]4)

    5. P1-2 — 403 を無条件で RateLimitedRejected にする現 taxonomy は GitHub 公式仕様より強すぎます。 current reader は 403/429 を同じ rate-limit class にしています。 GitHub 公式には primary rate limit は「403または429 かつ x-ratelimit-remaining: 0」、secondary limit は 403/429 に加えて error indication や retry-after 等を使って判断します。([GitHub Docs]5) したがって 403 単独を rate_limited と断定せず、safe header metadata を利用するか http_403_forbidden として保守的に分類すべきです。raw response bodyを taxonomy 判定の必須入力にする必要はありません。

    6. P1-3 — environment_failure の structured projection が schema 上未定義です。 現 schema は additionalProperties: false で、status: environment_failure 自体は既にありますが、実装: Claude-GPT issue-refinement preflight の anchor comment 取得を credentialless transport へ統一する #2257 が要求する reason code/source/operation の正確な key、enum、条件付き必須性が定義されていません。 Issue のまま実装すると producer が任意の shape を決めることになります。schema-first で、例えば versioned failure object に source, operation, reason_code の closed enum を持たせ、status == environment_failure 時のみ必須、それ以外では禁止、という conditional contract を先に固定すべきです。early failure 時に raw_issue_snapshot / planner_input が存在しない場合、それらの artifact path/hash を「存在したことにしない」条件も明文化した方が安全です。

    もう一点、「complete snapshot」という表現は狭めた方がよいです。GitHub REST が公式に提供しているのはページ単位の結果と Link による traversal であり、複数 HTTP request を一つのトランザクション snapshot として束縛する仕様はここでは示されていません。([GitHub Docs]3) Issue comments は既定で ID 昇順、public resource なら無認証で取得できるので、今回の方式自体は適切ですが、契約上は「complete paginated traversal」程度に表現を落とす方が正確です。([GitHub Docs]4) 「完全 snapshot を取得できたので ID 不在は確定」とまで主張するなら、concurrent deletion/page shift 等に対する stabilization rule を別途定義する必要があります。

    推奨する reframe

    実装方針は、**「_fetch_single_comment に isolated if を足す」ではなく「1 invocation = 1 GitHub read authority」**に寄せるべきです。initial path は issue → complete comments traversal → comments 内から anchor ID 解決。fresh TOCTOU/readback が必要な production path は同じ adapter の read_issue_comment()。isolated adapter は credentialless REST のみ、normal adapter は既存 gh。いずれの path でも helper ごとの authority 再選択と silent fallback を禁止します。これなら PR #2247 で導入した credential isolation を維持しつつ、今回の split-brain を抽象化レベルで閉じられます。PR #2247 は既に merge 済みで、今回の Issue はその wiring の残存ギャップを修正する位置付けとして妥当です。

    外部仕様との整合では、credentialless GET 方針は維持してよいです。GitHub は public Issue comment の list/get の双方を無認証で利用可能と明記しています。([GitHub Docs]4) また現在コードが固定している REST API 2022-11-28 は 2028年3月10日までサポート対象なので、この regression fix に API version upgrade を混ぜる必要はありません。([GitHub Docs]6)

    したがって、#2257 は close/duplicate ではなく reframe_in_place が適切です。特に P0-1〜P0-3 を契約に入れてから実装開始することを推奨します。現状のまま進めると、局所的には incident を直せても「full production graph で証明した」「transport failure が秘密を漏らさず一貫分類される」という AC5/AC4 の主張が証明不能なまま残ります。

    #2257 の実装PRや新しいレビューコメントが付いた後に、今回の blocker が解消されたか再チェックする監視もできます。

  3. squne121 commented on Aug 19, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-08-19T11:09:20Z)

  4. squne121 commented on Aug 19, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 終了報告

    status: approved(Issue 契約の refinement 完了、VERDICT: approve / blocker 0件)
    termination_cause: approved
    iterations: 2 回の rewrite(review 3回: needs-fix → needs-fix → approve)

    経緯

    1. anchor comment(実装: Claude-GPT issue-refinement preflight の anchor comment 取得を credentialless transport へ統一する #2257 (comment) 、OWNER、verdict: REQUEST_CHANGES / disposition: reframe_in_place)を human context lane で preflight に取り込んだ。
    2. codebase-investigator による独立コード調査で、anchor comment が指摘した6件の技術的問題(single authority 設計の矛盾、AC5/AC6 VC が production graph を証明していない、transport error sanitization の未閉鎖、pagination hardening 不足、403 taxonomy の過剰分類、environment_failure schema 未定義)が全て正確であることを確認した。
    3. iteration 1: review-issue(root_review_pipeline)が VERDICT: needs-fix(RVA001 x5 + decision_tag_consistency、計6 blocker)を検出。issue-editor に委譲し、Current Validated Scope を「単一 read authority」設計へ明確化、Allowed Paths へ test_skill_runtime_exec_anchor.py を追加、AC3/AC4/AC7 を強化、AC9(403 taxonomy)・AC10(environment_failure schema)を新設、「complete snapshot」表現を「complete paginated traversal」へ弱め、Runtime Verification Applicability 必須5フィールドを追加、<!-- runtime-verification: true --> タグを付与した。
    4. iteration 2: 再レビューで VERDICT: needs-fix(AC5/AC6 の VC が既存ファイルへの新規テスト関数参照という non-canonical shape、2 blocker)を検出。issue-editor に委譲し、VC 参照先を未作成の新規テストファイル scripts/agent-guards/tests/test_isolated_anchor_single_authority.py へ変更し、Allowed Paths / Notes for Reviewer を整合させた。
    5. final review: VERDICT: approve(blocker 0件)。deterministic checks 全 pass。

    各 rewrite 後の body_sha256 は独立に(gh api repos/.../issues/2257 の raw JSON から直接算出、jq trailing newline を除外して)再検証済み。

    観測された注記(重要)

    本ループの review/rewrite 完了後、Issue #2257 上に別プロセスによる implement-issue: 実装完了 コメント(comment ID 5341279867、2026-08-19T11:09:20Z)が確認された。PR https://github.com/squne121/loop-protocol/pull/2260(`worktree-issue-2257-credentialless-anchor-comment` ブランチ、作成 11:09:13Z)が既に作成されている。これは本 issue-refinement-loop が起動した処理ではなく、独立した並行プロセスによるものである。PR がどの body revision(iteration 1 または iteration 2 後の本文)を参照して実装されたかは未検証であり、PR レビュー(pr-review-judge)側で Issue 契約との整合を独立に確認する必要がある。

    LOOP_HANDOFF_RESULT_V1:
      status: blocked
      routing_action: blocked
      contract_review:
        status: blocked
        gate_result: missing_go
        latest_comment_url: ""
        generated_at: "2026-08-19T11:15:00Z"
        body_sha256: "sha256:1dcf92a1c3331d4baa4c1db06ce77d29e5262094792a12945eb541196c499442"
      metadata:
        title_prefix_ready: true
      label_sync_observation:
        kind: presentation_sync
        result: noop
        detail: "本ループでは label 操作を実行していない"
      auto_fixes:
        result: human_judgment_required
        required: []
        skipped: []
      blockers:
        - kind: contract_review_not_run
          description: "issue-refinement-loop は Issue 契約の refinement(review/rewrite)のみを担当し、issue-contract-review(実装着手直前の fresh go 判定)は本ループの範囲外のため実行していない。Issue 上に fresh go comment が存在しないため contract_review.gate_result は missing_go であり、routing_action は run_impl_review_loop ではなく blocked とする。なお本文更新完了後、別プロセスにより PR #2260 が既に作成されていることが観測された(詳細は上記「観測された注記」参照)。"
      permissions:
        unavailable: []
      generated_at: "2026-08-19T11:15:00Z"
      checked_body_sha256: "sha256:1dcf92a1c3331d4baa4c1db06ce77d29e5262094792a12945eb541196c499442"
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []

    参考: レビュー成果物

    • iteration 1 review: .claude/artifacts/issue-refinement-loop/2257/22e60f5f-415f-4eee-abc9-4e3422d7c737/attempt-001/compact_review_result_v2.json(VERDICT: needs-fix)
    • iteration 2 review: .claude/artifacts/issue-refinement-loop/2257/0a634f8f-fb34-4074-8d3a-f91a5a4330c5/attempt-001/compact_review_result_v2.json(VERDICT: needs-fix)
    • final review: .claude/artifacts/issue-refinement-loop/2257/adefdf44-af5f-4c0d-b9f2-6ba0ceb49d51/attempt-001/compact_review_result_v2.json(VERDICT: approve)
  5. squne121 commented on Aug 19, 2026

    @squne121
    OwnerAuthor

    結論

    PR #2256 は APPROVE 相当です。merge-blocking blocker は見つかりませんでした。
    reviewed head は 0a928b2f9e272387a92c97952a7f0da738c7bba2。PR は現在 Draft、mergeable=true で、差分は4ファイル・4行置換です。

    中心となる訂正――「local_main_branch_guard が現在も raw gh pr review や scope_rollup.run の逸脱を技術的に拒否している」から、「現在の Claude project hook wiring ではそうではなく、Agent/Skill の behavioral contract として維持する」への変更――は、current main、関連 Issue/PR、現行 Claude Code 仕様と整合しています。

    敵対的レビュー findings

    • P1 follow-up — PR外に同種の topology drift がまだ残っています。ただし 実装: pr-reviewer.md/scope-rollup-runner.md のhook根拠記述を#1691後の実態に合わせて修正する #2193 の明示的 Out of Scope なので本PRの blocker にはしません。 .claude/hooks/local_main_branch_guard.sh 自身が今も「.claude/settings.json の PreToolUse から呼ばれる」とコメントしていますが、実際の settings にはその wiring がありません。さらに .codex/rules/default.rules にも worktree_scope_guard が .codex/hooks.json に wired されているという古いコメントが残る一方、現行 .codex/hooks.json は SessionEnd / SubagentStop の advisory recording しか持ちません。
      推奨は 実装: pr-reviewer.md/scope-rollup-runner.md のhook根拠記述を#1691後の実態に合わせて修正する #2193 を膨らませず、別 follow-up で repository-wide wiring-claim sweep を行うことです。

    • P2 — executor 側の自己規律 という語は少し不正確です。 skill_runtime_command_policy.py には確かに scope_rollup.run、ScopeRollupRunCommand、exact parser が存在します。 一方、実際の run_scope_rollup_preflight.py は通常の argparse.ArgumentParser で required flags を受ける direct executor です。つまり「12トークン固定形状」という exactness は classifier の契約であり、現在の Claude runtime がその classifier を admission gate として強制しているわけではありません。
      より厳密には 「caller/orchestrator/Skill 側の behavioral producer-consumer contract」 と書くのが適切です。executor は pagination、repo binding、sanitization、artifact handling 等の内部 invariant を fail-closed にする側です。 この修正は品質向上になりますが、現記述も「technical enforcement ではない」と明記しているため blocker までは上げません。

    • P2 — 現在形の topology 情報を4 consumer に複製したため、将来また stale になる余地があります。 Claude Code は project .claude/settings.json だけでなく user settings、local settings、managed policy、plugin、Skill/Agent frontmatter からも hooks をロードします。したがって PR 本文の「project PreToolUse の未 wiring のみを証明し、effective runtime 全体の不在は主張しない」は正しい限定です。 ([Claude]1) ただし consumer 側は将来 settings が再変更されると再び陳腐化します。長期的には「hook wiring の有無にかかわらず、この workflow contract の authority は Skill/Agent」という不変条件を主文にし、現在の wiring は historical/baseline note に落とす方が堅牢です。

    中心訂正の検証結果

    .claude/settings.json の current project PreToolUse には local_main_branch_guard / worktree_scope_guard が存在せず、一方で permission surface には Bash(gh pr review *) が残っています。したがって「Agent が raw gh pr review を使わない」ことを local-main hook の技術的拒否として説明するのは明確に誤りでした。

    しかも現在 wiring されている rtk_boundary_shadow_guard は raw gh pr review を mutating operation として認識するものの、設計上 shadow logging only / always exit 0 で、拒否しません。PR の訂正を覆す代替 enforcement は確認できませんでした。

    外部仕様とも一致します。Claude Code の PreToolUse hook は tool 実行前に deterministic control を置けますが、その hook が実際に設定された source からロードされている必要があります。また project settings 以外の hook source も存在するため、#2193 が effective runtime 全体について断言しない設計は適切です。 ([Claude]1)

    gh pr review 自体についても GitHub CLI の正式仕様では --approve / --request-changes / --comment を伴う PR review mutation です。 ([GitHub CLI]2) 一方、branch protection / ruleset は「何件の approval が必要か」「merge を許すか」を制御する仕組みであって、gh pr review 呼び出しそのものを reviewer-side command policy として禁止する機構ではありません。したがって #2193 が branch protection を代替 enforcement として持ち出さなかった判断も正しいです。 ([GitHub Docs]3)

    #1601 との semantic collision も処理されています。OWNER decision は #2193 before #1601、integrate_sibling_profile は候補として保持するが、Claude project hook を authorization/security authority とする旧前提は supersede、#1601 の実装は fresh review 前には不可、としています。PR #2256 はこの境界を越えていません。

    CI も reviewed head 0a928b2f… に束縛された ci run が completed/success です。 なお causal-claim drift gate は既存 baseline 54件を許容して new_finding_count: 0 としているため、「CI green = repository 内の stale claim がゼロ」という意味ではありません。今回私が見つけた hook wrapper 等の既存 drift とも矛盾しません。

    推奨 disposition

    verdict: APPROVE
    reviewed_head_sha: 0a928b2f9e272387a92c97952a7f0da738c7bba2
    blockers: []
    warnings:
      - "Out-of-scope の hook/Codex 資産に stale wiring claim が残存。別 Issue で repository-wide sweep を推奨"
      - "`executor 側の自己規律` は caller/orchestrator/Skill behavioral contract と表現するとより厳密"
      - "current wiring の現在形コピーは将来 drift し得るため、不変の authority statement を主文にすることを推奨"

    このPR自体は止める必要はありません。 高品質化するなら、#2256 を再拡張するより、残存 topology drift を別 Issue に切り出すのがスコープ・OWNER decision・#1860 minimal-harness 方針のいずれにも整合します。

    head が更新された場合だけ、このレビューを current-head に対して再実行する運用もできます。

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/implementationtriage-required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions