Skip to content

実装: gemini-cli-headless-delegation に gh_commands + timeout_sec < 300 時の runtime warning を追加する #258

Open

Description

@squne121

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: code

Parent 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

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

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

  1. added
    enhancement
    phase/implementation
    agent/implementer
    on May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/implementerenhancementphase/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions