Repository navigation
test: AGY provider fixture 検証と empty-stdout warning 回帰テストを追加する - #1345
Conversation
golden fixture agy_no_tools_smoke_request.json / agy_proposal_only_smoke_request.json に schema: delegation_request_v1 を補い、_validate_agy_request() で実際に検証する test_golden_tasks.py のテストと、_run_agy をモックした run_delegation() の エンドツーエンド結果検証テストを追加する。 test_agy_provider.py には _normalize_agy_result() の non-CI / CI 両分岐で warnings[0] の先頭トークンが failure_class と整合することを確認する回帰テストを 追加する(本体修正自体は #1331 で実装済みのため、本 PR は回帰テスト追加のみ)。 Issue #1274 の AC1/AC2 は validate_request() を参照しているが、provider=agy は run_delegation() の早期分岐で _validate_agy_request()(Gemini 用 validate_request() とは別のAGY専用最小契約)を使う設計のため、テストは _validate_agy_request() を 検証対象とする(Contract Review コメントで確認済みの読み替え)。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Preview URL✅ verified live assets: https://squne121.github.io/loop-protocol/pr-1345/ The preview will be removed when this PR is closed. |
TEST_VERDICT:
result: PASS
mergeable: MERGEABLE
merge_state_status: UNSTABLE
branch_behind_main: false
baseline_only: false
verification_commands_pass: 6
verification_commands_fail: 0
verification_skipped_count: 0
runtime_ac_results: []検証結果レポートIssue #1274: AGY provider fixture 検証と empty-stdout warning 回帰テストを追加する
総合判定
Allowed Paths 検証全ての変更ファイルが Allowed Paths 内に収まっていることを確認しました:
PR 状態
|
|
test allowed check |
|
test without backtick yaml fence |
Verdict: APPROVEMergeability
Evidence Check
Blockers
Non-blockers
LOOP_VERDICT_V2(YAML — code fence をレンダリングできないため indent 表記) |
|
test |
Verdict: APPROVE前回からの差分確認
Mergeability
Evidence Check
Blockers
解消事項
Non-blockers(follow-up 対象・merge を妨げない)
LOOP_VERDICT_V2verdict: APPROVE
|
判定**REQUEST_CHANGES(敵対的レビュー基準)**です。 ただし、AGY は「コードベース理解・編集・コマンド実行・tool calling」を持つ agent CLI であり、公式 README も autonomous code execution / data exfiltration / prompt injection / supply chain risks を明示しています。したがって、 Blocker 1: AC3 の E2E テストが「結果の表面」だけで、provider isolation と prompt redaction を固定していない追加された しかし runtime 側では、実行コマンドは さらに、#1274 の事前 Contract Review コメントでも、AC3 では 修正要求: 2つの fixture E2E テストに、最低限これを足してください。 def _fail_gemini(*args, **kwargs):
raise AssertionError("_run_gemini must not be called for provider=agy")
seen: dict[str, object] = {}
def _fake_run_agy(prompt, timeout_sec):
seen["prompt"] = prompt
seen["timeout_sec"] = timeout_sec
return _agy_completed_ok()
monkeypatch.setattr(module, "_run_gemini", _fail_gemini)
monkeypatch.setattr(module, "_run_agy", _fake_run_agy)
result = module.run_delegation(request, request_path=fixture_path)
assert seen["prompt"] == request["prompt"]
assert result["raw_command"] == ["agy", "-p", "<prompt>"]
assert request["prompt"] not in json.dumps(result, ensure_ascii=False)これにより、PRが「AGY branch へ入ったように見える」だけでなく、Gemini path 非混入・実 prompt 非露出・fixture prompt が AGY に渡ることまで固定できます。 Blocker 2: non-CI の「CI unset」ケースが直接テストされていない
実装上は 修正例: def test_agy_empty_stdout_warning_matches_failure_class_when_ci_unset(monkeypatch):
monkeypatch.delenv("CI", raising=False)
completed = _make_completed(0, stdout="")
result = rgh._normalize_agy_result(completed, tool_profile="no_tools", requested_model=None)
assert result["failure_class"] == "agy_empty_stdout"
assert result["warnings"][0].startswith("agy_empty_stdout")良い点AC1 / AC2 の empty stdout の回帰テストも方向性は正しいです。runtime は empty stdout で non-CI なら PR #1331 で本体側の Non-blocker既存レビューでは最終的に 最小修正条件
この2点が入れば、APPROVE 相当にできます。 |
敵対的レビュー(#1345 REQUEST_CHANGES)のBlocker 2件を解消する。 - test_golden_tasks.py の2つのAGY fixture E2Eテストで、_run_gemini が provider=agy パスで呼ばれないこと、_run_agy に実 prompt が渡ること、 raw_command がsanitizeされ実promptを含まないこと、結果全体のJSON化 にも実promptが露出しないことを固定する。 - test_agy_provider.py に CI 環境変数が未設定のケースを追加し、 空文字 CI="" のケースと区別してカバーする。 Closes #1274
TEST_VERDICT:
result: PASS
mergeable: MERGEABLE
merge_state_status: BLOCKED
branch_behind_main: false
baseline_only: false
verification_commands_pass: 6
verification_commands_fail: 0
verification_skipped_count: 0
runtime_ac_results:
- ac: AC1
command: "uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_golden_tasks.py::test_agy_no_tools_fixture_validates -q"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: not_required
human_review_required: false
stop_condition_triggered: false
notes: "test_agy_no_tools_fixture_validates validates agy_no_tools_smoke_request.json with _validate_agy_request()"
- ac: AC2
command: "uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_golden_tasks.py::test_agy_proposal_only_fixture_validates -q"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: not_required
human_review_required: false
stop_condition_triggered: false
notes: "test_agy_proposal_only_fixture_validates validates agy_proposal_only_smoke_request.json with _validate_agy_request()"
- ac: AC3
command: "uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_golden_tasks.py::test_agy_no_tools_fixture_run_delegation_result_shape -q"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: not_required
human_review_required: false
stop_condition_triggered: false
notes: "test_agy_no_tools_fixture_run_delegation_result_shape validates run_delegation() result with mocked _run_agy"
- ac: AC4
command: "uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_agy_provider.py::test_agy_empty_stdout_warning_matches_failure_class -q"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: not_required
human_review_required: false
stop_condition_triggered: false
notes: "test_agy_empty_stdout_warning_matches_failure_class verifies non-CI branch warnings[0] matches agy_empty_stdout failure_class"
- ac: AC5
command: "uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_agy_provider.py::test_agy_empty_stdout_warning_matches_failure_class_in_ci -q"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: not_required
human_review_required: false
stop_condition_triggered: false
notes: "test_agy_empty_stdout_warning_matches_failure_class_in_ci verifies CI branch warnings[0] matches agy_output_missing failure_class"
- ac: AC6
command: "uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/ -q"
exit_code: 0
status: pass
fallback_detected: false
artifact_present: not_required
human_review_required: false
stop_condition_triggered: false
notes: "Full test suite: 656 passed (includes AC1-AC5 tests plus all existing tests)"SummaryAll 6 AC verification commands PASS. PR #1345 is mergeable (mergeStateStatus=BLOCKED is expected, likely due to required CI checks). Verification Results Table
Additional Fix_Delta TestsThe following tests added by fix_delta also PASS:
Allowed Paths ComplianceAll changes are within Allowed Paths:
Merge Status
|
|
test |
|
line1 |
|
blockers: []
|
|
reviewed_head_sha: "0c957d10dcfe56ada9c6570c2192585ec3dfb79f" |
|
result["raw_command"] equals the sanitized form (agy -p PLACEHOLDER) |
LOOP_VERDICT_V2verdict: APPROVE fix_delta 独立検証(squne121 敵対的レビュー Blocker 2件)commit 0c957d1 の diff を review_subagent が直接 git show で読み、以下を確認した(worker self-report には依拠していない)。
CI証跡
結論敵対的レビューの2 Blockerはいずれもfix_deltaで解消済み。CI全required checks green(head一致確認済み)。Allowed Paths遵守(4ファイルともIssue #1274 Allowed Paths内)。blockerなし。Draft PRだがskill定義上Draft自体はmerge_readyを妨げない。 |
CI log investigation (run 28757862903 / PR #1352, 28751177802 / PR #1349, 28749187051 / PR #1345) shows the index preview URL returning a sustained 404 for the entire previous 180s per-URL budget with no intervening 200 response, while the same repository's deploy-main job (same GitHub Pages Settings/Source) never exhibits this failure. This is consistent with GitHub Pages CDN propagation lag for freshly published pr-<n>/ subdirectories exceeding 180s on occasion, rather than a Pages Settings/Source misconfiguration (tracked separately in #1315). Bump the shared overall_deadline from 240s to 300s to give the index + asset checks more headroom within the new shared-budget model. Co-Authored-By: Claude Sonnet 5 <[email protected]>
* fix: deploy-pr preview asset liveness check retry/backoff/deadline (#1357) The `Verify preview assets are live` step in deploy-pages.yml failed intermittently with 404 timeouts unrelated to PR diff content (observed during PR #1349 review, also seen on PR #1274). This tunes the fetch_pages_url_with_bounded_retry polling logic: - Replace the fixed `sleep 5` retry interval with an exponential bounded backoff (initial_delay=2s, max_delay=20s, doubling per attempt). - Introduce a single overall_deadline shared across the index page and every asset URL, instead of each URL getting its own independent 180s budget that stacks with the number of assets checked. - Extend the retriable HTTP status set with 409 (Pages deployment conflict during a concurrent publish) and 425 (too early / origin not yet ready), with an inline comment documenting why each status is treated as transient. - Emit structured retry logs (label=preview-index|preview-asset, attempt=, elapsed=, next_sleep=) to make future flake investigation from CI logs tractable. deploy-main job logic and the gh-pages commit message string are untouched; only the deploy-pr job's live asset check step changed. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix: bump deploy-pr preview overall_deadline to 300s (#1357) CI log investigation (run 28757862903 / PR #1352, 28751177802 / PR #1349, 28749187051 / PR #1345) shows the index preview URL returning a sustained 404 for the entire previous 180s per-URL budget with no intervening 200 response, while the same repository's deploy-main job (same GitHub Pages Settings/Source) never exhibits this failure. This is consistent with GitHub Pages CDN propagation lag for freshly published pr-<n>/ subdirectories exceeding 180s on occasion, rather than a Pages Settings/Source misconfiguration (tracked separately in #1315). Bump the shared overall_deadline from 240s to 300s to give the index + asset checks more headroom within the new shared-budget model. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix: address REQUEST_CHANGES on deploy-pages.yml live check fix (#1357) - Blocker: overall_deadline を実際にhard deadlineにする。curl --max-time を 残り時間でcap(attempt_max_time)し、curl実行前に残り時間<=0ならエラーで 抜ける。retryのsleep前にも残り時間を再計算しnext_sleepをcapする。 - Major: retry対象statusのコメントをobserved/defensiveの区別に修正。 今回実観測されたのは404のみ。403/409/425等は今回未観測のdefensive retryと 明記(425文字列自体はAC7維持のため残す)。 - Minor: asset URL fetchにも ?cache_bust=${GITHUB_SHA} を追加し index/asset で診断の一貫性を揃える。 Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix: address low-risk items from adversarial review on #1358 - add timeout-minutes: 7 to the "Verify preview assets are live" step as a defense-in-depth guard against holding the shared deploy-pages concurrency group indefinitely - clear stale "${output}.tmp" before each curl attempt in fetch_pages_url_with_bounded_retry so a prior attempt's tmp content cannot leak into a later attempt's deadline-exceeded diagnostics - soften the retry-eligible status comment: it no longer implies a documented GitHub Pages/CDN transient-behavior contract; the non-404 codes are described as defensive-only and unobserved for #1357 Live-preview head-SHA verification is intentionally out of scope here and tracked as a separate follow-up issue per the review feedback. Closes #1357 --------- Co-authored-by: Claude Sonnet 5 <[email protected]>
Summary
Issue #1274 の対象である AGY provider 固有分岐のテスト密度を引き上げる。golden fixture agy_no_tools_smoke_request.json / agy_proposal_only_smoke_request.json に schema: delegation_request_v1 を補い、_validate_agy_request() で実際に検証するテストと、_run_agy をモックした run_delegation() のエンドツーエンド結果検証テストを追加する。 さらに test_agy_provider.py に _normalize_agy_result() の non-CI / CI 両分岐で warnings[0] の先頭トークンが failure_class と整合することを確認する回帰テストを追加する。
本 PR はテスト密度向上のみを目的とし、run_gemini_headless.py 本体のロジックは変更していない(_normalize_agy_result() の warnings/failure_class 整合修正自体は #1331 で実装済み)。 本 PR は Issue #1274 を Closes #1274 として解消する。
Contract Repair Note(Issue #1274 AC1/AC2 の読み替え)
Issue #1274 の AC1/AC2 は validate_request() を参照しているが、provider=agy は run_delegation() の早期分岐で _validate_agy_request()(Gemini 用フル request contract を検証する validate_request() とは別の、AGY prompt-first 最小契約)を使う設計になっている。 そのため本 PR のテストは _validate_agy_request() を検証対象とした(Issue #1274 の Contract Review コメントで確認済みの読み替え)。
受け入れ条件の達成状況
test_golden_tasks.py::test_agy_no_tools_fixture_validatesがagy_no_tools_smoke_request.jsonを_validate_agy_request()で検証しerrors == []を確認)test_golden_tasks.py::test_agy_proposal_only_fixture_validatesがagy_proposal_only_smoke_request.jsonを_validate_agy_request()で検証しerrors == []を確認)test_golden_tasks.py::test_agy_no_tools_fixture_run_delegation_result_shape/test_agy_proposal_only_fixture_run_delegation_result_shapeが_run_agyをモックしたrun_delegation()の結果ok=True/provider="agy"/safety_mode="degraded_wrapper_only"/transport="agy"を検証)test_agy_provider.py::test_agy_empty_stdout_warning_matches_failure_classが non-CI 分岐でwarnings[0]がagy_empty_stdoutで始まることを検証)test_agy_provider.py::test_agy_empty_stdout_warning_matches_failure_class_in_ciが CI 分岐でwarnings[0]がagy_output_missingで始まることを検証。Issue 実装: agent delegation の AGY provider 固有分岐に対するテスト密度を引き上げる #1274 の指定どおりtest_agy_provider.pyに追加、test_quota_fallback.pyの同種テストとの重複は Issue 実装: agent delegation の AGY provider 固有分岐に対するテスト密度を引き上げる #1274 スコープ通り意図的)uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/ -qが 655 件全 pass)検証コマンド結果
すべてローカルで実行し、以下の通り全件パスしたことを確認した。
uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_golden_tasks.py::test_agy_no_tools_fixture_validates -q→ PASSuv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_golden_tasks.py::test_agy_proposal_only_fixture_validates -q→ PASSuv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_golden_tasks.py::test_agy_no_tools_fixture_run_delegation_result_shape -q→ PASSuv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_agy_provider.py::test_agy_empty_stdout_warning_matches_failure_class -q→ PASSuv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_agy_provider.py::test_agy_empty_stdout_warning_matches_failure_class_in_ci -q→ PASSuv run pytest .claude/skills/gemini-cli-headless-delegation/tests/ -q→ 655 passed加えてリポジトリ標準 4 コマンドおよび model routing 回帰テストも全件パス:
Allowed Paths 遵守
変更ファイルは Issue #1274 の Allowed Paths 4 件と完全一致し、それ以外のファイルへの変更はない。
.claude/skills/gemini-cli-headless-delegation/tests/fixtures/agy_no_tools_smoke_request.json.claude/skills/gemini-cli-headless-delegation/tests/fixtures/agy_proposal_only_smoke_request.json.claude/skills/gemini-cli-headless-delegation/tests/test_golden_tasks.py.claude/skills/gemini-cli-headless-delegation/tests/test_agy_provider.py.claude/skills/gemini-cli-headless-delegation/scripts/run_gemini_headless.pyは Issue #1274 の Allowed Paths に含まれるが、本 PR では変更していない(_normalize_agy_result()の本体修正は #1331 で実装済みのため、本 PR は回帰テスト追加のみ)。Checks
検証コマンドをすべてローカルで実行し、以下の通り全件パスしたことを確認した(詳細は上記「検証コマンド結果」参照)。
Schema Change Applicability
Schema Consumer Inventory
本変更は schema 定義自体の変更ではなく、既存 fixture に既存 schema キーを補完しただけであるため、Consumer Inventory の記載は該当しない(Schema Change Applicability: not_schema_change のため対象外)。
Safety Claim Matrix
Notes