Repository navigation
fix(web-researcher): AGY-first と native Web fallback を有効化する - #2150
Conversation
Preview URLPreview removed (PR #2150 closed). |
hook validated かつ url-scan fallback だけの citation を grounded に 昇格させず、citation_candidates_unverified として web-researcher / native fallback 側の source-content 検証に委ねる。#2059
c42db31 to
6104aef
Compare
LOOP_VERDICTverdict: APPROVE
reviewed_head_sha: "2520b0af7431bfac8413da0741872331e4f66032"
blockers: []
warnings: []Issue #2059 の AC1-AC7 全てを PR body の達成状況セクションで確認し、 |
結論PR #2150 は現状 ただし current head 敵対的レビュー findings
設計面で評価できる部分もあります。過去 PR #403 では web-researcher 自身が direct Web fallback を所有する設計が既に存在しており、その後 AGY-only 化された経緯があります。 PR #2043 では、AGY の model-generated URL をそのまま grounded evidence とせず structured output / provenance correlation を強化しました。 今回はその安全性を捨てるのではなく、「AGY evidence が弱ければ AGY success と偽装せず、別 route の native Web で source を再取得する」方向なので、アーキテクチャとしては #2154 の実障害に対する自然な修正です。Google Antigravity の現行公式資料にも また、#2154 で問題になった merge 条件としては、P0-1 の schema classification/consumer migration、P0-2 の runtime verification contract 修復が必須です。 その後、AC6 を実態に合わせて分離し、Codex |
OWNER review (#5282726845, P0-1) 対応: verification_route / attempts[].route の値を agy_grounded_research から既存値 grounded_research へ戻し、native_web のみを additive に追加する minimal-compatibility 方針に修正する。Codex 側 web-researcher.toml には native_web の実体が Codex CLI の web_search tool であることを明記する (P1-4)。
…2164) (#2167) #2150 が web-researcher.md の fallback trigger OR-list に導入した `web_tool_call_count == 0` は、同ファイル内の diagnostics-only 制約 (#2059 AC3: provider telemetry counter は zero を含め routing/escalation の理由にしない)と自己矛盾していた。fallback trigger 条件から該当節を 削除し、正当な evidence-quality/failure-classification 条件のみを残す。 test_agent_contracts.py の test_provider_telemetry_is_not_a_quality_gate を、diagnostics-only 文の存在(positive)と fallback trigger セクション から `web_tool_call_count == 0` が不在であること(negative)の両方を assert する contradiction-prevention テストへ更新する。 Co-authored-by: Claude Sonnet 5 <[email protected]>
Summary
web_tool_call_count、search_query_count、hook/provenance trace)は diagnostics のみにし、citation URL と source content による claim evidence を判定主体にしました。verification_route: native_webと正直に記録するようにしました。Checks
uv run --locked pytest .claude/skills/gemini-cli-headless-delegation/tests/test_preflight_agy.py .claude/skills/gemini-cli-headless-delegation/tests/test_agy_structured_output.py -q(76 passed)uv run --locked pytest .claude/skills/gemini-cli-headless-delegation/tests/test_agent_contracts.py .claude/skills/gemini-cli-headless-delegation/tests/test_run_gemini_headless.py -q(325 passed)uv run --locked pytest tests/test_codex_agent_bridge_contract.py -q(25 passed)node scripts/check-codex-agents.mjs(ok 15 agents validated)uv run --locked python3 scripts/check_codex_agent_config.py(OK)uv run --locked python3 scripts/check_claude_codex_agent_parity.py(exit 0)pnpm typecheck/pnpm lint(fix_delta iteration 1 の再検証、いずれも exit 0)web_searchruntime probe を実コマンド・実 exit code・実 event ログで再取得しました(Runtime Verification Evidence 参照。旧NATIVE_WEB_SMOKE_OKの bare marker は撤回します)。Schema Change Applicability
schema_changeWEB_RESEARCH_RESULT_V1(.claude/agents/web-researcher.mdの## 結果節が SSOT)は cross-file consumer boundary をまたぐ machine-readable contract であり、docs/dev/schema-governance.mdの schema 定義(「複数ファイル間のインターフェース境界となる YAML ブロック」)に該当する。fix_delta iteration 1 でverification_route/attempts[].routeの enum 値をagy_grounded_researchから元のgrounded_researchへ戻し(minimal-compatibility 方針)、native_webのみを additive に追加する形へ修正しました。 元 PR はnot_schema_changeと誤判定していました。Schema Consumer Inventory
変更対象 schema:
WEB_RESEARCH_RESULT_V1(定義場所:.claude/agents/web-researcher.md、.codex/agents/web-researcher.tomlは同一契約の Codex-side ミラー)before/after 差分:
verification_route:grounded_research | none→grounded_research | native_web | none(additive。fix_delta iteration 1 でagy_grounded_researchへの rename を撤回し、既存値grounded_researchを維持)attempts[].route: 同様にgrounded_research | native_web(additive)failure_reason:<string>→<string|null>(producer 側の nullability 明確化。成功時は元々 null 相当だったため実質的な破壊ではないが、型として明記した)consumer 列挙(
rg -l "verification_route" .の結果):.claude/agents/web-researcher.md(producer / SSOT).codex/agents/web-researcher.toml(Codex-side mirror。同一 additive 値に更新済み).claude/skills/gemini-cli-headless-delegation/tests/test_agent_contracts.py(verification_route: native_webの contract 文字列を検証するテスト。更新済み・green).claude/skills/issue-refinement-loop/references/web-research-routing.md(consumer boundary の説明文書。verification_route: grounded_researchまたはnative_webに更新済み).claude/skills/issue-refinement-loop/SKILL.md(orchestrator はstatusの等値判定のみで routing し、verification_routeの literal 値を条件分岐に使っていないため、値のリネーム有無に関わらず動作に影響しない。今回のリネーム撤回によりこの事実に変わりはない).claude/skills/issue-refinement-loop/fixtures/loop_state_v1_fixture.json("verification_route": nullの fixture。null は既存値のままで影響なし)docs/dev/workflows/issue-refinement-loop-design.md(consumer field 列挙の説明文書。値の enum を列挙していないため影響なし・未更新でも矛盾しない)docs/dev/schema-governance.md(runtime-verification artifact logエントリの detection pattern 文字列としての参照のみ。schema 定義本体ではないため影響なし)Consumer 更新状況: 全 consumer 更新済み。
issue-refinement-loopの実際の routing ロジック(SKILL.md/references/web-research-routing.md)はstatusの等値判定のみに依存しており、verification_routeの具体的な文字列値を分岐条件に使うコードは本リポジトリ内に存在しない(rgで確認済み)ため、consumer 側の振る舞い変更は不要。互換性判定(Compatibility Decision)
additive(fix_delta iteration 1 で breaking rename を撤回した後は、新規値native_webの追加とfailure_reasonの nullability 明記のみ)backward_compatiblenogrounded_researchという既存 enum 値を保持したままnative_webを additive に追加したため、verification_routeの等値比較を行う既存コード(今回の調査では見つからなかったが将来追加され得る)があってもgrounded_research判定は破壊されない。Safety Claim Matrix
web_searchruntime probe(下記)test_valid_citation_with_zero_tool_count_is_not_a_tool_gateを含む regression tests追加修正(fix_delta iteration 1, OWNER レビュー #5282726845 対応)
OWNER の adversarial review(2 blockers + 3 majors)に対応しました。
verification_route/attempts[].routeの enum 値をagy_grounded_researchから既存値grounded_researchに戻し(.claude/agents/web-researcher.md、.claude/skills/issue-refinement-loop/references/web-research-routing.md)、native_webのみを additive に追加しました。primary_route: agy_grounded_research/runtime_followup_route: agy_grounded_research_with_native_web_fallback(BUILDER_INVOCATION 節の内部 route 記述子。WEB_RESEARCH_RESULT_V1の wire schema フィールドではない)は変更していません。<!-- runtime-verification: true -->タグを付与しました(docs/dev/runtime-verification-policy.mdの整合ルール違反を是正)。web_searchruntime probe を実行し、実コマンド・実 exit code・実 JSONL event ログ・実際に取得した外部情報を証跡化しました(詳細は下記 Runtime Verification Evidence)。旧NATIVE_WEB_SMOKE_OKの bare marker(コマンド・config・exit code・citation なし)は撤回します。web_search機能そのものが実行環境で genuine に動作することを直接検証したものです。web-researchercustom agent 自身に AGY failure を発生させて native fallback へ分岐させる完全な end-to-end 実行は、Issue 実装: web-researcher を AGY-first + native Web fallback にする #2059 の Stop Conditions(「nested SubAgent delegation が必要になった場合」)に抵触するため実施していません。web-researcherの AGY→native fallback 分岐は SubAgent(LLM)自身のプロンプト解釈による意思決定であり、この分岐を行う独立した Python 関数・deterministic な code boundary はリポジトリ内に存在しません(_build_agy_grounded_research_metadata()等は AGY 側の grounding 品質分類のみを行い、native fallback の起動判断自体は行わない)。そのため「AGY failure → native success」を機械的に mock する hermetic unit test は、この機能の実装アーキテクチャ上作成できません。この分岐の動作検証は、静的 contract test(プロンプトに分岐条件が明記されていることの検証)と、P0-2 の runtime evidence(native Web capability が実際に利用可能であることの実行時証跡)の組み合わせで担保しています。恒久的な自動 E2E 検証が必要な場合は follow-up Issue(未起票)でスコープ化することを推奨します。.codex/agents/web-researcher.tomlのNETWORK_ENFORCEMENT_BOUNDARYに、nativeverification_route: native_webの実体が Codex CLI のweb_searchtool(top-levelweb_search = "live" | "indexed" | "cached" | "disabled"config key。旧[features].web_searchは deprecated)であることを明記しました。本 repo の.codex/config.tomlはこの key を override していないため CLI の既定動作に従うこと、fresh な外部取得が必要な critical claim では-c web_search="live"を明示指定する運用を検討すべきことを記載しました。実際に--enable web_search(deprecated 経路。実行すると CLI 自身が deprecation メッセージを返す)と、override なしの CLI 既定の両方で genuine なweb_searchtool call(action.type: "search"/ 実際の query 文字列 / 実際の外部情報取得)を観測しました(下記 Runtime Verification Evidence)。受け入れ条件の達成状況
grounding_status: grounded経路、既存 regression 維持)。verification_route: native_webを返す。Runtime Verification Evidence(下記)で実演確認済み。web_tool_call_count/search_query_countは diagnostics のみで success/failure/routing の input にしない(test_valid_citation_with_zero_tool_count_is_not_a_tool_gate等で回帰確認)。citations_have_structured_source)でこの契約を強化した。.claude/agents/web-researcher.md/.codex/agents/web-researcher.toml)と issue-refinement-loop consumer contract の parity を維持(test_codex_agent_bridge_contract.py25 passed)。test_agent_contracts.pyのtest_agy_first_native_web_fallback_is_truthful等で green。web-researcherの AGY→native 分岐自体は SubAgent プロンプトによる意思決定であり hermetic mock 不可能(詳細は上記「追加修正 P1-3」参照)。native Web 側の実行時 capability 検証は P0-2 の Runtime Verification Evidence で担保。AGY 側の grounding 品質分類(counter=0 success、citation-without-provenance の demotion 等)はtest_agy_structured_output.py/test_run_gemini_headless.pyの hermetic tests で green。CI_TEST_PERFORMANCE_DECISION_V1
Runtime Verification Evidence(実行時検証証跡)
Issue #2059 の
Runtime Verification Applicability: decision: immediate(applicable_acs: [AC2, AC5]。両 AC に<!-- runtime-verification: true -->タグを付与済み)に対応する実行証跡です。Claude 側の native fallback 経路(WebFetch / WebSearch を実際に使用した実演)
native_web(Claude runtime のWebFetch/WebSearch。web-researcher.md の Route ownership 節が規定する fallback 経路そのものを、この PR のレビュー中に control-plane が実演)grounding_failure_class: agy_web_grounding_no_citations、web_tool_call_count: 12/url_citation_count: 0、Issue 導入: Codex CLI 実行系を廃止し Claude Code dual-subscription runtime へ移行する #2154 の web-researcher 実行)を実データとして使用。raine/claude-code-proxyの実在・説明:127.0.0.1デフォルト bind、MIT license と明記されている)Codex-side native
web_searchcapability probe(fix_delta iteration 1 で新規取得。P0-2 / P1-4 対応)旧
NATIVE_WEB_SMOKE_OKbare marker を、以下の実コマンド・実 exit code・実 JSONL event ログに置き換えます。codex-cli 0.147.0--enable web_search明示指定):codex exec --enable web_search --json --ephemeral --skip-git-repo-check -C /tmp "Use the web_search tool to find the latest stable release version tag of the ripgrep CLI tool from its official GitHub releases page (https://github.com/BurntSushi/ripgrep/releases). Reply with only the version tag, nothing else."0[features].web_search is deprecated because web search is enabled by default. (Set web_search to "live", "indexed", "cached", or "disabled" at the top level...)という deprecation メッセージを返した(これにより top-levelweb_searchconfig key の存在と、旧[features].web_searchの非推奨を確認)。item.completedtypeweb_searchが 2 件(query: "https://github.com/BurntSushi/ripgrep/releases")、最終agent_messageは"15.2.0"。.codex/config.toml既定、override なし):codex exec --json --ephemeral --skip-git-repo-check -C /tmp "Use the web_search tool if available to find the latest stable release version tag of the ripgrep CLI tool from https://github.com/BurntSushi/ripgrep/releases. If web_search is not available, reply exactly NO_WEB_SEARCH_TOOL. Otherwise reply with only the version tag."0web_searchitem が 2 件(2 件目はaction.type: "search",query: "site:github.com/BurntSushi/ripgrep/releases ripgrep latest release"という実際の検索クエリ)、最終agent_messageは"15.2.0"(probe 1 と一致)。NO_WEB_SEARCH_TOOLは返らなかった(=本 repo の config 既定で nativeweb_searchが利用可能)。_*_fallback: trueは両 probe とも観測されなかった。この実演は、native fallback 経路(route honesty・claim ごとの独立検証・citation 必須・INCONCLUSIVE を許容する判定、および Codex CLI 側の native
web_searchcapability そのもの)が実際に動作することを示す runtime 証跡です。Notes
Closes #2059 — この実装 Issue の完了を記録します。