Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: none
goal_ref: "gemini-cli-headless-delegation の github_research + gh_commands リクエストで 120s タイムアウトが発生した実績を受け、SKILL.md のリクエスト JSON 早見表の (1) timeout_sec 行に github_research / local_asset_research / proposal_only + gh_commands 使用時の timeout_sec: 300+ 推奨と wall-clock 区別を追記し、(2) gh_commands 行を usage-contract.md と整合させて実装済み/非対応 profile を正しく記載し、呼び出し元が適切な timeout を設定できるようにする"
change_kind: docs
allowed_paths:
- .claude/skills/gemini-cli-headless-delegation/SKILL.md
acceptance_criteria_count: 4
verification_kind: deterministicParent Issue
なし(単独改善)
Parent Goal Ref
- Goal: なし(単独改善)
- Desired Destination: なし
Current Validated Scope
.claude/skills/gemini-cli-headless-delegation/SKILL.mdリクエスト JSON 早見表のtimeout_sec行にgithub_research / local_asset_research / proposal_only + gh_commands使用時のtimeout_sec: 300+推奨を追記する
Remaining Parent Gaps
なし
Outcome
.claude/skills/gemini-cli-headless-delegation/SKILL.md のリクエスト JSON 早見表で
(1) timeout_sec 行に github_research / local_asset_research / proposal_only + gh_commands 使用時の timeout_sec: 300+ 推奨と、timeout_sec が Gemini CLI 実行フェーズ中心の timeout でありwrapper 全体の wall-clock 予算ではない点が明記され、
(2) gh_commands 行が usage-contract.md と整合し、実装済み profile (github_research / local_asset_research / proposal_only) と非対応 profile (no_tools / grounded_research) が正しく記載されている。
かつ AC grep VC が全件 PASS している。
In Scope
.claude/skills/gemini-cli-headless-delegation/SKILL.mdのtimeout_sec行(リクエスト JSON 早見表)へのgithub_research / local_asset_research / proposal_only + gh_commands時のtimeout_sec: 300+推奨追記- 必要に応じて Core Rules の
github_researchルール行への同旨の記述追加 gh_commands行をusage-contract.mdと整合させ、実装済み profile (github_research/local_asset_research/proposal_only) と非対応 profile (no_tools/grounded_research) を正しく記載する
Out of Scope
run_gemini_headless.pyへのタイムアウト強制ロジックの実装run_gemini_headless.pyへの runtime warning ロジック実装(別 Issue として追跡)github_researchプロファイル自体のリファクタgrounded_researchの timeout 推奨変更(既に 300s 推奨記載済み)references/usage-contract.md等の参照ファイル変更 (既存)
Acceptance Criteria
- AC1:
SKILL.mdのリクエスト JSON 早見表timeout_sec行に、github_research/local_asset_research/proposal_only+gh_commands使用時はtimeout_sec: 300+推奨であることが明記されている - AC2: 同じ記述に、
gh_commands事前実行・inline_contextprepend・GitHub API レイテンシ・prompt 増加が timeout 不足の理由として明記されている - AC3:
timeout_secは wrapper 全体の wall-clock 予算ではなく、Gemini CLI 実行フェーズ中心の timeout であり、gh_commands実行時間は別途 wall-clock 余裕に含める必要があることが明記されている - AC4:
SKILL.mdのgh_commands行がusage-contract.mdと整合し、実装済み profile がgithub_research/local_asset_research/proposal_only、非対応 profile がno_tools/grounded_researchと記載されている
Verification Commands
# AC1: timeout_sec 行に github_research/local_asset_research/proposal_only + gh_commands 時の 300+ 推奨が明記
# AC2: gh_commands 事前実行・inline_context prepend・GitHub API レイテンシ・prompt 増加が理由として明記
# AC3: timeout_sec が Gemini CLI 実行フェーズ中心であり wrapper 全体 wall-clock 予算とは別である旨が明記
python3 - <<'PY'
from pathlib import Path
p = Path(".claude/skills/gemini-cli-headless-delegation/SKILL.md")
text = p.read_text(encoding="utf-8")
row = next(line for line in text.splitlines() if line.startswith("| `timeout_sec` "))
required = [
"github_research",
"local_asset_research",
"proposal_only",
"gh_commands",
"300",
"inline_context",
"prepend",
"wall-clock",
]
missing = [s for s in required if s not in row]
assert not missing, f"timeout_sec row missing: {missing}"
print("PASS: timeout_sec row is explicit enough")
PY
# AC4: gh_commands 行の実装済み/非対応 profile 整合
python3 - <<'PY'
from pathlib import Path
p = Path(".claude/skills/gemini-cli-headless-delegation/SKILL.md")
text = p.read_text(encoding="utf-8")
row = next(line for line in text.splitlines() if line.startswith("| `gh_commands` "))
required = ["github_research", "local_asset_research", "proposal_only", "no_tools", "grounded_research", "usage-contract.md"]
missing = [s for s in required if s not in row]
assert not missing, f"gh_commands row missing: {missing}"
print("PASS: gh_commands row aligns with usage-contract")
PY
- pnpm typecheck
- pnpm lint
- pnpm test
- pnpm build
- uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/Allowed Paths
.claude/skills/gemini-cli-headless-delegation/SKILL.md
Runtime Verification Applicability
decision: not_applicable
reason: "docs-only change。追加する記述は rg grep で決定論的に検証可能であり、ランタイム動作の実装を含まない。"Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
なし
Scope Delta(任意)
N/A
Delivery Rule
1 Issue = 1 PR- 注意: gemini-cli-headless-delegation の導入と改善 #14(gemini-cli-headless-delegation の導入と改善)が同一 Allowed Path(
SKILL.md)を含む。並行実装時のマージコンフリクトを避けるため、着手前に gemini-cli-headless-delegation の導入と改善 #14 の open/close 状況を確認すること。コンフリクトリスクがある場合はDepends on #14 mergeとして直列依存を設定する。
Background
出典: Issue #87 refinement-loop(2026-05-23)中の gemini-cli-headless-delegation 実行ログ。
github_research + gh_commands を含むリクエストを timeout_sec: 120 で実行したところ、120s でタイムアウトした(gh_commands を 2 件含む request)。grounded_research には「300 秒以上を推奨」の記述が SKILL.md:40 に存在するが、github_research + gh_commands への同様の推奨が欠落していた。
gh_commands は wrapper が事前実行し結果を inline_context に prepend するため、gh issue list の API レイテンシ + prepend 処理で総実行時間が増加する。特に複数 gh_commands を含む場合や大きな結果を返すコマンドでは 120s 以上かかる可能性がある。
Refs #87(発見 Issue), #14(関連 Allowed Path)
Source
dedupe_key: gemini-github-research-gh-commands-timeout-recommendation
source_issue: 87
source_url: https://github.com/squne121/loop-protocol/issues/87#issuecomment-4523880408
materialized_by: issue-refinement-loop (2026-05-23)
Activity
squne121 commentedon May 23, 2026
結論
#249 は単独の docs-only PR としては狭すぎます。類似Issueをまとめるなら、推奨単位は次です。
推奨PR単位:
docs(gemini-cli-headless-delegation): align timeout guidance and gh_commands contractClose:
#249Refs:
#14,#87,#104,#81基本方針: #14 全体は閉じない。#14 のうち、同一
SKILL.mdに関係する「gh_commands / timeout / 429・fallback 記述整合」の小片だけを先に吸収する。#249 は
github_research + gh_commandsでtimeout_sec: 120が実績上不足したため、SKILL.mdにtimeout_sec: 300+推奨を追記する Issue です。Allowed Path はSKILL.mdのみで、実装ロジック変更は Out of Scope です。 ただし #14 も同じgemini-cli-headless-delegation/SKILL.mdを含む open Issue で、429/quota/fallback、transport、preflight、post_to_issue_url境界など同じ配布物の契約整備を扱っています。敵対的レビュー
Blocker 1:
timeout_sec: 300+文言だけでは実際の wall-clock timeout を説明できていない現行
run_gemini_headless.pyはgh_commandsを Gemini 実行前にsubprocess.run(... timeout=30)で順次実行し、その後にtimeout_secを Gemini CLI の subprocess timeout として使っています。つまりtimeout_secは「wrapper 全体の総予算」ではなく、少なくとも実装上は「Gemini CLI 実行フェーズの timeout」として作用します。 Python のsubprocess.run(timeout=...)も、指定した child process 単位で timeout を扱い、期限超過時にその child process を kill します。(Python documentation)したがって #249 の本文にある「
gh_commands事前実行・inline_contextprepend で追加遅延があるからtimeout_sec: 300+」という説明は半分だけ正しいです。より正確には、timeout_secとは別に、gh_commands件数 × 30 秒 + retry/backoff + model chain の wall-clock 余裕が必要です。Blocker 2:
SKILL.mdとusage-contract.mdのgh_commands実装状況が矛盾している現行
SKILL.mdのgh_commands行は、github_researchのみ完全実装済みで、local_asset_research/proposal_onlyは設計済み・別Issue実装と読める記述になっています。 しかしusage-contract.mdでは、github_research、local_asset_research、proposal_onlyのgh_commandsは完全実装済みとされ、no_tools/grounded_researchは非対応と整理されています。#249 で
timeout_sec行だけを直すと、この隣接する契約ズレが残ります。SKILL.mdは呼び出し側が最初に見る早見表なので、ここを放置すると AI エージェントが古い前提で request を作ります。High 1: #249 の VC は false pass しやすい
#249 の VC は
github_research.*gh_commands.*300系の grep で、表のtimeout_sec行に正しく入ったか、Core Rules のどこに入ったか、timeout_secの意味が正確に説明されたかを検証できません。最低でも section-anchored VC にして、
リクエスト JSON 早見表のtimeout_sec行、およびCore Rulesのgh_commands近傍を個別に検証するべきです。High 2: #104 の Antigravity 移行と衝突しない表現にする必要がある
#104 では、Gemini CLI から Antigravity CLI への段階移行が parent tracker 化され、初期
agyprovider 対応はno_tools/proposal_onlyに限定し、github_researchなどは後続扱いとされています。 公式 Gemini CLI docs でも、unpaid tier / Google One ユーザー向け Gemini CLI は Antigravity CLI に置換される旨が案内されています。(Gemini CLI)そのため #249 の修正は「Gemini CLI 固有の新機能追加」ではなく、現行 wrapper contract の運用注意・バグフィックスとして書くべきです。これは #104 の「Gemini CLI 新機能 freeze」と矛盾しません。
Medium:
gh apiGET-only 契約は正しいが、docs 側で理由を短く補強するとよい現行実装は
gh apiの-f/-F/--inputを read-only 経路から弾いています。これは GitHub CLI 公式仕様上、field parameter を追加すると既定 method が POST に切り替わり、GET query にするには--method GETが必要だから妥当です。(GitHub CLI)timeout_secとは別件ですが、gh_commands近傍を触るなら「gh apiは GET-only、-f/-Fは POST 化し得るため禁止/制御」という理由を 1 行だけ明記すると、将来の回帰を減らせます。まとめて実装するなら、この範囲が妥当
扱い | Issue / PR | 判断 -- | -- | -- Close | #249 | 主対象。timeout guidance を修正する Refs | #14 | 同一 SKILL.md の契約整合。全部は閉じない Refs | #87 | #249 の発見元。timeout 事象の背景として参照 Refs | #104 | Antigravity 移行と Gemini CLI freeze 方針に抵触しないことを確認 Refs | PR #81 | 外部 CLI transport の過大安全主張・契約境界の教訓として参照。PR #81 は ACP transport で境界設計と runtime evidence を #112/#113 に分けた経緯があります。 Do not close | #104 | parent tracker。#249 の修正で閉じる対象ではない Do not bundle | #112 / #113 | ACP safety / runtime evidence。timeout docs と別スコープ推奨パッチ方針
最小修正、docs-only
SKILL.mdのtimeout_sec行を次の意味にする。さらに
gh_commands行をusage-contract.mdと揃える。品質優先なら、runtime warning まで入れる
#249 の現契約は docs-only ですが、実効性を上げるなら Allowed Paths を広げて
run_gemini_headless.pyと tests も触るべきです。追加ロジックの趣旨:
これは #249 の Out of Scope を超えるため、やるなら #249 本文を更新して
Allowed Pathsに以下を追加します。修正版 AC / VC 案
SKILL.mdのリクエスト JSON 早見表timeout_sec行に、github_research/local_asset_research/proposal_only+gh_commands使用時はtimeout_sec: 300+推奨であることが明記されているgh_commands事前実行・inline_contextprepend・GitHub API レイテンシ・prompt 増加が timeout 不足の理由として明記されているtimeout_secは wrapper 全体の wall-clock 予算ではなく、Gemini CLI 実行フェーズ中心の timeout であり、gh_commands実行時間は別途 wall-clock 余裕に含める必要があることが明記されている[ ] AC4:
SKILL.mdのgh_commands行がusage-contract.mdと整合し、実装済み profile がgithub_research/local_asset_research/proposal_only、非対応 profile がno_tools/grounded_researchと記載されている実装指示として使うなら
そのまま AI エージェントへ渡すなら、こう書くのが安全です。
timeout_sec行にgithub_research/local_asset_research/proposal_only+gh_commands使用時のtimeout_sec: 300+推奨を追加gh_commands事前実行、inline_contextprepend、GitHub API レイテンシ、prompt 増加を明記timeout_secが wrapper 全体 wall-clock ではなく Gemini CLI 実行フェーズ中心である点を明記gh_commands行をusage-contract.mdと整合させ、実装済み profile / 非対応 profile を正しく更新#104 の Gemini CLI freeze と衝突しないよう、新機能追加ではなく現行 contract の docs 修正として扱う
この束ね方なら、#249 の実害を直しつつ、#14 の大きすぎるスコープに飲み込まれず、#104 の Antigravity 移行とも矛盾しません。
## 結論#249 は単独の docs-only PR としては狭すぎます。類似Issueをまとめるなら、推奨単位は次です。
推奨PR単位:
docs(gemini-cli-headless-delegation): align timeout guidance and gh_commands contractClose:
#249Refs:
#14,#87,#104,#81基本方針: #14 全体は閉じない。#14 のうち、同一
SKILL.mdに関係する「gh_commands / timeout / 429・fallback 記述整合」の小片だけを先に吸収する。#249 は
github_research + gh_commandsでtimeout_sec: 120が実績上不足したため、SKILL.mdにtimeout_sec: 300+推奨を追記する Issue です。Allowed Path はSKILL.mdのみで、実装ロジック変更は Out of Scope です。 ただし #14 も同じgemini-cli-headless-delegation/SKILL.mdを含む open Issue で、429/quota/fallback、transport、preflight、post_to_issue_url境界など同じ配布物の契約整備を扱っています。敵対的レビュー
Blocker 1:
timeout_sec: 300+文言だけでは実際の wall-clock timeout を説明できていない現行
run_gemini_headless.pyはgh_commandsを Gemini 実行前にsubprocess.run(... timeout=30)で順次実行し、その後にtimeout_secを Gemini CLI の subprocess timeout として使っています。つまりtimeout_secは「wrapper 全体の総予算」ではなく、少なくとも実装上は「Gemini CLI 実行フェーズの timeout」として作用します。 Python のsubprocess.run(timeout=...)も、指定した child process 単位で timeout を扱い、期限超過時にその child process を kill します。([Python documentation]1)したがって #249 の本文にある「
gh_commands事前実行・inline_contextprepend で追加遅延があるからtimeout_sec: 300+」という説明は半分だけ正しいです。より正確には、timeout_secとは別に、gh_commands件数 × 30 秒 + retry/backoff + model chain の wall-clock 余裕が必要です。Blocker 2:
SKILL.mdとusage-contract.mdのgh_commands実装状況が矛盾している現行
SKILL.mdのgh_commands行は、github_researchのみ完全実装済みで、local_asset_research/proposal_onlyは設計済み・別Issue実装と読める記述になっています。 しかしusage-contract.mdでは、github_research、local_asset_research、proposal_onlyのgh_commandsは完全実装済みとされ、no_tools/grounded_researchは非対応と整理されています。#249 で
timeout_sec行だけを直すと、この隣接する契約ズレが残ります。SKILL.mdは呼び出し側が最初に見る早見表なので、ここを放置すると AI エージェントが古い前提で request を作ります。High 1: #249 の VC は false pass しやすい
#249 の VC は
github_research.*gh_commands.*300系の grep で、表のtimeout_sec行に正しく入ったか、Core Rules のどこに入ったか、timeout_secの意味が正確に説明されたかを検証できません。最低でも section-anchored VC にして、
リクエスト JSON 早見表のtimeout_sec行、およびCore Rulesのgh_commands近傍を個別に検証するべきです。High 2: #104 の Antigravity 移行と衝突しない表現にする必要がある
#104 では、Gemini CLI から Antigravity CLI への段階移行が parent tracker 化され、初期
agyprovider 対応はno_tools/proposal_onlyに限定し、github_researchなどは後続扱いとされています。 公式 Gemini CLI docs でも、unpaid tier / Google One ユーザー向け Gemini CLI は Antigravity CLI に置換される旨が案内されています。(Gemini CLI)そのため #249 の修正は「Gemini CLI 固有の新機能追加」ではなく、現行 wrapper contract の運用注意・バグフィックスとして書くべきです。これは #104 の「Gemini CLI 新機能 freeze」と矛盾しません。
Medium:
gh apiGET-only 契約は正しいが、docs 側で理由を短く補強するとよい現行実装は
gh apiの-f/-F/--inputを read-only 経路から弾いています。これは GitHub CLI 公式仕様上、field parameter を追加すると既定 method が POST に切り替わり、GET query にするには--method GETが必要だから妥当です。(GitHub CLI)timeout_secとは別件ですが、gh_commands近傍を触るなら「gh apiは GET-only、-f/-Fは POST 化し得るため禁止/制御」という理由を 1 行だけ明記すると、将来の回帰を減らせます。まとめて実装するなら、この範囲が妥当
SKILL.mdの契約整合。全部は閉じない推奨パッチ方針
最小修正、docs-only
SKILL.mdのtimeout_sec行を次の意味にする。さらに
gh_commands行をusage-contract.mdと揃える。品質優先なら、runtime warning まで入れる
#249 の現契約は docs-only ですが、実効性を上げるなら Allowed Paths を広げて
run_gemini_headless.pyと tests も触るべきです。追加ロジックの趣旨:
これは #249 の Out of Scope を超えるため、やるなら #249 本文を更新して
Allowed Pathsに以下を追加します。修正版 AC / VC 案
実装指示として使うなら
そのまま AI エージェントへ渡すなら、こう書くのが安全です。
この束ね方なら、#249 の実害を直しつつ、#14 の大きすぎるスコープに飲み込まれず、#104 の Antigravity 移行とも矛盾しません。
[-]実装: gemini-cli-headless-delegation SKILL.md に github_research + gh_commands 使用時の timeout_sec: 300+ 推奨を追記する[/-][+]実装: gemini-cli-headless-delegation SKILL.md の timeout_sec 推奨追記と gh_commands 記述整合[/+]squne121 commentedon May 23, 2026
issue-refinement-loop: 本文更新 (iteration 0)
変更概要:
事実確認結果:
anchor_comment: #249 (comment)
squne121 commentedon May 23, 2026
issue-refinement-loop: VC フォーマット修正 (iteration 1)
-ハイフンプレフィックスを追加# AC1-AC3:範囲アンカーを# AC1:/# AC2:/# AC3:個別アンカーに分割squne121 commentedon May 23, 2026
issue-refinement-loop: 完了 (2026-05-23T05:00:00Z)
改善履歴
iteration 0 (anchor comment feedback 反映):
iteration 1 (VC フォーマット修正):
-ハイフンプレフィックスを追加# AC1-AC3:範囲アンカーを# AC1:/# AC2:/# AC3:個別アンカーに分割事実確認結果 (codebase-investigator + web-researcher)
次アクション
issue-contract-reviewを実行して実装着手 preflight を完了させてくださいsqune121 commentedon May 23, 2026
follow-up Issue 起票完了
refinement-loop 終了後の派生改善候補を起票しました:
squne121 commentedon May 23, 2026
Contract Snapshot (2026-05-23T05:30:00Z)
SKILL.mdリクエスト JSON 早見表のtimeout_sec行にgithub_research/local_asset_research/proposal_only+gh_commands使用時のtimeout_sec: 300+推奨と wall-clock 区別を追記し、gh_commands行をusage-contract.mdと整合させる.claude/skills/gemini-cli-headless-delegation/SKILL.md.claude/worktrees/issue-249-gemini-cli-headless-delegation-skill-md-worktree-issue-249-gemini-cli-headless-delegation-skill-md-squne121 commentedon May 23, 2026
implement-issue: 実装完了 (2026-05-23T05:11:57Z)
.claude/worktrees/issue-249-gemini-cli-headless-delegation-skill-md-worktree-issue-249-gemini-cli-headless-delegation-skill-md-squne121 commentedon May 23, 2026
impl-review-loop: 完了 (2026-05-23T05:35:00Z)
fix(#249): timeout_sec warning を grounded_research 限定に明確化し Core Rules…
squne121 commentedon May 23, 2026
impl-review-loop: 完了 (2026-05-23T06:00:00Z)
docs(#249): SKILL.md の timeout_sec 推奨追記と gh_commands 記述整合 (#262)
squne121 commentedon May 23, 2026
post-merge-cleanup: 完了 (2026-05-23T06:10:00Z)
実施内容
.claude/worktrees/issue-249-gemini-cli-headless-delegation-skill-md-削除済みworktree-issue-249-gemini-cli-headless-delegation-skill-md-削除済み