Repository navigation
Description
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: codeParent 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_FOUNDsemantic 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 hardeningrun_refinement_preflight.pyの single authority 化、snapshot-first anchor resolution、error propagation、early failure artifact- 対応する result schema と focused tests
- 変更境界を反映する最小 docs 更新
Out of Scope
- 実装: control-plane preflight の remote default-ref OID observe/fetch/pin/verify プロトコルを実装する #2197 の Git protocol 実装
- authenticated broker/rate-limit workaround
- launcher/credential forwarding 変更
- Spark delegation follow-up
- 実装: fix: bind issue-refinement control-plane preflight to a dedicated linked worktree #2190 の DAG reframe
- command registry semantic redesign
- merge 実行
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 の
ghmarker の invocation 回数が 0 であること(single-commentgh apiendpoint の直接呼び出しが 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_inputartifact が存在しない場合、それらの 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.pyAllowed Paths
scripts/agent-guards/github_credentialless_read.pyscripts/agent-guards/tests/test_credentialless_github_read.pyscripts/agent-guards/tests/test_skill_runtime_exec_anchor.pyscripts/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.pydocs/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
squne121 commentedon Aug 19, 2026
判定
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 自体にコメントはなく、契約上の矛盾を実装者側の裁量で埋める状態です。
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 に差し替えることです。ghmarker=0、child exit、anchor ID5315264311、result artifact schema、stdout/result 整合まで assert すべきです。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/ freshread_issue_commentの全 read に渡す契約へ固定してください。initial anchor は既取得 comments から解決し、mutation 前など fresh read が本当に必要な箇所だけ同じ adapter の single-comment GET を使う形が整合的です。P0-3 — transport error の sanitization が producer 境界まで閉じていません。 現実装の credentialless reader は
HTTPErrorしか分類せず、URLError、DNS/connection failure、timeout、JSON decode failureなどはそのまま外へ出得ます。さらに preflight 側には broadexcept 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 に出さないべきです。P1-1 — pagination hardening の trust boundary がまだ不足しています。 現実装の
_validate_pagination_target()はhttpsとapi.github.comしか検査しておらず、同じ host 上の別 repository / 別 issue / 別 endpoint を指すLink: rel="next"を通せます。 GitHub は pagination の次ページ URL をLinkheader として返し、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)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 判定の必須入力にする必要はありません。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 が解消されたか再チェックする監視もできます。
squne121 commentedon Aug 19, 2026
implement-issue: 実装完了 (2026-08-19T11:09:20Z)
.claude/worktrees/issue-2257-credentialless-anchor-commentworktree-issue-2257-credentialless-anchor-commentsqune121 commentedon Aug 19, 2026
issue-refinement-loop 終了報告
status: approved(Issue 契約の refinement 完了、
VERDICT: approve/ blocker 0件)termination_cause: approved
iterations: 2 回の rewrite(review 3回: needs-fix → needs-fix → approve)
経緯
verdict: REQUEST_CHANGES/disposition: reframe_in_place)を human context lane で preflight に取り込んだ。environment_failureschema 未定義)が全て正確であることを確認した。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 -->タグを付与した。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 を整合させた。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 契約との整合を独立に確認する必要がある。参考: レビュー成果物
.claude/artifacts/issue-refinement-loop/2257/22e60f5f-415f-4eee-abc9-4e3422d7c737/attempt-001/compact_review_result_v2.json(VERDICT: needs-fix).claude/artifacts/issue-refinement-loop/2257/0a634f8f-fb34-4074-8d3a-f91a5a4330c5/attempt-001/compact_review_result_v2.json(VERDICT: needs-fix).claude/artifacts/issue-refinement-loop/2257/adefdf44-af5f-4c0d-b9f2-6ba0ceb49d51/attempt-001/compact_review_result_v2.json(VERDICT: approve)fix: E501修正・PR本文の日本語比率修正・AC5/AC6の実subprocess検証テストを追加する (#2257)
fix: preflight.run.with_human_context の実 subprocess で AC5/AC6 を検証するテス…
fix: ruff E501対応のためモジュール定数を複数行に分割する (#2257)
squne121 commentedon Aug 19, 2026
結論
PR #2256 は
APPROVE相当です。merge-blocking blocker は見つかりませんでした。reviewed head は
0a928b2f9e272387a92c97952a7f0da738c7bba2。PR は現在 Draft、mergeable=true で、差分は4ファイル・4行置換です。中心となる訂正――「
local_main_branch_guardが現在も rawgh 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 projectPreToolUseにはlocal_main_branch_guard/worktree_scope_guardが存在せず、一方で permission surface にはBash(gh pr review *)が残っています。したがって「Agent が rawgh pr reviewを使わない」ことを local-main hook の技術的拒否として説明するのは明確に誤りでした。しかも現在 wiring されている
rtk_boundary_shadow_guardは rawgh pr reviewを mutating operation として認識するものの、設計上 shadow logging only / always exit 0 で、拒否しません。PR の訂正を覆す代替 enforcement は確認できませんでした。外部仕様とも一致します。Claude Code の
PreToolUsehook は 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…に束縛されたcirun が completed/success です。 なお causal-claim drift gate は既存 baseline 54件を許容してnew_finding_count: 0としているため、「CI green = repository 内の stale claim がゼロ」という意味ではありません。今回私が見つけた hook wrapper 等の既存 drift とも矛盾しません。推奨 disposition
このPR自体は止める必要はありません。 高品質化するなら、#2256 を再拡張するより、残存 topology drift を別 Issue に切り出すのがスコープ・OWNER decision・#1860 minimal-harness 方針のいずれにも整合します。
head が更新された場合だけ、このレビューを current-head に対して再実行する運用もできます。
fix: preflight anchor comment 解決を単一 read-authority 契約へ再設計する (#2257)
fix: issue-refinement preflight の anchor comment 取得を credentialless t…
fix: test_isolated_anchor_single_authority のtransient判定を構造化reason_cod…