Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: none
goal_ref: "gh_commands + timeout_sec < 300 の組み合わせで grounded_research と同様の runtime warning が欠落しているため、github_research / local_asset_research / proposal_only プロファイルにも timeout 不足警告を追加し、呼び出し元が早期に気づけるようにする"
change_kind: codeParent Issue
なし(単独改善)
Parent Goal Ref
- Goal: なし(単独改善)
- Desired Destination: なし
Current Validated Scope
run_gemini_headless.pyのgh_commands+timeout_sec < 300時の runtime warning 追加(line 1214 のgrounded_research警告と同パターン)tests/test_run_gemini_headless.pyに対応する unit test 追加
Remaining Parent Gaps
なし
Outcome
.claude/skills/gemini-cli-headless-delegation/scripts/run_gemini_headless.py の github_research / local_asset_research / proposal_only プロファイルで gh_commands を指定かつ timeout_sec < 300 の場合、result.warnings に警告メッセージが追加され、tests/test_run_gemini_headless.py が全件 PASS している状態。
In Scope
run_gemini_headless.pyのrequest_warnings生成ブロック(line 1214 近傍)に、gh_commandsを含む 3 プロファイルでtimeout_sec < 300の場合の warning を追加するtests/test_run_gemini_headless.pyに warning が出力されること / 出力されないことの unit test を追加する
Out of Scope
SKILL.mdの記述変更(実装: gemini-cli-headless-delegation SKILL.md の timeout_sec 推奨追記と gh_commands 記述整合 #249 が担当)usage-contract.mdの変更grounded_researchの既存 warning ロジック変更DEFAULT_TIMEOUT_SEC(600)の変更preflight_gemini_headless.pyの変更
Acceptance Criteria
- AC1:
github_researchプロファイルでgh_commandsを含むリクエストにtimeout_sec: 120を指定した場合、result["warnings"]にgh_commands recommends timeout_sec >= 300を含むメッセージが追加される - AC2:
local_asset_researchプロファイルで同条件の場合、同様の warning が追加される - AC3:
proposal_onlyプロファイルで同条件の場合、同様の warning が追加される - AC4:
gh_commandsが空または未指定の場合、warning は追加されない - AC5:
timeout_sec >= 300の場合、warning は追加されない - AC6:
grounded_researchの既存 warning 動作が変わらない(regresion なし)
Verification Commands
# AC1-AC3: 各プロファイル + gh_commands + timeout_sec: 120 で warnings に追加される
python3 - <<'PY'
import subprocess, json, sys
result = subprocess.run(
["uv", "run", "pytest",
".claude/skills/gemini-cli-headless-delegation/tests/test_run_gemini_headless.py",
"-k", "timeout_warning_gh_commands",
"-v"],
capture_output=True, text=True
)
print(result.stdout[-3000:])
print(result.stderr[-1000:])
sys.exit(result.returncode)
PY
# AC4-AC6: no warning cases と grounded_research regression
- uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_run_gemini_headless.py -v
# Standard gates
- 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/scripts/run_gemini_headless.py.claude/skills/gemini-cli-headless-delegation/tests/test_run_gemini_headless.py
Runtime Verification Applicability
decision: not_applicable
reason: "VC に uv run pytest による unit test 実行を含む。warning 追加は run_gemini_headless.py の request_warnings 生成ブロックへの Python コード変更であり、ランタイム外部 API に依存しない。"Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
- Python / pytest
Scope Delta(任意)
N/A
Delivery Rule
1 Issue = 1 PR- 注意: gemini-cli-headless-delegation の導入と改善 #14(gemini-cli-headless-delegation の導入と改善)および 実装: gemini-cli-headless-delegation SKILL.md の timeout_sec 推奨追記と gh_commands 記述整合 #249(SKILL.md timeout_sec 推奨追記と gh_commands 記述整合)が同一 Allowed Path(
run_gemini_headless.pyは gemini-cli-headless-delegation の導入と改善 #14、SKILL.mdは 実装: gemini-cli-headless-delegation SKILL.md の timeout_sec 推奨追記と gh_commands 記述整合 #249)を含む。着手前に両 Issue の open/close 状況を確認すること。コンフリクトリスクがある場合はDepends on #14 mergeとして直列依存を設定する。
Background
出典: Issue #249 refinement-loop (2026-05-23) の anchor comment(OWNER による敵対的レビュー「品質優先なら、runtime warning まで入れる」)。
run_gemini_headless.py の line 1214 には grounded_research プロファイルで timeout_sec < 300 の場合に request_warnings へ警告を追加する実装が既に存在する。しかし github_research / local_asset_research / proposal_only プロファイルで gh_commands を指定した場合の同様の warning が欠落している。
gh_commands は wrapper が Gemini 実行前に subprocess.run(timeout=30) で順次実行し、その結果を inline_context に prepend する。そのため複数 gh_commands を含む場合や大きな結果を返すコマンドでは wall-clock 時間が増加する。timeout_sec: 120 では不足しやすく、timeout_sec: 300+ を推奨している(#249 で SKILL.md に明記)。
実装案(anchor comment より):
gh_commands = request.get("gh_commands")
if (
tool_profile in {GITHUB_RESEARCH_PROFILE, LOCAL_ASSET_RESEARCH_PROFILE, PROPOSAL_ONLY_PROFILE}
and isinstance(gh_commands, list)
and gh_commands
and isinstance(_timeout_raw, (int, float))
and _timeout_raw < 300
):
request_warnings.append(
f"{tool_profile} with gh_commands recommends timeout_sec >= 300 "
f"(got {_timeout_raw}); gh_commands are pre-executed and prepended to inline_context"
)Refs #249(SKILL.md docs-only 対応), #87(timeout 事象発見 Issue), #14(同一ファイル含む open Issue)
Source
dedupe_key: gemini-cli-headless-delegation-runtime-timeout-warning-gh-commands
source_issue: 249
source_url: https://github.com/squne121/loop-protocol/issues/249#issuecomment-4524192530
materialized_by: issue-refinement-loop (2026-05-23)
Activity