Skip to content

実装: summarize_agent_transcript.py の GitHub token redaction パターンを新形式 ghs_ App installation token に対応させる #2725

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "PR #2722(Issue #2718 close)の人間レビューコメントで指摘された repository-wide gap の一部として、scripts/summarize_agent_transcript.py の GitHub token redaction パターンを新形式 ghs_ App installation token に対応させる"
change_kind: code

Parent Issue

なし(単独改善)

Parent Goal Ref

Current Validated Scope

  • scripts/summarize_agent_transcript.py の REDACT_PATTERNS(34行目付近)は GitHub token を re.compile(r"gh[opsur]_[A-Za-z0-9_]{20,}") で検出し <GITHUB_TOKEN> に置換する。文字集合は英数字と _ のみで、.(JWT のセグメント区切り文字)を含まない。
  • 新形式 GitHub App installation token ghs_<APP_ID>_<JWT> は JWT 部分に . を含むため、現行パターンは . の直前までしかマッチせず、トークン後半(JWT の2番目・3番目のセグメント)が redaction されずに平文で残る可能性がある(部分マッチ・断片残存)。
  • 本ファイルの既存テスト tests/test_summarize_agent_transcript.py に ghs_ token を対象にした regression テストは存在しない(rg -n "ghs_" tests/test_summarize_agent_transcript.py は 0 件)。
  • scripts/agent-guards/controlled_skill_mutation_exec.py(PR fix: 新形式GitHub App installation token(ghs_APPID_JWT)を完全redactする #2722 で追加、801-807行目付近)には参照実装として、ghs_[A-Za-z0-9._-]{36,} という専用 matcher が既存 generic matcher(gh[oprsu]_[A-Za-z0-9]{20,})より前の位置に配置されている実例が存在する。

Remaining Parent Gaps

Outcome

scripts/summarize_agent_transcript.py の REDACT_PATTERNS が新形式 ghs_<APP_ID>_<JWT> トークンを APPID・JWT の header/payload/signature いずれの断片も残さず単一の <GITHUB_TOKEN> へ完全に置換できる状態になっており、既存の classic gh[opsur]_... 形式トークンの redaction 挙動が回帰していないことを直接検証する pytest が tests/test_summarize_agent_transcript.py に追加されて PASS している。

Runtime Verification Applicability

In Scope

  • REDACT_PATTERNS に (re.compile(r"ghs_[A-Za-z0-9._-]{36,}"), "<GITHUB_TOKEN>") という ghs_ 専用 matcher を、既存 generic GitHub matcher re.compile(r"gh[opsur]_[A-Za-z0-9_]{20,}") より前の位置に追加する(既存 generic matcher の正規表現文字列自体は変更しない。JWTのheader/payload/signatureの意味論はparseせず、opaque tokenとして扱う)
  • 新形式トークン全体(ghs_<APP_ID>_<JWT-header>.<payload>.<signature>)が単一の <GITHUB_TOKEN> に完全置換され、JWT後半のいずれのセグメントも残存しないことを直接検証するpytestの追加
  • classic gh[opsur]_[A-Za-z0-9_]{20,} 形式トークン(ghp_/gho_/ghs_/ghu_/ghr_ の5 prefix)それぞれについて、redaction挙動が変更されていないことを個別に直接検証する parameterized pytest の追加

Out of Scope

Acceptance Criteria

  • AC1: REDACT_PATTERNS に ghs_[A-Za-z0-9._-]{36,} という専用matcherが、既存generic matcher gh[opsur]_[A-Za-z0-9_]{20,} より前の位置に追加されており、既存generic matcherの正規表現文字列自体(charset)は変更されていない
  • AC2: before ghs_<APP_ID>_<JWT-header>.<payload>.<signature> after という文字列(新形式トークンはAPPIDセグメントと、ドットで区切られたJWT header/payload/signatureの3セグメントを含む)を redaction 関数に渡すと、結果が exactly before <GITHUB_TOKEN> after になる(トークンの断片が一切残らない)
  • AC3: classic ghp_/gho_/ghs_/ghu_/ghr_ の5 prefixそれぞれについて、redaction挙動を個別に直接検証する parameterized pytest が tests/test_summarize_agent_transcript.py に追加されている
  • AC4: tests/test_summarize_agent_transcript.py 全体がPASSする(既存テストの回帰なし)

Verification Commands

# AC1
# baseline-expect: fail
$ rg -n 'ghs_\[A-Za-z0-9\._-\]\{36,\}' scripts/summarize_agent_transcript.py

# AC2
# baseline-expect: fail
$ uv run pytest tests/test_summarize_agent_transcript.py::test_redact_patterns_fully_redacts_new_installation_token -q

# AC3
# baseline-expect: fail
$ uv run pytest tests/test_summarize_agent_transcript.py::test_redact_patterns_preserves_classic_github_token_redaction -q

# AC4
# baseline-expect: pass
$ uv run pytest tests/test_summarize_agent_transcript.py -q

Allowed Paths

  • scripts/summarize_agent_transcript.py
  • tests/test_summarize_agent_transcript.py

Stop Conditions

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

Required Skills

なし

Required Design References

Scope Delta(任意)

N/A

Notes for Reviewer

  • 優先度: optional_follow_up(低優先度)。実在の credential 漏洩インシデントは確認されておらず、プロアクティブな gap 解消目的の改善である。緊急対応は不要。
  • Scope Overlap Preflight(check_issue_overlap.py)の結果: decision=overlap_requires_comment(policy_class C1, reason_code allowed_paths_overlap)。tests/ を Allowed Paths に含む他の Implementation Issue と広い一致があるが、いずれも tests/test_summarize_agent_transcript.py という具体ファイルには言及しておらず、編集意図も異なるため non-conflict と判断し、そのまま起票する。
  • 本 Issue は PR fix: 新形式GitHub App installation token(ghs_APPID_JWT)を完全redactする #2722 の人間レビューコメント(issuecomment-5770273156)で明示的に follow-up 推奨された4ファイルのうち1件。他の3ファイルは別 Issue として個別起票する。
  • 本 Issue の refinement は OWNER のレビューコメント(https://github.com/squne121/loop-protocol/issues/2725#issuecomment-5805213617)に基づく human-context directiveを反映したものである。AC1の設計を「genericの charset拡張」から「専用ghs_ matcher追加(genericは不変)」に修正し、AC3にclassic 5 prefixの直接regression testを追加し、base64url/JWS delimiterの記述誤りを修正し、Verification Commandsを実効化した。

Source

Activity

  1. added
    phase/implementation
    agent/implementer
    enhancement
    triage-required
    follow-up
    area/security
    on Sep 22, 2026
  2. squne121 commented on Sep 24, 2026

    @squne121
    OwnerAuthor

    判定

    REQUEST_CHANGES 相当 / needs-fix です。

    Issue #2725 のバグ認識そのものは正しいです。current main の summarize_agent_transcript.py は

    re.compile(r"gh[opsur]_[A-Za-z0-9_]{20,}")

    なので、ghs_<APP_ID>_<JWT-header>.<payload>.<signature> に対して最初の . までを <GITHUB_TOKEN> に置換し、後半を残し得ます。current summarize_agent_transcript.py

    GitHub は現在、新旧 installation token を扱う推奨 matcher として ghs_[A-Za-z0-9\.\-_]{36,} を明示しています。新形式は約520文字で2つの . を含み、JWTの内容には依存せず opaque string として扱うよう案内しています。(The GitHub Blog)

    ただし、実装契約が少し緩いため、ACを満たしつつ質の悪い実装が可能です。ここを直してから実装に渡すのがよいです。

    優先度 | Finding | 推奨 -- | -- | -- P1 | 「GitHub token 用エントリの charset 拡張」だと、既存共通 regex を gh[opsur]_[A-Za-z0-9._-]{20,} に変更する実装でも AC1〜AC3 を満たせる | ghs_ 専用 matcher を追加し、既存 generic matcher は変更しない契約に固定 P1 | AC3 が Outcome/In Scope と不整合。現行テストには ghp_ の直接テストしかなく、5 prefix の backward compatibility を直接証明しない | ghp_/gho_/ghs_/ghu_/ghr_ を parameterized regression test で固定 P2 | [A-Za-z0-9._-] を「base64url charset」と呼んでいるのは技術的に誤り | 「base64url segments (A-Z a-z 0-9 - _) + JWS . delimiter」と修正 P2 | AC1 VC の rg -n "REDACT_PATTERNS" は baseline ですでに PASS する | AC1 を behavioral test に統合するか、専用 ghs_ pattern を検索 P2 / follow-up | PR #2722 で列挙された4箇所以外にも新形式非対応の scanner/redactor が current main に残る | #2725 は膨らませず、別途 repository-wide inventory を1回行う P3 | この script では redact_string() は主に保存される file path/input path に適用され、raw transcript 本文自体は artifact に保存しない | 「実漏洩修正」より redactor correctness hardening として位置づける。runtime/live test は不要

    P1 — 実装形を明示的に固定した方がよい

    PR #2722 で既にマージされた参照実装は、専用 matcher を generic matcher より前に置いています。

    _re.compile(r"ghs_[A-Za-z0-9._-]{36,}"),
    _re.compile(r"gh[oprsu]_[A-Za-z0-9]{20,}"),

    controlled_skill_mutation_exec.py

    #2725 でも同じ設計に寄せるべきです。具体的には、

    (re.compile(r"ghs_[A-Za-z0-9._-]{36,}"), "<GITHUB_TOKEN>"),
    (re.compile(r"gh[opsur]_[A-Za-z0-9_]{20,}"), "<GITHUB_TOKEN>"),

    とし、2行目は既存動作維持のため触らないのがよいです。

    これなら新形式だけを必要な範囲で広げつつ、既存 ghp_ / gho_ / ghu_ / ghr_ に . や - を新たに許容する副作用を避けられます。GitHub公式の現在の推奨 regex とも一致します。(The GitHub Blog)

    P1 — backward compatibility の AC を強化

    現行 tests/test_summarize_agent_transcript.py で GitHub token を直接検査しているのは ghp_ です。test_summarize_agent_transcript.py

    一方、#2725 の Outcome は「classic gh[opsur] の挙動を直接検証する pytest」を要求しています。したがって AC3 は単なる「既存 suite PASS」では不足です。

    例えば1つの parameterized test で十分です。

    @pytest.mark.parametrize("prefix", ["ghp", "gho", "ghs", "ghu", "ghr"])
    def test_redact_patterns_preserves_classic_github_token_redaction(prefix):
        token = f"{prefix}_" + "A" * 36
        assert sat.redact_string(f"before {token} after") == (
            "before <GITHUB_TOKEN> after"
        )

    新 harness は不要です。

    P2 — 「base64url charset」の説明は直す

    JWS Compact Serialization は

    BASE64URL(header) . BASE64URL(payload) . BASE64URL(signature)

    です。. は base64url の文字ではなく、3セグメントを区切る delimiter です。

    したがって Issue 内の

    base64url charset [A-Za-z0-9._-]

    は、

    GitHub 推奨 token matcher charset [A-Za-z0-9._-]。JWT 各 segment は base64url [A-Za-z0-9_-]、. は JWS compact serialization の delimiter

    程度に変更した方が、将来のレビューで誤った仕様理解を増殖させません。

    P2 — repository-wide gap は4ファイルで終わっていない

    今回の検索では、PR #2722 のレビューで materialize された #2725〜#2728 以外にも少なくとも以下が残っています。

    .claude/scripts/secret_exposure_scanner.py は現在、

    re.compile(r"gh[pousr]_[A-Za-z0-9]{36,255}")

    です。新形式では APP_ID 後の _ で止まり、しかも max 255 に対して新形式は約520文字なので、新形式 ghs_ の scanner として明確に古いです。secret_exposure_scanner.py

    さらに run_agy_github_research_broker.py や check_session_recording_runtime_safety.py にも旧 ghs_ redaction pattern が存在します。一方、manifest validation のように「一部分でもマッチすれば deny する detector」は partial match でも目的を達成する場合があるので、機械的な全置換ではなく、redactor と detector を分類して一度 inventory するのが適切です。

    これは #2725 の Allowed Paths に押し込むべきではありません。別の小さな follow-up で十分です。現時点でこれら3ファイルを ghs_ 新形式対応する open Issue は検索上見つかりませんでした。

    加えて、summarize_agent_transcript.py 自体は GitHub の fine-grained PAT github_pat_ を現在認識しません。GitHub公式では github_pat_ も現行 token prefix として明記されています。(GitHub Docs) これも #2725 の scope を拡張せず、必要なら別 follow-up で扱う方がきれいです。

    実装前に直すべき Issue 契約

    #2725 は大きく作り直す必要はありません。以下の4点だけ修正すれば実装可能な状態です。

    1. In Scope / AC1 を「generic GitHub matcher の charset 拡張」ではなく、ghs_[A-Za-z0-9._-]{36,} 専用 matcher を既存 generic matcher より前に追加し、generic matcher は不変と固定する。

    2. AC3 に ghp_/gho_/ghs_/ghu_/ghr_ の直接 parameterized regression test を要求する。

    3. AC1 の rg -n "REDACT_PATTERNS" を削除するか、behavioral pytest を正本にする。

    4. 「base64url charset [A-Za-z0-9._-]」という説明を修正する。

    Runtime Verification Applicability: not_applicable、Allowed Paths 2ファイル、live credential canary なし、新規 scanner subsystem なし、という部分はそのままでよいです。個人開発としては、ここに追加のセキュリティハーネスや実 GitHub token を使う E2E を足す費用対効果は低いです。

    Issue #2725
    起点となった PR #2722 のレビューコメント

    ## 判定

    REQUEST_CHANGES 相当 / needs-fix です。

    Issue #2725 のバグ認識そのものは正しいです。current main の summarize_agent_transcript.py は

    re.compile(r"gh[opsur]_[A-Za-z0-9_]{20,}")

    なので、ghs_<APP_ID>_<JWT-header>.<payload>.<signature> に対して最初の . までを <GITHUB_TOKEN> に置換し、後半を残し得ます。[current summarize_agent_transcript.py](https://github.com/squne121/loop-protocol/blob/main/scripts/summarize_agent_transcript.py?utm_source=chatgpt.com)

    GitHub は現在、新旧 installation token を扱う推奨 matcher として ghs_[A-Za-z0-9\.\-_]{36,} を明示しています。新形式は約520文字で2つの . を含み、JWTの内容には依存せず opaque string として扱うよう案内しています。([The GitHub Blog]1)

    ただし、実装契約が少し緩いため、ACを満たしつつ質の悪い実装が可能です。ここを直してから実装に渡すのがよいです。

    優先度 Finding 推奨
    P1 「GitHub token 用エントリの charset 拡張」だと、既存共通 regex を gh[opsur]_[A-Za-z0-9._-]{20,} に変更する実装でも AC1〜AC3 を満たせる ghs_ 専用 matcher を追加し、既存 generic matcher は変更しない契約に固定
    P1 AC3 が Outcome/In Scope と不整合。現行テストには ghp_ の直接テストしかなく、5 prefix の backward compatibility を直接証明しない ghp_/gho_/ghs_/ghu_/ghr_ を parameterized regression test で固定
    P2 [A-Za-z0-9._-] を「base64url charset」と呼んでいるのは技術的に誤り 「base64url segments (A-Z a-z 0-9 - _) + JWS . delimiter」と修正
    P2 AC1 VC の rg -n "REDACT_PATTERNS" は baseline ですでに PASS する AC1 を behavioral test に統合するか、専用 ghs_ pattern を検索
    P2 / follow-up PR #2722 で列挙された4箇所以外にも新形式非対応の scanner/redactor が current main に残る #2725 は膨らませず、別途 repository-wide inventory を1回行う
    P3 この script では redact_string() は主に保存される file path/input path に適用され、raw transcript 本文自体は artifact に保存しない 「実漏洩修正」より redactor correctness hardening として位置づける。runtime/live test は不要

    P1 — 実装形を明示的に固定した方がよい

    PR #2722 で既にマージされた参照実装は、専用 matcher を generic matcher より前に置いています。

    _re.compile(r"ghs_[A-Za-z0-9._-]{36,}"),
    _re.compile(r"gh[oprsu]_[A-Za-z0-9]{20,}"),

    [controlled_skill_mutation_exec.py](https://github.com/squne121/loop-protocol/blob/main/scripts/agent-guards/controlled_skill_mutation_exec.py?utm_source=chatgpt.com)

    #2725 でも同じ設計に寄せるべきです。具体的には、

    (re.compile(r"ghs_[A-Za-z0-9._-]{36,}"), "<GITHUB_TOKEN>"),
    (re.compile(r"gh[opsur]_[A-Za-z0-9_]{20,}"), "<GITHUB_TOKEN>"),

    とし、2行目は既存動作維持のため触らないのがよいです。

    これなら新形式だけを必要な範囲で広げつつ、既存 ghp_ / gho_ / ghu_ / ghr_ に . や - を新たに許容する副作用を避けられます。GitHub公式の現在の推奨 regex とも一致します。([The GitHub Blog]1)

    P1 — backward compatibility の AC を強化

    現行 tests/test_summarize_agent_transcript.py で GitHub token を直接検査しているのは ghp_ です。[test_summarize_agent_transcript.py](https://github.com/squne121/loop-protocol/blob/main/tests/test_summarize_agent_transcript.py?utm_source=chatgpt.com)

    一方、#2725 の Outcome は「classic gh[opsur] の挙動を直接検証する pytest」を要求しています。したがって AC3 は単なる「既存 suite PASS」では不足です。

    例えば1つの parameterized test で十分です。

    @pytest.mark.parametrize("prefix", ["ghp", "gho", "ghs", "ghu", "ghr"])
    def test_redact_patterns_preserves_classic_github_token_redaction(prefix):
        token = f"{prefix}_" + "A" * 36
        assert sat.redact_string(f"before {token} after") == (
            "before <GITHUB_TOKEN> after"
        )

    新 harness は不要です。

    P2 — 「base64url charset」の説明は直す

    JWS Compact Serialization は

    BASE64URL(header) . BASE64URL(payload) . BASE64URL(signature)

    です。. は base64url の文字ではなく、3セグメントを区切る delimiter です。

    したがって Issue 内の

    base64url charset [A-Za-z0-9._-]

    は、

    GitHub 推奨 token matcher charset [A-Za-z0-9._-]。JWT 各 segment は base64url [A-Za-z0-9_-]、. は JWS compact serialization の delimiter

    程度に変更した方が、将来のレビューで誤った仕様理解を増殖させません。

    P2 — repository-wide gap は4ファイルで終わっていない

    今回の検索では、PR #2722 のレビューで materialize された #2725〜#2728 以外にも少なくとも以下が残っています。

    .claude/scripts/[secret_exposure_scanner.py](https://github.com/squne121/loop-protocol/blob/main/.claude/scripts/secret_exposure_scanner.py?utm_source=chatgpt.com) は現在、

    re.compile(r"gh[pousr]_[A-Za-z0-9]{36,255}")

    です。新形式では APP_ID 後の _ で止まり、しかも max 255 に対して新形式は約520文字なので、新形式 ghs_ の scanner として明確に古いです。secret_exposure_scanner.py

    さらに run_agy_github_research_broker.py や check_session_recording_runtime_safety.py にも旧 ghs_ redaction pattern が存在します。一方、manifest validation のように「一部分でもマッチすれば deny する detector」は partial match でも目的を達成する場合があるので、機械的な全置換ではなく、redactor と detector を分類して一度 inventory するのが適切です。

    これは #2725 の Allowed Paths に押し込むべきではありません。別の小さな follow-up で十分です。現時点でこれら3ファイルを ghs_ 新形式対応する open Issue は検索上見つかりませんでした。

    加えて、summarize_agent_transcript.py 自体は GitHub の fine-grained PAT github_pat_ を現在認識しません。GitHub公式では github_pat_ も現行 token prefix として明記されています。([GitHub Docs]2) これも #2725 の scope を拡張せず、必要なら別 follow-up で扱う方がきれいです。

    実装前に直すべき Issue 契約

    #2725 は大きく作り直す必要はありません。以下の4点だけ修正すれば実装可能な状態です。

    1. In Scope / AC1 を「generic GitHub matcher の charset 拡張」ではなく、ghs_[A-Za-z0-9._-]{36,} 専用 matcher を既存 generic matcher より前に追加し、generic matcher は不変と固定する。
    2. AC3 に ghp_/gho_/ghs_/ghu_/ghr_ の直接 parameterized regression test を要求する。
    3. AC1 の rg -n "REDACT_PATTERNS" を削除するか、behavioral pytest を正本にする。
    4. 「base64url charset [A-Za-z0-9._-]」という説明を修正する。

    Runtime Verification Applicability: not_applicable、Allowed Paths 2ファイル、live credential canary なし、新規 scanner subsystem なし、という部分はそのままでよいです。個人開発としては、ここに追加のセキュリティハーネスや実 GitHub token を使う E2E を足す費用対効果は低いです。

    [Issue #2725](https://github.com/squne121/loop-protocol/issues/2725?utm_source=chatgpt.com)
    [起点となった PR #2722 のレビューコメント](#2722)

  3. squne121 commented on Sep 24, 2026

    @squne121
    OwnerAuthor

    推奨アクションは、OWNER の対象コメントを anchor_comment_url とした with_human_context lane で #2725 の refinement を再実行することです。確認した現行 #2725 とコメント内容から、実装前に直すべきなのは主に契約精度で、スコープ自体を広げる必要はありません。

    • 実装: summarize_agent_transcript.py の GitHub token redaction パターンを新形式 ghs_ App installation token に対応させる #2725 内では、ghs_[A-Za-z0-9._-]{36,} 専用 matcher を既存 generic matcherより前に追加し、既存 gh[opsur]_[A-Za-z0-9_]{20,} は変更しない契約へ固定する。
    • AC3 は ghp / gho / ghs / ghu / ghr の5 prefixを parameterized test で直接固定し、「既存 suite が通るだけ」で済ませない。
    • [A-Za-z0-9._-] を base64url charset と呼ばず、. は JWS delimiter であることを正す。VC も baseline で通る rg REDACT_PATTERNS ではなく、新 matcherまたは behavioral pytestを正本にする。
    • Runtime Verification: not_applicable、Allowed Paths 2ファイル、live credential testなしは維持する。repository-wide の残存 scanner/redactor や github_pat_ は 実装: summarize_agent_transcript.py の GitHub token redaction パターンを新形式 ghs_ App installation token に対応させる #2725 に吸収せず、canonical follow-up materialization / dedupe に任せる。
    • 対象コメントは GitHub 上で author_association: OWNER まで確認できています。したがって unlabeled anchor ではなく、明示的に preflight.run.with_human_context を使うのが現行 skill 契約に沿います。
    • SubAgent は必要な read-only investigation に使い、structured hand-back を完了扱いせず、terminal completion / canonical join を確認してから次へ進むよう明記するのがよいです。過去の harness failure 系の再発防止にもなります。

    そのまま、既に auto mode で起動している Claude Code に渡せる形です。

    squne121/loop-protocol の Issue #2725 を、現行リポジトリのエージェントスキル

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

    に厳密に従って refinement してください。

    対象 Issue:
    #2725

    今回の operator-selected human context / anchor comment:
    #2725 (comment)

    このコメントは Issue #2725 の OWNER による明示的なレビュー指示です。URL だけから human origin を推測するのではなく、canonical な preflight.run.with_human_context lane として扱い、repo / issue / comment binding を検証してください。

    実行方針

    • 既に Claude Code は auto mode で起動済みです。現在の permission mode は変更しないでください。
    • issue-refinement-loop の loop iteration approval gate は不要です。各 iteration ごとの人間承認を求めず、現行 skill の bounded loop policy に従って自律継続してください。
    • max_iterations=3 としてください。
    • SKILL.md を thin entrypoint として扱い、planner / reviewer / worker / reference documents の SSOT を prose で再実装しないでください。
    • Issue 本文を手作業で場当たり的に編集するのではなく、preflight.run.with_human_context → trusted contract update / issue-editor → fresh review → final contract gate という現行 canonical route に従ってください。
    • run_refinement_preflight.py を governance を迂回して直接実行しないでください。skill_runtime_exec.py と command registry の canonical command を使用してください。
    • needs-fix が返った場合、iteration 上限までは人間確認なしで自動修正・再レビューしてください。
    • deterministic repair / structural repair / trusted human-context contract update / issue-editor route が利用可能な場合、人間へ同じ内容を書き直させるための escalation を行わず、canonical route を消費してください。
    • 本当に semantic judgment が必要な場合、または skill が定義する hard stop / environment failure に到達した場合だけ fail-closed してください。

    SubAgent の使用

    調査が必要な箇所では、現行 skill / planner が指定する codebase-investigator 等の SubAgent を使用してください。

    重要:

    1. SubAgent を dispatch したら、その SubAgent の作業完了を必ず待ってください。
    2. structured hand-back、途中 stdout、部分結果の受領だけを「完了」とみなして次の phase に進まないでください。
    3. canonical completion / join または同等の terminal state を確認してから、その結果を consume してください。
    4. SubAgent がまだ running の間は root orchestration を先へ進めないでください。
    5. bounded status check 後も terminal completion を確認できない場合、成功扱い・推測による continuation をせず、skill の harness/environment failure routing に従ってください。
    6. SubAgent 自身に nested SubAgent delegation を勝手に行わせないでください。現行 skill が明示的に許可・要求する場合だけ従ってください。

    SubAgent の read-only investigation では、少なくとも current main の以下を fresh に確認してください。

    調査結果は Issue 契約を正しく更新するための evidence として使い、SubAgent に Issue mutation や final judgment を委譲しすぎないでください。

    今回の human-context directive で優先して反映する内容

    対象 OWNER コメントを authoritative review input として扱いつつ、current main の fresh evidence と照合してください。

    1. ghs_ 専用 matcher に実装契約を固定する

    現在の曖昧な

    「GitHub token 用エントリの charset を拡張する」

    という契約ではなく、次の設計を明示してください。

    (re.compile(r"ghs_[A-Za-z0-9._-]{36,}"), "<GITHUB_TOKEN>"),
    (re.compile(r"gh[opsur]_[A-Za-z0-9_]{20,}"), "<GITHUB_TOKEN>"),

    契約上の重要条件:

    • 新しい ghs_ 専用 matcher を既存 generic GitHub matcher より前に配置する。
    • 既存 generic matcher
      gh[opsur]_[A-Za-z0-9_]{20,}
      は backward compatibility のため変更しない。
    • generic matcher 全体を [A-Za-z0-9._-] へ広げる実装を許容しない。
    • JWT の header / payload / signature の意味論を parse しない。GitHub installation token は opaque token として扱う。

    In Scope / Outcome / AC1 / reviewer notes 等がこの設計と矛盾しないよう整合させてください。

    2. backward compatibility を直接検証する

    AC3 を「既存テスト全件 PASS」だけで済ませないでください。

    ghp_, gho_, ghs_, ghu_, ghr_

    の classic token 形式を parameterized pytest で直接検証することを acceptance contract に含めてください。

    概念的には以下相当です。

    @pytest.mark.parametrize("prefix", ["ghp", "gho", "ghs", "ghu", "ghr"])
    def test_redact_patterns_preserves_classic_github_token_redaction(prefix):
        token = f"{prefix}_" + "A" * 36
        assert sat.redact_string(f"before {token} after") == (
            "before <GITHUB_TOKEN> after"
        )

    テスト名や fixture の細部は current test structure に合わせてよいですが、5 prefix の直接検証という semantic requirement は落とさないでください。

    3. token charset の説明を技術的に修正する

    Issue 本文にある

    base64url charset [A-Za-z0-9._-]

    という表現は修正してください。

    意味としては以下を維持してください。

    • JWT/JWS の各 segment の base64url alphabet は [A-Za-z0-9_-]
    • . は base64url の文字ではなく JWS Compact Serialization の segment delimiter
    • GitHub が installation token 用 matcher として使う token-level charset が [A-Za-z0-9._-]

    将来の実装者が . を base64url alphabet の一部だと誤解する記述を残さないでください。

    4. Verification Commands を実効的にする

    現在の

    rg -n "REDACT_PATTERNS" scripts/summarize_agent_transcript.py

    だけでは baseline でも PASS するため、AC1 の成立証明として扱わないでください。

    behavioral pytest を canonical verification にするか、専用 ghs_[A-Za-z0-9._-]{36,} matcher の存在・順序を意味のある形で検証してください。

    少なくとも以下を検証可能にしてください。

    • 新形式 ghs_<APP_ID>_<JWT-header>.<payload>.<signature> 全体が exactly 1つの <GITHUB_TOKEN> へ置換される。
    • JWT の後半断片が残存しない。
    • classic 5 prefix の regression test が PASS する。
    • tests/test_summarize_agent_transcript.py 全体が PASS する。

    baseline-expect の意味も current main の状態と一致させてください。

    5. #2725 の scope は膨らませない

    以下は維持してください。

    この Issue は実 credential 漏洩 incident remediation ではなく、主として redactor correctness hardening として記述を整えてください。

    6. repository-wide gap は別 follow-up として扱う

    OWNER コメントには、PR #2722 由来の #2725〜#2728 以外にも current main に旧形式 matcher が残るという指摘があります。

    例としてコメントでは以下が挙げられています。

    • .claude/scripts/secret_exposure_scanner.py
    • run_agy_github_research_broker.py
    • check_session_recording_runtime_safety.py
    • github_pat_ を summarize_agent_transcript.py が扱っていない点

    これらを #2725 に吸収しないでください。

    fresh repository search と OPEN Issue dedupe を行い、redactor と detector を区別してください。partial match でも deny detector として目的を満たす箇所を、機械的に「全部修正必要」と分類しないでください。

    follow-up が必要と canonical materialization policy が判定した場合は issue-refinement-loop の follow-up materialization SSOT に従って処理してください。既存 Issue があれば reuse / dedupe し、新規作成不要なら note-only としてください。

    手作業で無条件に follow-up Issue を量産しないでください。

    Web research

    anchor comment が引用する GitHub の current installation-token matcher / token format が refinement の disposition に必要なら、現行 skill の web-research routing に従って fresh verification してください。

    特に外部 claim を確認する場合は、

    • GitHub 公式 documentation / changelog
    • JWS / JWT の authoritative specification

    を優先してください。

    ただし repository evidence だけで契約修正の disposition を確定できる事項について、不必要な web research を blocking requirement にしないでください。

    Issue mutation

    OWNER directive の4点は単なる advisory としてコメントに再掲するだけではなく、refinement-loop の canonical mutation route を使って Issue #2725 本文へ実際に反映してください。

    preflight.run.with_human_context の結果に応じて、

    • trusted contract patch
    • contract_update.run.with_human_context
    • NEXT_ACTION: issue_editor_required の場合の canonical issue-editor full rewrite
    • deterministic repair

    の正しい route を選択してください。

    issue_editor_required を受け取った場合、同じ contract_update.run.with_human_context を no-progress retry しないでください。今回指定した anchor comment URL を reviewer feedback URL として canonical issue-editor route へ渡してください。

    Issue 更新後は必ず fresh readback を取得し、stale な pre-update review result を成功判定に使わないでください。

    Review loop

    更新後は現行 issue-refinement-loop の canonical Step 2 review pipeline を実行してください。

    • needs-fix / request_changes なら、残 iteration がある限り自律的に rewrite → fresh review を続行する。
    • reviewer の approve だけで完了扱いしない。
    • 最新 Issue body に対する CONTRACT_REVIEW_RESULT_V1.status == "go" と freshness を確認する。
    • stale contract-review snapshot は使用しない。
    • max_iterations 到達前に人間へ途中確認を求めない。

    external research、SubAgent、reviewer、contract review のいずれも、結果取得前に次 phase へ進まないでください。

    実装との境界

    この prompt の主目的は Issue #2725 の refinement です。

    Issue refinement が approved に到達する前に scripts/summarize_agent_transcript.py やテストへ production implementation を先行して入れないでください。

    approved termination 後の handoff / root transition については、現行 issue-refinement-loop の SSOT に定義された canonical behavior を勝手に再定義せず従ってください。少なくとも refinement の final gate が成立する前に実装 authorization を出してはいけません。

    完了条件

    以下が揃うまで refinement 成功として終了しないでください。

    最後に GitHub 上へ canonical termination report を残し、少なくとも以下を簡潔に報告してください。

    • termination reason
    • iteration 数
    • Issue 本文へ反映した主要な contract delta
    • final review / contract-readiness result
    • SubAgent completion 状態
    • FOLLOW_UP_MATERIALIZATION_RESULT_V1
    • implementation handoff state
    • unresolved blocker があればその exact reason code

    途中の承認確認は不要です。現在の skill / repository policy で自動処理可能な範囲は、そのまま最後まで進めてください。

    この形なら、対象コメントの4点を反映するだけでなく、「repository-wide 指摘を理由に #2725 の Allowed Paths を広げてしまう」事故も防ぎつつ、現行 skill の trusted-human-context route を使えます。

  4. squne121 commented on Sep 24, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

  5. squne121 commented on Sep 24, 2026

    @squne121
    OwnerAuthor

    Refinement Loop Termination Report

    termination_reason: approved
    iteration: 1(body rewrite 1回で needs-fix → approve に到達。max_iterations: 3)

    Human-context lane

    OWNER anchor comment(https://github.com/squne121/loop-protocol/issues/2725#issuecomment-5805213617)を preflight.run.with_human_context canonical lane で consume。この directive は Allowed Paths 拡大を伴わないため contract_update.run.with_human_context --consume-contract-patch-plan(scope-delta専用route)は非該当(PLANNER_FAIL_CLOSED / scope_delta_authority_evidence 不在で正しく fall through)。通常の Step 2 review → Step 4 issue-editor rewrite 経路で反映した。

    Issue #2725 本文へ反映した主要 contract delta

    1. AC1 の設計固定: 「generic matcher の charset 拡張」という曖昧な契約を、ghs_[A-Za-z0-9._-]{36,} 専用 matcher を既存 generic matcher (gh[opsur]_[A-Za-z0-9_]{20,}) より前に追加し、既存 generic matcher 自体は変更しない設計に修正(PR fix: 新形式GitHub App installation token(ghs_APPID_JWT)を完全redactする #2722 controlled_skill_mutation_exec.py の先行実装を参照実装として明記)。
    2. AC3 拡張: classic ghp_/gho_/ghs_/ghu_/ghr_ の5 prefix を個別に直接検証する parameterized pytest 追加を acceptance contract に明記。
    3. base64url / JWS delimiter 記述修正: 「base64url charset [A-Za-z0-9._-]」という不正確な表現を修正し、JWT/JWS の base64url alphabet ([A-Za-z0-9_-]) と .(JWS Compact Serialization の segment delimiter)を区別する記述に変更。
    4. Verification Commands 実効化: baseline で常に PASS してしまう rg -n "REDACT_PATTERNS"(canonical Step 2 review で unexpected_pass blocking issue として検出済み)を、専用 matcher の存在を直接検証する rg + behavioral pytest(新形式トークン完全置換 / classic 5-prefix regression / 全体PASS)へAC1〜AC4対応で再構成。
    5. Scope 維持: Allowed Paths(scripts/summarize_agent_transcript.py, tests/test_summarize_agent_transcript.py)不変、Runtime Verification Applicability not_applicable 維持、live credential test 不追加、新規 secret scanner subsystem 不追加。
    6. Remaining Parent Gaps 更新: repository-wide gap のうち 実装: summarize_agent_transcript.py の GitHub token redaction パターンを新形式 ghs_ App installation token に対応させる #2725 に吸収せず follow-up Issue 実装: secret_exposure_scanner.py の GitHub token detector パターンを新形式 ghs_ App installation token に対応させる #2733(.claude/scripts/secret_exposure_scanner.py)・実装: check_session_recording_runtime_safety.py の ghs_ redaction パターンを新形式トークンに対応させる #2734(.claude/scripts/check_session_recording_runtime_safety.py)として個別起票(既存 実装: compact_author_result.py の GitHub token 検出パターンを新形式 ghs_ App installation token に対応させる #2726/実装: persist_retrospective_run.py の secret redaction パターンを新形式 ghs_ App installation token に対応させる #2727/実装: get_ci_failed_log.py の KNOWN_TOKEN_PATTERN を新形式 ghs_ App installation token に対応させる #2728 と並記)。

    Final review / contract-readiness result

    • canonical Step 2 review(iteration 2, 更新後 body): canonical_step2_route: step_2_5、VERDICT: approve、NEXT_ACTION: proceed、BLOCKERS: 0
    • Step 2.5 semantic review applicability: semantic_review_applicable: false(全 explicit signal が false/0/empty)→ スキップし Step 4.5 へ
    • gate-final-review: final_review_allowed: true(artifact identity / body_sha256 / invocation_id / attempt / artifact_sha256 / verdict すべて binding 一致を確認)
    • CONTRACT_REVIEW_RESULT_V1 相当の readiness: 最新 body(body_sha256: sha256:05339935261f8fd01e67ad308cbed3a74ec711b5aaf7030ee61b4c90d2691aea)に対し status: go 相当(verdict: approve / next_action: proceed / blockers: 0)を fresh readback で確認済み

    SubAgent completion 状態

    FOLLOW_UP_MATERIALIZATION_RESULT_V1

    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: issue-refinement-loop
      follow_up_issues:
        - request_dedupe_key: "follow-up:squne121/loop-protocol:issue-2725:redactor-gap-secret-exposure-scanner"
          status: created
          issue:
            number: 2733
            url: "https://github.com/squne121/loop-protocol/issues/2733"
          reason: null
        - request_dedupe_key: "follow-up:squne121/loop-protocol:issue-2725:redactor-gap-session-recording-safety"
          status: created
          issue:
            number: 2734
            url: "https://github.com/squne121/loop-protocol/issues/2734"
          reason: null
      note_only_observations:
        - dedupe_key: "follow-up:squne121/loop-protocol:issue-2725:run-agy-github-research-broker-review"
          source_url: "https://github.com/squne121/loop-protocol/issues/2725#issuecomment-5805213617"
          source_note_id: "run_agy_github_research_broker_gap_unconfirmed"
          summary: "codebase-investigator の調査では run_agy_github_research_broker.py に明確な redaction pattern 不備は確認できなかった(broker はcredential handlingが主眼でcontent redactionパターンが見当たらない)。follow-up Issue化は見送り、note-only。"

    Implementation handoff state

    root_entry_router.py(run_root_transition()): route: invoke_impl_review_loop(reason: fresh_review_go_live_equality、reviewed_body_sha256 == observed_live_body_sha256 == sha256:05339935...、reviewed_base_sha == observed_base_sha == 73203069...)、invoked: true、audit published。

    これを受けて impl-review-loop skill を同一ターンで起動したが、実際の worktree 作成・コード実装・PR 作成に入る前に、operator(このセッションのユーザー)へ確認したところ「refinement の完了報告のみで一旦停止する」との回答を得たため、Step 1(Implementation)以降は着手していない。scripts/summarize_agent_transcript.py / tests/test_summarize_agent_transcript.py への production implementation は未実施。

    Unresolved blocker

    なし。termination_reason: approved。実装フェーズの着手判断は operator 保留中であり、これは blocker ではなく明示的な一時停止。


    🤖 Generated with Claude Code

  6. squne121 commented on Sep 24, 2026

    @squne121
    OwnerAuthor

    推奨アクションは #2725 の refinement を再実行せず、現在の impl-review-loop を preparation から fresh に再開する です。

    確認できた状態では、#2725 は最新 refinement で termination_reason: approved、blocker なし、root_entry_router も invoke_impl_review_loop を選択済みです。一方、前回は operator の明示的な一時停止によって implementation-worker の dispatch、worktree 作成、実装、PR 作成は未着手でした。また現時点では #2725 に対応する PR も見つかっていません。

    したがって、最初に current main / live Issue / PR discovery を取り直して Evidence-Based Landing Disposition を評価し、通常ルートなら implementation-worker → test-runner → pr-reviewer → fix loop と進めるのが適切です。各 SubAgent は final result と terminal completed の両方を確認するまで次へ進めないよう明示します。最終停止点は skill の draft_pr_ready、つまり マージ可能な状態まで持っていくが merge / auto-merge / Issue close はしないです。

    そのまま Claude Code に投入できます。

    squne121/loop-protocol の Issue #2725 を対象に、現在のリポジトリにある

    .claude/skills/impl-review-loop/SKILL.md

    および同 skill が参照する canonical steps / agents / scripts に厳密に従って、実装・独立検証・PR review・修正ループを実行してください。

    対象 Issue:

    #2725

    Operator intent

    この指示は、前回の refinement 完了後に operator が行った「実装フェーズにはまだ着手せず一旦停止する」という一時停止を明示的に解除するものです。

    今回は 人間による iteration ごとの承認を求めず、impl-review-loop をマージ直前まで自律実行してください。

    ただし、マージそのものは行わないでください。

    禁止する最終操作:

    正常終了点は、現行 impl-review-loop が定義する

    IMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_ready

    です。

    これは GitHub の Draft PR フラグとは別概念です。PR review、Verification Commands、required CI、live mergeability 等を現行 skill に従って確認し、マージ直前の状態まで到達したところで停止してください。

    既知の handoff state

    Issue #2725 の最新 refinement termination report:

    #2725 (comment)

    その直前の root entry audit:

    #2725 (comment)

    refinement の最終状態は以下です。

    • termination_reason: approved
    • unresolved blocker: なし
    • latest Issue body に対する review: approve / proceed / blockers 0
    • root entry router: route: invoke_impl_review_loop
    • 前回は operator の一時停止により Step 1 Implementation 未着手
    • production implementation 未実施
    • worktree / branch / PR はその時点では未作成

    ただし、これらを現在状態だと盲信しないでください。

    今回の run の開始時に live Issue、current main、open/merged PR、current repository state を fresh に取得し直してください。

    Permission / autonomy

    Claude Code は既に auto mode で起動済みです。

    現在の permission mode を変更しないでください。

    impl-review-loop の loop policy と Claude Code permission mode を混同しないでください。

    max_iterations は現行 skill の bounded policy、既定 3 iteration に従ってください。

    REQUEST_CHANGES や検証失敗が mechanical / bounded scope 内で修正可能な限り、人間確認を挟まず次 iteration へ進んでください。

    単なる warning、stale advisory snapshot、SubAgent の自己申告 human_review_required: true だけを理由に勝手に停止せず、現行 SKILL.md / routing scripts の canonical routing に従ってください。

    一方で、live owner veto、Issue の hard Stop Condition、actual Git conflict、正式な HUMAN_REVIEW_REQUIRED route、権限・environment failure 等の canonical hard stop は迂回しないでください。

    Start / resume strategy

    過去の refinement session の LOOP_STATE や task state を推測で再利用しないでください。

    まず impl-review-loop の preparation を current repository state に対して実行し、特に Evidence-Based Landing Disposition を fresh に評価してください。

    以下を確認してください。

    1. Issue 実装: summarize_agent_transcript.py の GitHub token redaction パターンを新形式 ghs_ App installation token に対応させる #2725 の現在の body と body SHA
    2. current main HEAD
    3. 実装: summarize_agent_transcript.py の GitHub token redaction パターンを新形式 ghs_ App installation token に対応させる #2725 を実装済みと主張できる merged candidate の有無
    4. 実装: summarize_agent_transcript.py の GitHub token redaction パターンを新形式 ghs_ App installation token に対応させる #2725 に対応する open/draft PR の有無
    5. current main 上で AC がすでに満たされていないか
    6. Allowed Paths の live contract
    7. Issue / PR コメント上に今回の continuation を止める新しい owner directive が存在しないか

    implementation_already_landed / existing_pr_resume / already_satisfied / reconciliation_required が fresh evidence から成立するなら、canonical disposition をそのまま消費し、duplicate PR を作成しないでください。

    それらが成立しなければ ordinary_dispatch_or_explicit_recovery として Step 1 へ進んでください。

    以前の refinement を単にやり直す必要はありません。contract snapshot の stale/missing advisory だけを理由に issue-refinement-loop へ戻らず、現行 impl-review-loop preparation の routing を正本としてください。

    Live Issue contract を正本にする

    実装時はこの prompt に転記された情報より live Issue #2725 本文を正本としてください。

    現時点で期待される実装 scope は次の2ファイルだけです。

    • scripts/summarize_agent_transcript.py
    • tests/test_summarize_agent_transcript.py

    Allowed Paths を拡張しないでください。

    他の scanner / redactor の同種問題は #2726 / #2727 / #2728 / #2733 / #2734 等の別 scope です。#2725 に吸収しないでください。

    Technical recommendation

    Issue contract と current main が一致していることを fresh に確認した上で、今回の実装は最小差分を優先してください。

    scripts/summarize_agent_transcript.py では、既存 generic matcher

    re.compile(r"gh[opsur]_[A-Za-z0-9_]{20,}")

    自体を変更しないでください。

    その直前に、新形式 installation token 用の専用 matcher

    re.compile(r"ghs_[A-Za-z0-9._-]{36,}")

    を <GITHUB_TOKEN> replacement として追加する設計を維持してください。

    JWT/JWS header / payload / signature を parse しないでください。opaque token として redaction してください。

    generic matcher を [A-Za-z0-9._-] に拡張する代替実装は行わないでください。

    テストでは live Issue AC に従い、少なくとも以下を直接証明してください。

    • 新形式 ghs_<APP_ID>_<header>.<payload>.<signature> が全体として exactly 1つの <GITHUB_TOKEN> に置換される
    • payload / signature 等の断片が残らない
    • classic ghp_, gho_, ghs_, ghu_, ghr_ の5 prefixを parameterized pytest で直接回帰検証する
    • tests/test_summarize_agent_transcript.py 全体が PASS する

    不要な architecture 変更、新規 security harness、live credential canary、E2E external-service test は追加しないでください。

    Runtime Verification Applicability は live Issue が現在も not_applicable ならその契約に従ってください。

    Step 1 — implementation-worker

    root thread が実装を直接行うのではなく、現行

    .claude/skills/impl-review-loop/steps/step-1-implementation.md

    に従い implementation-worker SubAgent を dispatch してください。

    worker には実際の live 値を materialize してください。

    placeholder や LOOP_STATE.issue_number 等をそのまま child message に渡さないでください。

    少なくとも以下を bind してください。

    raw human comment 本文をそのまま execution instruction として child に連結しないでください。

    implementation-worker に .claude/skills/implement-issue/SKILL.md を実行させ、

    worktree → implementation → local verification → commit → publish → PR creation

    まで canonical route で完了させてください。

    SubAgent completion / join は必須

    すべての SubAgent dispatch について、現行 Common Completion Protocol を厳守してください。

    特に以下を必須とします。

    1. spawn_agent の戻り値から canonical task name を保持する。
    2. wait_agent は mailbox activity を待つ手段としてのみ使う。
    3. timeout、steer、途中 mailbox update、structured hand-back の途中受領を「作業完了」と解釈しない。
    4. 対象 SubAgent の final result を実際に consume する。
    5. その後 list_agents 等の canonical mechanism で、その同じ task が terminal completed になっていることを確認する。
    6. final result と terminal completed の両方が成立した後にのみ root orchestration を次 step へ進める。
    7. errored / interrupted / shutdown / not_found は成功扱いしない。
    8. SubAgent がまだ running なら、root は次 phase を開始しない。
    9. bounded completion checks 後も terminal completion が得られない場合、推測で continuation せず current skill の harness/environment failure routing に従う。
    10. structured output を受け取っただけで、running agent を kill して「正常完了」とみなさない。

    SubAgent 自身による nested SubAgent delegation が必要になった場合は、Issue #2725 の live Stop Conditions と現行 skill の権限境界を確認してください。許可されていない nested delegation を勝手に行わないでください。

    Step 2 — independent verification

    Step 1 が PR を作成したら、現行 Step 2 に従って test-runner SubAgent を起動してください。

    live Issue #2725 に記載された literal Verification Commands をそのまま使用してください。この prompt の古いコピーへ置換しないでください。

    test-runner には以下を実値で bind してください。

    test-runner は read-only report を返す役割です。

    Step 4 へ進む前に、

    • final result
    • terminal completed
    • report head SHA == current PR head
    • literal command binding
    • current Issue body binding
    • VC_ADJUDICATION_RESULT_V1.blocking == false

    を canonical scripts / current-head binding で確認してください。

    stale result を流用しないでください。

    Step 4 — PR review

    Step 2 の independent VC adjudication が current head に対して nonblocking である場合だけ、pr-reviewer SubAgent を起動してください。

    起動直前に current-head gate を再評価してください。

    PR head / Issue body / Verification Commands binding のいずれかが stale なら reviewer を起動せず、Step 2 に戻って fresh verification を実行してください。

    pr-reviewer についても final result + terminal completed の両方を確認してください。

    レビュー結果は現行 pr-review-judge / route_loop_verdict_v2() を正本として routing してください。

    Autonomous fix loop

    review が REQUEST_CHANGES、または independent verification が blocking の場合、current skill が修正可能な route と判定する限り、人間確認を求めないでください。

    blockers / test failures / review evidence を具体的な fix_delta に正規化し、次 iteration の新しい implementation-worker task に委譲してください。

    修正後は head SHA が変わるため、

    fresh verification → current-head gate → fresh PR review

    を再実行してください。

    stale review verdict を次 iteration に流用しないでください。

    BEHIND は conflict と同一視せず、現行 Step 5 の route_to_update_branch に従って bounded mechanical update を implementation-worker に委譲し、その後 verification と PR review を再実行してください。

    Scope discipline

    Issue #2725 の実装中に別の repository-wide gap を見つけても、この PR に混ぜないでください。

    特に次を変更しないでください。

    • .claude/scripts/secret_exposure_scanner.py
    • .claude/scripts/check_session_recording_runtime_safety.py
    • .claude/skills/issue-refinement-loop/scripts/compact_author_result.py
    • .claude/skills/agent-retrospective/scripts/persist_retrospective_run.py
    • .claude/skills/impl-review-loop/scripts/get_ci_failed_log.py
    • その他 Allowed Paths 外

    新規 Issue materialization が必要になること自体が #2725 の live Stop Condition に該当するなら、その条件を無視して自動拡張せず canonical stop/report route に従ってください。

    External research

    この Issue の implementation contract は refinement 済みであり、current repository に先行参照実装もあります。

    repository facts と live Issue contract が一致している限り、追加の external research は implementation の blocking requirement にしないでください。

    現行 impl-review-loop が要求する external_research_skip_basis には、例えば

    「Issue contract が matcher を明示し、repository 内の先行実装と tests で実装判断が完結するため追加外部調査不要」

    という根拠を current evidence に合わせて記録してください。

    Final success gate

    単に tests PASS または reviewer APPROVE だけで終了しないでください。

    現行 impl-review-loop の termination rules に従って、

    • current-head verification nonblocking
    • PR review APPROVE
    • blockers 空
    • required CI / branch checks の canonical evaluator が満たされている
    • live mergeability が canonical approved route を満たしている
    • head/body/command evidence が current
    • required autonomy-policy validator PASS

    まで確認してください。

    成功時は Issue #2725 に canonical termination report を投稿し、

    IMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_ready
    termination_reason: approved

    を emit してください。

    PR URL、current head SHA、iteration、live mergeability から計算した merge_ready、FOLLOW_UP_MATERIALIZATION_RESULT_V1 を現行 schema に従って含めてください。

    その後停止してください。

    merge、auto-merge、Issue close は行わないでください。

    途中経過について人間承認を求めず、canonical hard stop または draft_pr_ready のどちらかに到達するまで自律的に進めてください。

    この prompt のポイントは、前回の「refinement → impl 起動直前で operator 停止」という状態を明示的に解消しつつ、以前問題になった SubAgent の hand-back を completion と誤認するケースを禁止している点です。また、開始時には landing disposition を fresh に取り直すので、投入までの間に別 PR が作られていても duplicate PR を作りにくい構成です。

  7. squne121 commented on Sep 24, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-09-24T01:03:52Z)

  8. squne121 commented on Sep 24, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (2026-09-24T01:15:30Z)

    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      pr_url: "https://github.com/squne121/loop-protocol/pull/2735"
      head_sha: "bb3a01f6217d8721ceade86c0050b1e8ec9e3eae"
      issue_number: 2725
      termination_reason: approved
      merge_ready: true
      iteration: 0
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: impl-review-loop
      follow_up_issues: []
      note_only_observations:
        - dedupe_key: "pr-2735-body-section-headers-non-literal"
          source_url: "https://github.com/squne121/loop-protocol/pull/2735#issuecomment-5805651825"
          source_note_id: "reviewer_warning_1"
          summary: "PR body のセクション見出しが reference doc の literal 見出しと異なるが、直近マージ済み PR(#2693/#2717/#2720)と同じ repo 慣行であり non-blocking。follow-up 起票不要。"
    
    ISSUE_SCOPE_ROLLUP_DECISION_V2:
      schema_version: 2
      recorded_at: "2026-09-24T01:15:30Z"
      rollup_plan_ref:
        body_sha256: null
        generated_at: null
      decision: skipped
      executed_actions: []
      skipped_reason: "optional advisory diagnostic(Section 2.5)は手動起動対象であり本 run では未実行。single-file scope の follow-up Issue のため統合候補の実益が低いと判断。"
      candidates_reviewed: []
  9. squne121 commented on Sep 24, 2026

    @squne121
    OwnerAuthor

    Human-context directive (PR #2735 review反映)

    source directive: PR #2735 issuecomment-5805932110

    判定: REQUEST_CHANGES相当。production regexは維持、修正はテスト1点に絞る。

    • production ghs_[A-Za-z0-9._-]{36,} matcher(PR fix: summarize_agent_transcript.py の GitHub token redaction を新形式 ghs_ App installation token に対応させる #2735)は維持する。既存 generic matcher gh[opsur]_[A-Za-z0-9_]{20,} は変更しない。
    • classic regression fixture: prefix後32文字ではなく、実 classic token boundary を通る 36文字 body に直す(例: token = f"{prefix}{'A' * 36}" 相当)。classic ghs_ が今回追加した dedicated matcher を実際に通ることを regression test で直接証明する。
    • new-format fixture: 短い疑似JWTのみでなく、少なくとも約520文字級のtokenを処理できることをregressionとして固定する。JWT内部はparse/validateせずopaque tokenとして扱う。将来 {36,255} のような誤った上限が追加された場合に regression が失敗する構造にする(exact 520という production requirementにはしない)。
    • 新規harness、live credential E2E、実GitHub tokenの取得は不要。
    • github_pat_ 未対応はPR #2735に混ぜず別follow-upとする。

    expected implementation delta: tests/test_summarize_agent_transcript.py のみ(production regexの変更は不要)。

  10. squne121 commented on Sep 24, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (人間レビュー反映 rereview)

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/implementerarea/securityenhancementfollow-upphase/implementationtriage-required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions