Repository navigation
実装: agy_tool_provenance の hooks.json 配置先を実際の discover パスへ修正し、grounded_research evidence gate へ配線する - #1770
Merged
Conversation
…_research evidence gate へ配線する isolated workspace 内で search_web / read_url_content が実際に成功しても agy_provenance_hook_events が常に空になる原因を live agy -p 実行で特定した。 generate_workspace_hook_config() が書き込む <workspace>/.agents/hooks.json は 公式ドキュメントの記述と一致するが、インストール済み Antigravity CLI 1.1.7 の headless print mode では discover されない。実際に discover されるのは <HOME>/.gemini/config/hooks.json であることを --log-file 出力の解析で確認した。 home_dir 引数を追加し isolated HOME 配下の正しいパスにも hooks.json を書き込み、 _build_agy_grounded_research_metadata() に検証済み hook event を組み込んで grounding_status の誤判定(attempted_no_web_tool_call)を解消した。既存の hallucination fail-closed テストは無変更のまま全て PASS。live 再検証で修正後の end-to-end 成功も確認済み。 Closes #1768 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Contributor
Preview URLPreview removed (PR #1770 closed). |
squne121
commented
Jul 25, 2026
squne121
left a comment
Owner
Author
There was a problem hiding this comment.
LOOP_VERDICT_V2:
verdict: APPROVE
reviewed_head_sha: "964a4485639ea1cb8243f737da168223c4775009"
merge_ready: true
mergeability:
mergeable: "MERGEABLE"
merge_state_status: "CLEAN"
blockers: []
required_auto_actions: []
auto_fix_applied: []
follow_up_issue_requests: []判定根拠
- CI:
ci_verdict_summary.py --pr 1770 --expected-head-sha 964a448...→status: all_pass,stale_checks: [],failed_checks: [](exit 0)。python-test / test / e2e / lint / typecheck / build / actionlint / check-hook-integrity / node-backed-hook-tests / validate-generated-artifact / deploy-pr / PR Body Japanese Check 全 SUCCESS。deploy-main / retrospective 系 / cleanup-pr は条件付き SKIPPED(除外対象)。 - Closing keyword: PR 本文
NotesにCloses #1768記載あり。 - Allowed Paths:
gh api pulls/1770/filesで変更5ファイル全件が Issue #1768 contract の Allowed Paths と厳密一致(status は全て modified/added、rename なし)。scope 混入なし。 - AC coverage: AC1-AC8 全て
[x]で根拠記載。独立検証として PR head の実ファイル内容を fetch し、AC1 マーカーhooks_manager_discovery_path_confirmed・AC7 マーカーlive_reverification_hook_events_nonemptyが実際に references md に存在することを確認。AC2 新規テストtest_agy_tool_provenance_home_dir_hook.pyに4関数(うち2件が real-host-home fail-closed 拒否テスト)、AC6 新規テストtest_agy_provenance_grounding_wiring.pyに9関数(hallucination fail-closed 系5件含む)が実在することを確認。AC3run_gemini_headless.pyの isolated workspace 分岐にhome_dir=tmp_path(materialize_isolated_agy_workspace()が返す isolated workspace_dir、実 host HOME ではない)が実際に配線されていることをソース確認。 - Schema Change Applicability:
not_schema_change。generate_workspace_hook_config()/_build_agy_grounded_research_metadata()へのキーワード専用引数追加のみで既存スキーマの型・キー集合は不変。判断は妥当。 - Safety Claim Gate:
.claude/skills/gemini-cli-headless-delegation/**変更のため safety-sensitive。PR 本文に Safety Claim Matrix あり、各 claim に evidence(新規/既存テスト名・live 再検証結果)が対応。Not controlled列は quota row の1件のみで bounded かつ follow-up(#1494) 明記済み。 - Mergeability:
MERGEABLE/CLEAN。BEHIND ではないためupdate_branch不要。 - Draft 状態自体は blocker ではない(
merge_ready判定には影響しない)。
blocker なし。
squne121
marked this pull request as ready for review
July 25, 2026 17:57
This was referenced Aug 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
search_webが実際に成功してもagy_provenance_hook_eventsが常に空になる原因を liveagy -p実行(インストール済み Antigravity CLI 1.1.7、--log-file出力解析)で特定したagy_tool_provenance.generate_workspace_hook_config()が書き込む<workspace_dir>/.agents/hooks.jsonは公式ドキュメントの記述と文字面では一致するが、実際には discover されない(hooks_manager.go:53] loaded 0 named hooks from 0 hooks.json file(s))。実際に discover されるのは<HOME>/.gemini/config/hooks.json(agy changelog1.0.8 が "shared" と呼ぶ正本パス)であることをmigrate.go/jsonhook.goのログで確認したgenerate_workspace_hook_config()にhome_dir引数を追加し、isolated workspace 分岐でのみ isolated HOME 配下の正しいパスにも hooks.json を書き込むよう修正した(実 host の$HOMEと一致する場合は fail-closed で拒否)run_gemini_headless._build_agy_grounded_research_metadata()に検証済み hook event(agy_provenance_hook_events)を組み込み、stdout 自己申告の有無に関わらず「tool 呼び出しが発生した」と判定できるようgrounding_statusの誤判定(attempted_no_web_tool_call)を解消した_run_agy()の唯一の実本番呼び出し元(run_delegation())が fan-out 相関 ID を渡さないため、既存のagy_tool_provenance.validate_provenance_event()(それらの ID を必須とする)はそのまま流用できないことが live 再検証で判明。fan-out 相関 ID を要求しない専用の構造検証(_hook_event_confirms_tool_call())を新設して対処したagy -pgrounded_research を isolated workspace 内で実行し、agy_provenance_hook_eventsが非空になりgrounding_statusが正しくattempted_no_citations/groundedになることを end-to-end で確認した(詳細:references/grounded-research-isolated-workspace-investigation.md## Finding 2 Live Verification (#1768))Checks
pnpm typecheck(型検査、成功)pnpm lint(静的検査、成功)pnpm test(テスト、成功、1814 passed)pnpm build(ビルド、成功)Schema Change Applicability
not_schema_changegenerate_workspace_hook_config()へのキーワード専用引数(home_dir、デフォルトNone)追加、_build_agy_grounded_research_metadata()へのキーワード専用引数(hook_events、デフォルトNone)追加はいずれも後方互換な関数シグネチャ拡張であり、delegation_result/v1のキー集合・型は変更していない(grounded_research_evidence内の既存フィールドの値の意味付けロジックのみを、既存フィールドの型・キー集合を変えずに変更)。producer-consumer 境界をまたぐ machine-readable contract のスキーマ変更ではない。Schema Consumer Inventory
N/A(
not_schema_changeのため)。互換性判断(Compatibility Decision)
N/AN/AN/AN/ASafety Claim Matrix
generate_workspace_hook_config()のhome_dir書き込みは isolated workspace 内にのみ行われ、実 host の$HOME(symlink 解決込み)と一致する場合は fail-closed で拒否されるtest_generate_workspace_hook_config_home_dir_refuses_real_host_home/test_generate_workspace_hook_config_home_dir_refuses_real_host_home_via_symlink(新規、test_agy_tool_provenance_home_dir_hook.py)4件 PASSattempted_no_web_tool_callで fail-closed 判定する(hallucination 検出の弱体化なし)test_no_hook_events_stdout_only_hallucination_still_fail_closed/test_missing_hook_events_attribute_stdout_only_hallucination_still_fail_closed/test_malformed_hook_event_stdout_only_hallucination_still_fail_closed/test_unrecognized_tool_name_hook_event_stdout_only_hallucination_still_fail_closed/test_hook_load_error_present_stdout_only_hallucination_still_fail_closed(新規)、既存のtest_agy_provider.pyhallucination fail-closed テスト4件(無変更)全て PASStest_generic_url_without_vertex_grounding_pattern_not_counted_as_citation(新規)、既存のtest_agy_grounded_research_url_without_tool_trace_fail_closed/test_agy_grounded_research_prompt_echo_url_not_counted_as_citation(無変更)PASSagy -pgrounded_research 実行でagy_provenance_hook_eventsが実際に非空になりgrounding_statusが正しく反映されるreferences/grounded-research-isolated-workspace-investigation.md## Finding 2 Live Verification (#1768)の live 再検証結果(web_tool_call_count: 1、grounding_status: attempted_no_citations/groundedの2パターン)agy -p実行は追加課金・quota 消費の兆候なく完了したRESOURCE_EXHAUSTED等の quota エラー文字列は出力に含まれなかった受け入れ条件の達成状況
references/grounded-research-isolated-workspace-investigation.mdにhooks_manager_discovery_path_confirmedマーカーを含む## Finding 2 Live Verification (#1768)セクションを追記済み)generate_workspace_hook_config()にhome_dir引数を追加し、実 host$HOME一致時は fail-closed で拒否。test_agy_tool_provenance_home_dir_hook.py4件 PASS)_run_agy()isolated workspace 分岐がhome_dir=tmp_pathを渡すよう修正。非隔離フォールバック分岐は無変更)_build_agy_grounded_research_metadata()がhook_eventsを組み込み、stdout 自己申告なしでも hook event 検証済みならattempted_no_web_tool_callにならない)test_agy_provider.pyhallucination fail-closed テスト4件、無変更のまま全て PASS)test_agy_provenance_grounding_wiring.py新規9件、(a)(b)(c) 全パターン PASS)references/grounded-research-isolated-workspace-investigation.mdにlive_reverification_hook_events_nonemptyマーカーを含む live 再検証結果を記録済み)検証コマンド結果
Allowed Paths 遵守
変更ファイルは Issue #1768 の Allowed Paths 内に収まっている。
.claude/skills/gemini-cli-headless-delegation/scripts/agy_tool_provenance.py(Allowed Paths 記載通り).claude/skills/gemini-cli-headless-delegation/scripts/run_gemini_headless.py(Allowed Paths 記載通り、_run_agy()isolated workspace 分岐 /_build_agy_grounded_research_metadata()/_normalize_agy_result()該当箇所のみ).claude/skills/gemini-cli-headless-delegation/tests/test_agy_tool_provenance_home_dir_hook.py(Allowed Paths 記載通り、新規作成).claude/skills/gemini-cli-headless-delegation/tests/test_agy_provenance_grounding_wiring.py(Allowed Paths 記載通り、新規作成).claude/skills/gemini-cli-headless-delegation/references/grounded-research-isolated-workspace-investigation.md(Allowed Paths 記載通り)test_agy_provider.py/test_agy_hook_events_propagation.py(Allowed Paths 記載の任意項目)は既存 assertion の読み取り確認のみで変更不要だったため未変更。Notes