Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: none
goal_ref: "issue-refinement-loop の web-researcher が transient auth error で失敗した場合に human_escalation せず 1 回自動 retry して成功率を上げる"
change_kind: docsParent Issue
なし(単独改善)
Parent Goal Ref
- Goal: transient auth error による不要な human_escalation を削減する
- Desired Destination: N/A
Current Validated Scope
.claude/skills/issue-refinement-loop/SKILL.mdの Step 1b に「status: failed かつ failure_class: auth_error の場合は 1 回自動 retry し、再失敗時のみ human_escalation に進む」手順を追記する
Remaining Parent Gaps
なし
Background
issue-refinement-loop の Step 1b(web-researcher SubAgent)が status: failed / failure_class: auth_error を返した場合、現行 SKILL.md では critical claims 有無に関わらず即 human_escalation となる。
しかし実運用で gemini-cli-headless-delegation の初回認証失敗は transient エラーであることが多く、retry で成功するケースが観測されている(memory: feedback_gemini_delegation_retry.md)。
2026-05-22 の #146 refinement loop でも初回 web-researcher が auth_error で FAILED し、retry で全件 supported に変わった事例がある。
human_escalation の前に 1 回 retry することで、transient エラーによる不要な停止を削減できる。
Outcome
issue-refinement-loop SKILL.md の Step 1b に、status: failed かつ failure_class: auth_error の場合の 1-retry 手順 が追記されており、retry 失敗時のみ元の human_escalation / proceed ロジックに従う。
In Scope
.claude/skills/issue-refinement-loop/SKILL.mdの Step 1bWEB_RESEARCH_RESULT_V1 handlingセクションへの retry 手順追記LOOP_STATE.web_researchにretry_count: 0フィールドの追加(schema 拡張)
Out of Scope
- web-researcher SubAgent 自体の変更
- 2 回以上の retry(1 回のみ)
- auth_error 以外の failure_class への retry(query_error 等は retry 不可)
- gemini-cli-headless-delegation の認証フロー変更
Acceptance Criteria
- AC0: SKILL.md の
WEB_RESEARCH_RESULT_V1 handlingにif status == failed and failure_class == auth_error: retry onceの手順が追記されている - AC1:
LOOP_STATE.web_research.retry_countフィールドが LOOP_STATE schema に追加されている - AC2: retry 後も
status: failedの場合、元の human_escalation / proceed ロジック(critical claims 判定)に従う手順が明記されている - AC3:
failure_class: query_error/capability_unavailableは retry 対象外と明記されている
Verification Commands
# AC0: retry 手順の記述確認
rg "auth_error.*retry|retry.*auth_error|retry once" .claude/skills/issue-refinement-loop/SKILL.md && echo "PASS: AC0" || echo "FAIL: AC0"
# AC1: retry_count フィールドの記述確認
rg "retry_count" .claude/skills/issue-refinement-loop/SKILL.md && echo "PASS: AC1" || echo "FAIL: AC1"
# AC2: retry 後の human_escalation 記述確認
rg "retry.*failed.*human_escalation|retry.*(再失敗|still failed)" .claude/skills/issue-refinement-loop/SKILL.md && echo "PASS: AC2" || echo "FAIL: AC2"
# AC3: query_error 非対象の記述確認
rg "query_error.*retry 対象外|capability_unavailable.*retry 対象外" .claude/skills/issue-refinement-loop/SKILL.md && echo "PASS: AC3" || echo "FAIL: AC3"Allowed Paths
.claude/skills/issue-refinement-loop/SKILL.md
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
- GitHub CLI / GitHub API(なし — docs のみ変更)
Runtime Verification Applicability
decision: not_applicable
rationale: >
docs-only 変更(SKILL.md への手順追記)。実行可能な runtime コマンドがなく、
rg による記述確認のみで検証完結する。Source
dedupe_key: issue-refinement-loop-web-researcher-auth-retry
source_issue: 146
source_note: "2026-05-22 #146 refinement loop で web-researcher 初回 auth_error → retry 成功の事例を観測"
Activity
feat(#332): issue-refinement-loop に Product/Spec Kit routing gate を追加…
fix(#295): human review iter 2 (PR #388 4532431421) — enum 整合 / extra…
perf(#295): issue-refinement-loop の SubAgent spawn 上限を軽量化 — max_itera…
squne121 commentedon May 25, 2026
人間からのコメントです。
「.claude/skills/issue-refinement-loop/SKILL.md の Step 1b に「status: failed かつ failure_class: auth_error の場合は 1 回自動 retry し、再失敗時のみ human_escalation に進む」手順を追記する」とありますが、 issue-refinement-loop ではなく。 .claude/skills/gemini-cli-headless-delegation か .claude/agents/web-researcher.md で改善すべきことではないですか?
GeminiCLIが使えないのであればしょうがないから web-researcher.md が自身で調査するしかないですよね?
オーケストラレーターはオーケストレーションの責務に注力するため、可能な限り、作業に関するコンテクストを持ちたくないです。
web-researcher にに関するコンテクストの入出力も可能な限り、オーケストレーターを介さない形で実現したいです。
squne121 commentedon May 25, 2026
結論: 人間コメントの指摘が妥当です。#203 は現状のまま実装しない方がよいです。
#203 の本文は、変更対象を
.claude/skills/issue-refinement-loop/SKILL.mdに固定し、web-researcherとgemini-cli-headless-delegationの変更を Out of Scope にしています。これは、コメントの指摘どおり責務配置が逆です。issue-refinement-loopは外部仕様の検証が必要なときにweb-researcherを呼び、返ってきたWEB_RESEARCH_RESULT_V1のstatus/failure_class/verification_routeを見てルーティングする役です。外部調査そのもの、Gemini CLI の失敗復旧、fallback 調査の選択は持たせない方がよいです。既存の責務表でも、web-researcherは外部仕様・CLI/API・公開ドキュメントの fact-check 担当、orchestrator は SubAgent 呼び出し・結果統合・mutation 判断担当になっています。([GitHub]1)web-researcher.mdにはすでに「Gemini 経由を優先し、利用不可なら SubAgent 自身がdirect_web/direct_clifallback を実行する」とあります。したがって、auth_errorに対して orchestrator が retry_count を持つ設計ではなく、gemini-cli-headless-delegation側で generic retry、web-researcher側で調査 fallback を完結させるのが自然です。投稿用コメント案:
squne121 commentedon May 25, 2026
判定
No-Go as-is / #203 はそのまま実装に回さない方がよいです。
結論として、#203 は 「issue-refinement-loop に retry 手順を足す Issue」ではなく、#247 に吸収または #247 方針に沿って reframe すべきです。
#203 の現スコープは
.claude/skills/issue-refinement-loop/SKILL.mdにauth_error時の 1 retry とLOOP_STATE.web_research.retry_countを足す設計ですが、これは人間コメントが指摘している通り、責務配置が悪いです。web 調査の retry / fallback / auth failure 分類はweb-researcherまたはgemini-cli-headless-delegation側の producer contract に置くべきです。関連 Issue / PR から見た位置づけ
#203 は「Step 1b の
WEB_RESEARCH_RESULT_V1 handlingに auth_error retry を足す」Issueです。しかし、現在のissue-refinement-loopにはすでに責務境界表があり、main thread / orchestrator は SubAgent 呼び出し・結果統合・final classification・mutation 判断を担う一方、web 事実確認はweb-researcherの責務とされています。さらに PR #130 は、すでに
WEB_RESEARCH_RESULT_V1にfailure_class/verification_routeを追加し、auth_error | capability_unavailableの場合はweb-researcher自身がdirect_web/direct_clifallback を試みる設計を merge 済みです。つまり #203 の「orchestrator が auth_error を見て再度 web-researcher を呼ぶ」は、既存の producer-side fallback 設計と重複します。#247 はより正しい上位 Issue です。そこでは
.claude/agents/web-researcher.mdまたは.claude/skills/gemini-cli-headless-delegation/SKILL.mdに retry / fallback 戦略を置き、issue-refinement-loopは cross-link 更新に留めるスコープになっています。これは人間コメントの方向性と一致します。PR #388 は #203 の統合点を予約しただけで、#203 の実装は含んでいません。PR 本文でも「#203 retry 拡張点を破壊していない」「Step 1b に integration point コメントを追加」としており、実装判断は未解決です。
Blocker 1: orchestrator に auth / fallback の作業文脈を持たせている
#203 は
issue-refinement-loopにauth_errorretry を持たせますが、これはオーケストレーターを太らせます。issue-refinement-loopは「web_research_policy.required なら web-researcher を呼び、返ってきた final result を見て Step 2 / human_escalation を判断する」層に留めるべきです。現行 Step 1b も、結果受信後はstatus == ok / inconclusive / failedを見て routing する構造です。Claude Code の SubAgent 設計上も、SubAgent は独自 context / custom prompt / tool access / permissions を持ち、main conversation の context 汚染を避けるために使うものです。したがって、Gemini CLI 認証失敗時の retry / fallback のような実作業文脈は
web-researcher側に閉じる方が設計思想に合います。([Claude API Docs]1)Blocker 2: 既存
web-researcher.mdはすでに fallback を所有している現在の
web-researcher.mdは、grounded_researchが失敗した場合にauth_error | capability_unavailableならdirect_webまたはdirect_cliの read-only fallback を試みる、と明記しています。fallback 成功時はstatus: okとverification_route: direct_web | direct_cliを返します。そのため、
web-researcherが最終的にstatus: failed / failure_class: auth_errorを返したなら、意味は次のどちらかです。この状態で orchestrator がもう一度同じ SubAgent を叩くのは、producer contract の破綻を caller 側で隠す形になります。
Blocker 3:
WEB_RESEARCH_RESULT_V1の schema が producer / consumer 間でズレているissue-refinement-loop側の schema はstatus: ok | inconclusive | failed、claim verdict はsupported | contradicted | inconclusiveです。一方、
web-researcher.md側の schema はstatus: ok | failed | insufficient_context、claim verdict はsupported | contradicted | unknownです。#203 は
retry_countを足す前に、この schema 不整合を解決すべきです。retry を追加しても、insufficient_context/unknownが consumer 側でどう扱われるかが未定義のままなら、Step 1b の routing は不安定です。Blocker 4:
auth_errorは一律 transient ではないGemini CLI の公式 docs では、headless mode は既存 cached credentials があればそれを使う一方、そうでなければ Gemini API key または Vertex AI などの env var 認証設定が必要です。また Sign in with Google はブラウザ連携とローカル credential cache を前提にします。([Gemini CLI]2)
つまり
auth_errorには少なくとも次が混ざります。この分類を
issue-refinement-loopがfailure_class: auth_errorだけで 1 retry するのは粗すぎます。PR #278 でも、failure taxonomy / retry policy はauth_missing_or_expired、permission_denied、billing_or_region_unavailable、retryable なquota_or_rate_limited/transient_api_errorなどへ分ける方向で整理されています。Blocker 5: Gemini CLI / Antigravity 移行リスクを orchestrator に漏らしている
Gemini CLI 公式 docs には、未課金 tier / Google One users 向けに Gemini CLI が Antigravity CLI に置き換わる旨の告知が出ています。
web-researcher.md側にも Antigravity CLI 互換性ノートがあり、grounded_research対応確認までは同等動作を仮定しない、と書かれています。([Gemini CLI]2)この種の CLI 実装差分は、
gemini-cli-headless-delegationとweb-researcherの境界内に閉じるべきです。issue-refinement-loopにauth_errorretry を直接書くと、将来 Antigravity へ移行した際に orchestration layer まで修正対象になります。推奨方針
#203 は 単独実装せず、#247 に superseded / absorbed させるのが最もきれいです。
採るべき再設計は以下です。
#203 を残す場合の修正文案
タイトル案:
スコープ案:
Acceptance Criteria 案:
そのまま貼れる Issue コメント案
最終判断は、#203 は close または #247 へ吸収です。残すなら、
issue-refinement-loopの retry 実装 Issue ではなく、producer-side retry/fallback/schema-normalization Issue に全面的に書き換えるべきです。squne121 commentedon May 25, 2026
issue-refinement-loop: クローズ (2026-05-25T13:02:00Z)
docs(#247): address PR #403 reviewer blockers — remove #203 residue, …
docs: align web-researcher retry boundary (#247) (#403)
squne121 commentedon May 26, 2026
#394 による方針変更につき、本 Issue は superseded と判断します。orchestrator 側での transient auth_error retry は行わず、
web-researcherSubAgent が自律的に retry / fallback を管理する責務を持つように変更されました。squne121 commentedon May 27, 2026
CLOSE_DECISION_V1
squne121 commentedon May 27, 2026
CLOSE_DECISION_V1_CORRECTION
訂正理由: 前回コメントの
decision: supersededは正しい語彙だったが、フォーマットにgithub_state/github_state_reasonフィールドが欠けていた。auth_error retry は SubAgent-owned 設計に変更(approach changed to SubAgent-owned)。