Repository navigation
Description
Machine-Readable Contract
contract_schema_version: 1
issue_kind: implementation
parent_issue: "none"
goal_ref: "docs/dev/secret-policy.md"
change_kind: "redaction-bypass-fix"Parent Issue
なし(単独改善 / Issue #2728 のレビュー中に発見した follow-up)
Parent Goal Ref
なし(親 Issue なし)。参照する正本は docs/dev/secret-policy.md(no-secret 運用境界)。
Current Validated Scope
.claude/skills/impl-review-loop/scripts/get_ci_failed_log.py の main() 内、gh CLI 呼び出し結果に対する diagnostic/error 出力の 3 箇所のみ。redaction ロジック自体(redact_tokens() の実装や正規表現パターン)は変更しない。
Remaining Parent Gaps
なし。本 Issue 完了後、get_ci_failed_log.py の全 emit_result() 呼び出し経路が redact_tokens() を経由する状態になる想定。他ファイルの同種 gap(例: Issue #2686 が対象とする issue_relationship.update GraphQL error diagnostics)は本 Issue のスコープ外。
Outcome
.claude/skills/impl-review-loop/scripts/get_ci_failed_log.py の main() 内で emit_result() に diagnostic/error メッセージを渡している以下 3 箇所が、正常系ログ出力パス(main() L311 log_text, redaction_applied = redact_tokens(log_text))と同様に redact_tokens() を経由してから emit_result() に渡るよう修正されたコミットが存在する状態:
gh run view failed: {err.strip()}(L206 付近)gh run list failed: {err.strip()}(L237 付近)Failed to parse gh output: {out[:200]}(L247 付近)
修正後、各箇所の emit_result(...) 呼び出しに渡る redaction_applied 引数値が redact_tokens() の実際の適用結果(token を検出・置換した場合は True)を正しく反映しており、get_ci_failed_log.py --help 相当の import と redact_tokens の単体呼び出しに対する新規 pytest ケースが green である状態。
Runtime Verification Applicability
- decision: not_applicable
- reason: 静的な diagnostic 出力経路の redaction 適用有無は grep/rg と pytest の決定論的検証で完結するため
In Scope
main()内、gh run view失敗時のemit_result(log_text=f"gh run view failed: {err.strip()}", ...)呼び出し前にerrをredact_tokens()に通し、結果のredaction_appliedを渡すmain()内、gh run list失敗時のemit_result(log_text=f"gh run list failed: {err.strip()}", ...)呼び出し前にerrをredact_tokens()に通し、結果のredaction_appliedを渡すmain()内、gh run listの JSON パース失敗時のemit_result(log_text=f"Failed to parse gh output: {out[:200]}", ...)呼び出し前にout[:200]をredact_tokens()に通し、結果のredaction_appliedを渡す- 上記 3 箇所を対象にした新規 pytest(token を含む fake
err/outを与えた場合に redaction 済み文字列が stdout に出力され、redaction_applied: trueを含む JSON が返ることを検証する)の追加 - 既存の同ファイル test file(Allowed Paths に記載の 2 候補パスのうち、実際に存在する方)への追記
Out of Scope
redact_tokens()自体のパターン拡張・アルゴリズム変更(Issue 実装: get_ci_failed_log.py の KNOWN_TOKEN_PATTERN を新形式 ghs_ App installation token に対応させる #2728 のスコープ)- 他ファイル(
issue_relationship.update等、Issue 実装: issue_relationship.update GraphQL error diagnostics に既存 redactor を通す #2686 が対象とするもの)への同種修正の横展開 - 新規 credential canary や scanner の追加
- L213(
head_sha_mismatch分岐)や L256/L264/L278/L286(log_textが固定文字列やnamesのようにユーザ入力由来でない診断メッセージ)の変更。これらはghraw 出力を含まないため本 Issue の対象外
Acceptance Criteria
- AC1:
gh run view失敗時の diagnostic message (gh run view failed: ...) がredact_tokens()を経由してからemit_result()に渡る - AC2:
gh run list失敗時の diagnostic message (gh run list failed: ...) がredact_tokens()を経由してからemit_result()に渡る - AC3:
gh run listの JSON パース失敗時の diagnostic message (Failed to parse gh output: ...) がredact_tokens()を経由してからemit_result()に渡る - AC4: 上記 3 経路で
redact_tokens()が token を検出した場合、emit_result()に渡るredaction_applied引数がTrueになる - AC5: AC1〜AC4 を検証する新規 pytest ケースが追加され green である
Verification Commands
# AC1
$ rg -n "redact_tokens\(err\)" .claude/skills/impl-review-loop/scripts/get_ci_failed_log.py# AC2
$ rg -c "redact_tokens\(err\)" .claude/skills/impl-review-loop/scripts/get_ci_failed_log.py# AC3
$ rg -n "redact_tokens\(out" .claude/skills/impl-review-loop/scripts/get_ci_failed_log.py# AC4
$ rg -c "redaction_applied=redaction_applied" .claude/skills/impl-review-loop/scripts/get_ci_failed_log.py# AC5
$ uv run pytest tests/impl_review_loop/test_get_ci_failed_log.py -vAllowed Paths
.claude/skills/impl-review-loop/scripts/get_ci_failed_log.pytests/impl_review_loop/test_get_ci_failed_log.py.claude/skills/impl-review-loop/tests/test_get_ci_failed_log.py(Issue 実装: get_ci_failed_log.py の KNOWN_TOKEN_PATTERN を新形式 ghs_ App installation token に対応させる #2728 のテスト移動が本 Issue 着手前に完了している場合のみ、こちらを使用する)
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
なし
Required Design References
なし(docs/dev/secret-policy.md の no-secret 運用境界を踏まえるのみで、追加の設計参照は不要)
Delivery Rule
1 Issue = 1 PRを原則とする- worktree を切って作業し、Draft PR を既定とする
- Issue 実装: get_ci_failed_log.py の KNOWN_TOKEN_PATTERN を新形式 ghs_ App installation token に対応させる #2728 と同一ファイル(
get_ci_failed_log.py)を扱うため、実装順序によっては軽微なマージコンフリクトが発生しうる。実装: get_ci_failed_log.py の KNOWN_TOKEN_PATTERN を新形式 ghs_ App installation token に対応させる #2728 のマージ前後どちらでも実装可能であり、hard dependency は設定しない
Notes for Reviewer
- 優先度:
optional_follow_up(低優先度)。実クレデンシャル漏洩インシデントは未確認であり、プロアクティブな gap 解消が目的。緊急対応は不要 tests/impl_review_loop/test_get_ci_failed_log.pyが現時点(2026-09-25, main HEADe3ee04c6)で存在する test file であることを確認済み。.claude/skills/impl-review-loop/tests/test_get_ci_failed_log.pyはまだ存在しない(Issue 実装: get_ci_failed_log.py の KNOWN_TOKEN_PATTERN を新形式 ghs_ App installation token に対応させる #2728 のテスト移動が先行する場合に備えて Allowed Paths の候補に含めている)- dedupe_key:
follow-up:squne121/loop-protocol:issue-2728:diagnostic-redaction-bypass - keyword search(
diagnostic-redaction-bypass/redact_tokens emit_result get_ci_failed_log)で同一 concern を対象にした既存 OPEN/CLOSED Issue は見つからなかった
Notes for Reviewer(続き: overlap preflight)
Allowed Paths ベースの overlap preflight(check_issue_overlap.py)実行結果: decision: overlap_requires_comment(policy_class C1)。
#2728と.claude/skills/impl-review-loop/scripts/get_ci_failed_log.pyが overlap(本 Issue の Notes ですでに言及済み。hard dependency は設定しない方針に変更なし)#1390/#420はtests/impl_review_loop/test_get_ci_failed_log.pyの親ディレクトリtestsの bare path 一致による false positive(対象ファイルもテーマも本 Issue と無関係)と判断し、対応不要
Source
Issue #2728(.claude/skills/impl-review-loop/scripts/get_ci_failed_log.py の KNOWN_TOKEN_PATTERN 拡張)のレビュー中、repository investigation により発見。参照コメント: #2728 (comment)
Activity
squne121 commentedon Sep 25, 2026
create-issue transaction partial-failure
Issue: #2759
Failure stage: label-apply
Message: label-apply failed
Requested:
Completed steps: create
Failure context: command=gh issue edit --repo squne121/loop-protocol 2759 --add-label phase/implementation,agent/implementer,enhancement,area/security,follow-up,optional_follow_up
output=failed to update #2759: 'optional_follow_up' not found
failed to update 1 issue
matching_issue_numbers=[2759]
issue_number=2759
Recovery hint: stage 'label-apply' encountered an unexpected failure.
Generic guidance: verify the issue state manually and re-run the transaction if safe.
gh issue view 2759 --repo squne121/loop-protocol --json number,title,labels,state
idempotent re-run: depends on the specific failure
Please recover deterministically before re-running the create issue transaction.