Repository navigation
fix: compact_author_result.pyのghs_パターンを新形式GitHubトークンに対応させる - #2746
Conversation
`_no_secret_check()` の `ghs_` 検出正規表現を固定長36文字(classic short-lived
server token専用)から `ghs_[A-Za-z0-9._-]{36,}`(下限長+拡張charset)へ拡張し、
新形式 `ghs_<APP_ID>_<JWT>` トークンをsecret-like inputとして検出できるようにする。
既存classic `ghp_` / `ghs_`固定長トークンの検出は回帰させない。
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Preview URL✅ verified live assets: https://squne121.github.io/loop-protocol/pr-2746/ The preview will be removed when this PR is closed. |
PR Review 判定(pr-review-judge)Mergeability: mergeable=MERGEABLE, mergeStateStatus=CLEAN, isDraft=true(Draft は blocker 扱いしない) Evidence Check:
Blockers: なし verdict: APPROVE
reviewed_head_sha: "a91b0aaf125ede090f99f2286ddf474441b02f8d"
blockers: []
warnings:
- "PR is currently in Draft state (isDraft: true); not treated as a reviewer blocker per skill contract." |
判定REQUEST_CHANGES 相当です。ただし production regex 自体には blocker を見つけていません。修正対象はほぼテストだけです。 2026年9月25日時点の PR #2746 は、head production の r"ghs_[A-Za-z0-9._-]{36,}"は妥当です。GitHubは2026年5月15日の案内で、新旧 installation token を拾う推奨regexとして実質同じパターンを明示しています。新形式は
修正後に期待する形production code はそのままでよいです。修正はテスト中心で、 repository-wide gapについても、このPRへ混ぜる必要はありません。 したがって、今回の敵対的レビュー結果は 「production matcherは承認、テスト2点を軽量修正してからAPPROVE」 が適切です。特に1番目の「 |
|
確認した限り、推奨は PR #2746 を既存PRのまま 重要な差分として、コメント作成時は また、production regex そのまま既に auto mode で起動している Claude Code に貼れる形です。 PR #2746 を対象に、 対象:
人間承認は通常の loop iteration 間では要求しないでください。マージ自体、auto-merge、PR close、Issue close は実行せず、current head が merge-ready になった時点で停止してください。
通常の iteration について私への承認要求・確認質問は不要です。 外部仕様については、OWNER comment と GitHub公式の2026年4月/5月 installation-token guidance、PR #2735 の precedent で今回の判断材料は十分です。追加調査が不要なら 最終状態ではマージしないでください。以下が揃ったところで停止してください: 最後に
今回のポイントは、最初からテスト修正を始めず、先に1コミット進んだ |
…ompact-author-result-py-github-token-gh
…precedentに揃え、AC3のfalse-pass経路を排除する (#2726) PR #2735(summarize_agent_transcript.py)で確立した new-format ghs_ installation token fixture の生成方式(header.payload.signature JWT 構造、'.'を正確に2個含む、実際の~520文字スケール)を _make_new_format_ghs_token() として共有化し、AC2/AC3 の2テストで統一。 AC3 のテストは diff_summary の文脈を "token: <token>" から "credential fixture <token>" に変更し、既存の generic token:/secret:/api_key: detector 経由の false pass を排除して、新設 dedicated ghs_ matcher 自体が fail-closed 経路を駆動していることを 証明する。docstring も実装(full_artifact 構築 → json.dumps() → _no_secret_check() の呼び出し順)に即した正確な意味論に修正した。 production regex (ghs_[A-Za-z0-9._-]{36,}) は変更しない。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
OWNER review comment(issuecomment-5828282328)の4点を修正: - test_new_format_installation_token_blocks_publication の synthetic token に matcher charset の '-' を明示的に含め、'-'/'_' 存在を直接 assert する - persist_retrospective_run.py の precedent attribution を実際の変更履歴 (controlled_skill_mutation_exec.py は Issue #2718 / PR #2722、Issue #2726 / PR #2746 は compact_author_result.py)に一致させる - ghs_[A-Za-z0-9._-]{36,} を「new-format dedicated matcher」と断定する記述 を修正し、classic/current 36+文字形式も包含する broad matcher であること を明記。legacy matcher の 32文字 fixture は実 classic token ではなく short-form legacy detector input であることを test名/docstring/comment で明確化(test_classic_ghs_token_blocks_publication を test_short_form_legacy_ghs_detector_input_blocks_publication へ改名) - 新テストの docstring の「before any transport call」を実装に一致する 「before any publication POST / create_comment call」へ修正 production matcher (ghs_[A-Za-z0-9._-]{36,}) 自体は変更なし。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
…tallation token に対応させる (#2751) * fix: persist_retrospective_run.py の _TOKEN_PATTERNS に新形式 ghs_ App installation token matcher を追加する (#2727) `_TOKEN_PATTERNS` の既存 legacy matcher `\bghs_[A-Za-z0-9]{20,}\b` は 新形式 GitHub App installation token `ghs_<APP_ID>_<header>.<payload>.<signature>` に対して APP_ID 直後の `_` で停止し実質的に unmatched だったため、Issue #2726 / PR #2746 (`controlled_skill_mutation_exec.py` の `_SECRET_LIKE_PATTERNS`)を precedent として dedicated matcher `ghs_[A-Za-z0-9._-]{36,}` を追加する。 legacy matcher は維持し、新形式・classic 両方が `PublicSafetyViolation(reason_code="token_pattern_detected")` で fail-closed に拒否されることを検証する pytest を追加した。 Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix: PR #2751 review指摘を反映しfixture/precedent attribution/用語を修正する (#2727) OWNER review comment(issuecomment-5828282328)の4点を修正: - test_new_format_installation_token_blocks_publication の synthetic token に matcher charset の '-' を明示的に含め、'-'/'_' 存在を直接 assert する - persist_retrospective_run.py の precedent attribution を実際の変更履歴 (controlled_skill_mutation_exec.py は Issue #2718 / PR #2722、Issue #2726 / PR #2746 は compact_author_result.py)に一致させる - ghs_[A-Za-z0-9._-]{36,} を「new-format dedicated matcher」と断定する記述 を修正し、classic/current 36+文字形式も包含する broad matcher であること を明記。legacy matcher の 32文字 fixture は実 classic token ではなく short-form legacy detector input であることを test名/docstring/comment で明確化(test_classic_ghs_token_blocks_publication を test_short_form_legacy_ghs_detector_input_blocks_publication へ改名) - 新テストの docstring の「before any transport call」を実装に一致する 「before any publication POST / create_comment call」へ修正 production matcher (ghs_[A-Za-z0-9._-]{36,}) 自体は変更なし。 Co-Authored-By: Claude Sonnet 5 <[email protected]> --------- Co-authored-by: Test <[email protected]> Co-authored-by: Claude Sonnet 5 <[email protected]>
…iliation 停止を防ぐ (#2758) * fix: impl-review-loop の cross-reference false candidate による不要な reconciliation 停止を防ぐ (#2750) derive_landing_disposition() が、closing relation が無い場合の verified_cross_reference 候補を、自身の候補ローカル durable marker が別 Issue を指し(scope_coverage_issue_identity_mismatch 単独エラー)irrelevant であることを考慮せず qualified candidate として conflict counting に 含めていたため、#2727 で PR #2735/#2746 のような precedent/reference cross-reference が qualified_candidate_conflict を誤発生させていた(closing_relation 候補が無い場合のみ、全 lifecycle に対して bounded に除外する。closing_relation 候補が存在する場合や複合 marker error、markerless candidate は従来どおり fail-closed のまま)。 SKILL.md / preparation.md の既存 fail-closed 契約に bounded carve-out を明文化し、 #2727 incident shape の regression fixture(unit + collect_candidate_inputs() を通す production-shaped integration path)を追加。 Closes #2750 Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix: #2727 sibling cross-reference regression テストを production composition まで延長する PR #2758 review (P1 blocker, comment https://github.com/squne121/loop-protocol/pull/2758#issuecomment-5831103538)。 test_collect_candidate_inputs_production_shaped_2727_sibling_cross_references_excluded() が derive_landing_disposition() までしか通っておらず、Issue #2750 が要求する canonical production composition(resolve_landing_disposition_with_freshness_rebind() -> derive_landing_disposition() -> apply_already_satisfied_precedence() -> resolve_pre_step1_data_plane_action())を同一 #2727 incident-shaped fixture で 検証できていなかった。build_intake_capsule.py::_collect_implementation_landed_evidence() まで同一 fixture を延長し、already_satisfied / suppress_worker_worktree_new_pr への 到達を直接 assert する。production code は変更しない。 Co-Authored-By: Claude Sonnet 5 <[email protected]> --------- Co-authored-by: Test <[email protected]> Co-authored-by: Claude Sonnet 5 <[email protected]>
Summary
compact_author_result.pyの_no_secret_check()のghs_検出正規表現を、classic 固定長 36 文字(ghs_[A-Za-z0-9]{36})から新形式ghs_<APP_ID>_<JWT>トークンにも対応する下限長 + 拡張 charset(ghs_[A-Za-z0-9._-]{36,})へ拡張するghp_および classic 固定長ghs_トークンの検出・fail-closed 挙動(compact_author_result()が artifact 組み立て中にValueErrorを送出し、呼び出し元に success result を返却しない。success artifact の書き込みは呼び出し元が別途_atomic_writeで行うため、その呼び出し自体に到達しない)は維持するtest_compact_author_result.pyの new-formatghs_fixture 生成を PR fix: summarize_agent_transcript.py の GitHub token redaction を新形式 ghs_ App installation token に対応させる #2735(summarize_agent_transcript.py)の precedent に揃え、共有 helper_make_new_format_ghs_token()でheader.payload.signature形式・.2 個・_/./-混在・実際の installation token スケール(>=520文字)を満たすトークンを AC2/AC3 で共通生成する。AC3 のdiff_summary文脈をtoken:からcredential fixtureに変更し、既存 generictoken:/secret:/api_key:detector 経由の false pass を排除、新設 dedicatedghs_matcher 自体が fail-closed 経路を駆動することを証明するChecks
pnpm typecheckpnpm lintpnpm testpnpm builduv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.pyuv run pytest .claude/skills/issue-refinement-loop/tests/test_compact_author_result.py(24 tests pass)uv run pytest .claude/skills/issue-refinement-loop/tests/test_compact_author_result.py::test_no_secret_check_detects_new_format_ghs_installation_tokenuv run pytest .claude/skills/issue-refinement-loop/tests/test_compact_author_result.py::test_compact_author_result_new_format_ghs_token_raises_valueerroruv run pytest .claude/skills/issue-refinement-loop/tests/test_compact_author_result.py::test_no_secret_check_detects_legacy_ghs_token .claude/skills/issue-refinement-loop/tests/test_compact_author_result.py::test_compact_author_result_artifact_secret_check_failsrg -n 'ghs_\[A-Za-z0-9\._-\]\{36,\}' .claude/skills/issue-refinement-loop/scripts/compact_author_result.py(該当行ヒット確認、production regex 未変更)Schema Change Applicability
not_schema_change_no_secret_check()は producer-consumer 間の machine-readable contract(schema)ではなく、内部 detector 関数の正規表現拡張のみ。ISSUE_AUTHOR_RESULT_COMPACT_V1等の公開 schema フィールド構造には変更なし。Schema Consumer Inventory
N/A(
not_schema_changeのため)。理由: 本 PR は secret-like input を検出する正規表現の charset・長さ制約を拡張するのみであり、compact_author_result.pyが producer/consumer 間で公開する JSON schema(ISSUE_AUTHOR_RESULT_COMPACT_V1/PRODUCER_FAILURE_V1)のフィールド構造・型には一切変更がない。Compatibility Decision(互換性判定)
N/AN/AN/AN/ASafety Claim Matrix
ghs_<APP_ID>_<JWT>トークン(_/./-を含む、PR #2735 precedent 由来の共有 helper_make_new_format_ghs_token()で>=520文字スケールで生成)が_no_secret_check()の secret-like detection で検出され、compact_author_result()が artifact 組み立て中に fail-closed でValueErrorを送出し、success result を呼び出し元へ返却しない(success artifact の書き込みに到達しない)test_no_secret_check_detects_new_format_ghs_installation_token,test_compact_author_result_new_format_ghs_token_raises_valueerror)ともに pass。AC3 はdiff_summaryをtoken:prefix を含まないcredential fixture文脈にして、既存 generic detector 経由の false pass ではなく新設 dedicatedghs_matcher 自体が経路を駆動していることを検証ghp_トークンおよび classic 固定長ghs_(ghs_+ 36 文字英数字)トークンの検出・fail-closed 挙動を回帰させないtest_no_secret_check_detects_legacy_ghs_token,test_compact_author_result_artifact_secret_check_fails)ともに pass_no_secret_check()は detector のまま維持し、新しい redaction/マスキング layer は追加していない.claude/skills/issue-refinement-loop/scripts/compact_author_result.pyL173)。関数シグネチャ・戻り値・呼び出し元は不変Notes
.claude/skills/issue-refinement-loop/scripts/compact_author_result.pyの_no_secret_check()内ghs_パターン拡張のみ(Allowed Paths 準拠)not_applicable(正規表現拡張と pytest による静的検証のみで完結するため)と明記されている