Skip to content

実装: isolated workspace内のAGY toolPermission未設定仮説をlive検証し、対処と真の原因を記録する - #1769

Merged
squne121 merged 3 commits into
mainfrom
worktree-issue-1758-agy-tool-permission
Jul 25, 2026
Merged

squne121 merged 3 commits into
mainfrom
worktree-issue-1758-agy-tool-permission

Conversation

@squne121

@squne121 squne121 commented Jul 25, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Issue 実装: 検証: isolated workspaceでAGYのtoolPermission設定が原因でgrounded_researchのtool実行が無人環境でスキップされる仮説を検証し対処する #1758 の仮説(materialize_isolated_agy_workspace() が isolated workspace 内に実際の AGY 設定ファイル ~/.gemini/antigravity-cli/settings.json を配置せず toolPermission がビルトインデフォルト "request-review" にフォールバックし、headless agy -p の tool 呼び出しが黙ってスキップされる)を live agy -p 実行で検証した
  • AGY 公式ドキュメント(antigravity.google/docs/cli/reference / /cli/using / /docs/hooks)を live WebFetch で再確認し、toolPermission の 4 値 enum・デフォルト値・設定ファイルパスを確定させた
  • live 実行で 4 パターン(toolPermission 未設定 vs 明示 always-proceed × 2 種類の prompt)を比較した結果、仮説は誤り(refuted) と判明した。search_web の実行可否は toolPermission の値ではなく prompt の内容に依存していた
  • 副次的に、実際に search_web が成功したケースでも agy_provenance_hook_events が常に空になる別問題(hooks.json のパス自体は公式ドキュメントと一致することを確認済み)を発見し、follow-up Issue 候補として references/ に記録した
  • 仮説は誤りだったが、materialize_isolated_agy_workspace() に明示的な toolPermission: "always-proceed" を注入する変更は無害な defense-in-depth として維持し、既存の 実装: AGY profile別isolated permission policyとno-tools negative evidenceを導入する #1705 tool deny 機構の回帰テスト + 新規テストで allowlist が一切広がらないことを確認した

Checks

  • pnpm typecheck(型検査、成功)
  • pnpm lint(静的検査、成功)
  • pnpm test(テスト、成功)
  • pnpm build(ビルド、成功)

Schema Change Applicability

  • decision: not_schema_change
  • reason: IsolatedAgyWorkspace dataclass への agy_tool_permission_settings_path フィールド追加はプロセス内部の戻り値型であり、producer-consumer 境界をまたぐ machine-readable contract(delegation_result/v1 等)のスキーマ変更ではない。delegation_result/v1 自体のキー集合・型は本 PR で変更していない。

Schema Consumer Inventory

N/A(not_schema_change のため)。

互換性判断(Compatibility Decision)

  • change_type: N/A
  • compatibility: N/A
  • migration_required: N/A
  • migration_or_followup: N/A
  • reason: schema 変更ではない

Safety Claim Matrix

Claim Implemented? Not controlled Evidence Follow-up
materialize_isolated_agy_workspace() が isolated workspace 内へ書き込む toolPermission 明示設定は、既存の deny-by-default 許可リスト(.antigravity/settings.json の permissions.allow + workspace_deny_gate PreToolCall hook)を一切広げない yes N/A test_tool_deny_matrix_unaffected_by_tool_permission_injection(新規)、test_hostile_global_settings_do_not_override_workspace_deny / test_workspace_hook_deny_precedence_over_global_allow(既存、回帰なし確認済み)。.claude/skills/gemini-cli-headless-delegation/tests/test_agy_permission_policy.py 16件 + test_agy_permission_policy_oauth_token.py 9件 + test_agy_isolated_workspace_tool_permission.py 5件、計30件 PASS N/A
新規の toolPermission 設定ファイルはホストの実 $HOME/.gemini/antigravity-cli/settings.json の値を re-use せず、常に固定値 {"toolPermission": "always-proceed"} を新規生成する(真の isolation を維持) yes N/A test_tool_permission_injection_never_reuses_real_host_settings(新規)。hostile な real-home settings.json(toolPermission: "strict", 秘匿パスを含む)を用意しても isolated workspace 側に一切漏れないことを確認 N/A
仮説検証の live agy -p 実行は追加課金・quota 消費の兆候なく完了した yes live 実行結果の課金メタデータ自体は agy CLI から取得不能なため、目視上の異常(rate limit エラー等)が出なかったことのみを確認根拠とする 4回の live 実行 exit_code はすべて 0、RESOURCE_EXHAUSTED 等の quota エラー文字列は出力に含まれなかった #1494(本番 live E2E 実行時の quota 監視は引き続き #1494 側の運用範囲)
agy_provenance_hook_events が実際の tool 呼び出し成功時にも空になる問題は本 PR では未解決 no hooks.json 探索パス・実行タイミングの根本原因 references/grounded-research-isolated-workspace-investigation.md の ## Finding 1 Live Verification 内の live 検証結果(#3/#4 行、parsed_evidence.url_scan に実在 grounding URL があるにも関わらず web_tool_call_count: 0) #1768(agy_tool_provenance.py が本 Issue の Allowed Paths 外のため対処せず、follow-up Issue として起票済み)

記載ルール遵守: 本 PR は toolPermission 注入が「安全(何も広げない)」ことのみを主張し、「grounded_research の tool 呼び出しが確実に成功する」という無限定の主張はしていない(live 検証の結果、後者は prompt 依存であり toolPermission では制御できないことが判明したため)。

Live 検証結果の要約(Issue #1758 AC1/AC2/AC6)

詳細は .claude/skills/gemini-cli-headless-delegation/references/grounded-research-isolated-workspace-investigation.md の ## Finding 1 Live Verification / ## Next Action Update (#1758) セクションを参照。

  • AC1: AGY 公式ドキュメント(live WebFetch)で toolPermission の 4 値 enum(request-review(デフォルト) / proceed-in-sandbox / always-proceed / strict)と設定ファイルパス(~/.gemini/antigravity-cli/settings.json)を確認・記録した
  • AC2: live agy -p 実行 4 パターンの比較結果を記録した。toolPermission の値による search_web 実行可否への観測可能な差は一切なく、仮説は誤りと判明した
  • AC3/AC5: 仮説は誤りだったが、無害な defense-in-depth として toolPermission 明示注入のコード変更と新規回帰テスト(5件)を追加した
  • AC4: 既存の 実装: AGY profile別isolated permission policyとno-tools negative evidenceを導入する #1705 tool deny 機構テスト(25件、test_agy_permission_policy.py 16件 + test_agy_permission_policy_oauth_token.py 9件)は全て PASS(回帰なし)
  • AC6: 仮説が誤りだったため、## Next Action Update (#1758) に真の状況(prompt 依存性 + hook provenance capture の未解決ギャップ)と 調査: fan-out orchestrator の実AGY/Serena MCP/WebSearch並列実行E2E検証を行う #1494 側での対応方針を記録した

受け入れ条件の達成状況

  • AC1: 達成(AGY 公式ドキュメント live 確認結果を references/grounded-research-isolated-workspace-investigation.md の ## Finding 1 Live Verification に記録済み)
  • AC2: 達成(live agy -p 実行4パターンの比較結果を同セクションに記録済み。live_agy_run_web_tool_call_count マーカー含む)
  • AC3: 達成(仮説は誤りだったが、agy_permission_policy.py の materialize_isolated_agy_workspace() に _write_agy_tool_permission_settings() を追加し、isolated workspace 内の実 AGY settings.json パスへ toolPermission: "always-proceed" を明示注入するよう修正済み)
  • AC4: 達成(既存の 実装: AGY profile別isolated permission policyとno-tools negative evidenceを導入する #1705 tool deny 機構テスト 25 件が全て PASS、回帰なし。uv run --locked pytest .claude/skills/gemini-cli-headless-delegation/tests/test_agy_permission_policy.py -v で確認)
  • AC5: 達成(新規 hermetic テストファイル test_agy_isolated_workspace_tool_permission.py を追加、5 件全て PASS)
  • AC6: 達成(仮説が誤りだったため、## Next Action Update (#1758) セクションに真の原因〔prompt 依存性 + hook provenance capture の未解決ギャップ〕と 調査: fan-out orchestrator の実AGY/Serena MCP/WebSearch並列実行E2E検証を行う #1494 側の対応方針を記録済み)

検証コマンド結果

$ uv run --locked pytest .claude/skills/gemini-cli-headless-delegation/tests/test_agy_permission_policy.py -v
16 passed

$ uv run --locked pytest .claude/skills/gemini-cli-headless-delegation/tests/test_agy_permission_policy.py -k "grounded_research" -v
1 passed, 15 deselected

$ uv run --locked pytest .claude/skills/gemini-cli-headless-delegation/tests/test_agy_isolated_workspace_tool_permission.py -k test_isolated_workspace_injects_tool_permission_for_grounded_research -v
1 passed

$ grep -n "Live Verification" .claude/skills/gemini-cli-headless-delegation/references/grounded-research-isolated-workspace-investigation.md
158:## Finding 1 Live Verification(Issue #1758、live `agy -p` 実行による検証)

$ grep -n "live_agy_run_web_tool_call_count" .claude/skills/gemini-cli-headless-delegation/references/grounded-research-isolated-workspace-investigation.md
207:(`live_agy_run_web_tool_call_count` はホスト側 hook 集計としては常に 0)、

$ grep -n "Next Action Update (#1758)" .claude/skills/gemini-cli-headless-delegation/references/grounded-research-isolated-workspace-investigation.md
212:詳細は下記 `## Next Action Update (#1758)` を参照。
234:## Next Action Update (#1758)(次のアクション更新)

$ uv run --locked pytest .claude/skills/gemini-cli-headless-delegation/tests/ -q
975 passed

$ pnpm typecheck / pnpm lint / pnpm test / pnpm build
全て成功(詳細は上記 Checks セクション参照)

Allowed Paths 遵守

変更ファイルは Issue #1758 の Allowed Paths(拡張含む)内に収まっている。

  • .claude/skills/gemini-cli-headless-delegation/scripts/agy_permission_policy.py(Allowed Paths 記載通り)
  • .claude/skills/gemini-cli-headless-delegation/tests/test_agy_permission_policy.py(Allowed Paths 記載通り)
  • .claude/skills/gemini-cli-headless-delegation/tests/test_agy_permission_policy_oauth_token.py(Allowed Paths 記載通り、settings.json 露出パターンの拡張のみ)
  • .claude/skills/gemini-cli-headless-delegation/tests/test_agy_isolated_workspace_tool_permission.py(issue-contract-review で Allowed Paths に追加済みの新規ファイル、AC3/AC5 回帰テスト)
  • .claude/skills/gemini-cli-headless-delegation/references/grounded-research-isolated-workspace-investigation.md(Allowed Paths 記載通り)
  • .claude/skills/gemini-cli-headless-delegation/references/agy-headless-tool-use-investigation.md(Allowed Paths 記載通り、Live 確認結果の追記のみ、既存内容は書き換えていない)

run_gemini_headless.py(Allowed Paths 記載の任意項目)は今回変更不要だったため未変更。

Notes

squne121 added 3 commits July 26, 2026 01:46
Issue #1758: materialize_isolated_agy_workspace() が実際のAGY設定ファイル
(~/.gemini/antigravity-cli/settings.json) をisolated workspace内に一切配置せず、
toolPermissionがビルトインデフォルト "request-review" にフォールバックしている
という仮説をlive `agy -p` 実行で検証した。

AGY公式ドキュメント (antigravity.google/docs/cli/reference, /cli/using) をlive
WebFetchで再確認し、toolPermissionの4値enum(request-review/proceed-in-sandbox/
always-proceed/strict)とデフォルト値、設定ファイルパスを確定させた。

live agy -p実行による4パターンの比較検証の結果、toolPermissionの値
(未設定=request-review vs 明示always-proceed)によるsearch_web実行可否への
観測可能な差は一切なかった(仮説は誤り、refuted)。実際の差分要因はprompt内容
(モデルが検索する価値があると判断するかどうか)だった。

副次的に、実際にsearch_webが成功したケースでもagy_provenance_hook_eventsが
常に空になる別問題(hooks.json配置パス自体は公式ドキュメントと一致することを
確認済み)を発見し、references/配下にfollow-up Issue候補として記録した。

仮説は誤りだったが、materialize_isolated_agy_workspace()に明示的な
toolPermission: "always-proceed"を注入する変更は無害なdefense-in-depthとして
維持し、既存の#1705 tool deny機構の回帰テスト(25件)+新規テスト(5件)で
allowlistが一切広がらないことを確認した。

Closes #1758
Issue #1758 PR作成時にhook provenance capture問題の追跡先として#1768を起票したため、
grounded-research-isolated-workspace-investigation.mdのNext Action Update内の
汎用的な「新規follow-up Issue」表記を具体的なIssue番号(#1768)に更新する。
CI の PR Body Japanese Check は変更された Markdown ファイル全体を per-block 検査するため、
公式ドキュメント引用の英語blockquoteと、英語のみの見出しが日本語比率不足でFAILしていた。
訳注・日本語併記を追加してAC6のVC文字列(grep一致)を維持したまま解消する。
@github-actions

github-actions Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Preview URL

Preview removed (PR #1769 closed).

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

レビュー結果

CI(ci_verdict_summary.py、head_sha 一致、status: all_pass、除外5件はJapanese Check retrospective系のみで妥当)、Allowed Paths(変更6ファイルすべて Issue #1758 記載のAllowed Paths内、rename無し)、AC1-AC6(references/grounded-research-isolated-workspace-investigation.md の PR head ブランチを直接 fetch し Live Verification / live_agy_run_web_tool_call_count / Next Action Update (#1758) の3マーカーを実ファイルで確認)、新規テスト5件(test_agy_isolated_workspace_tool_permission.py、PR本文の主張と一致)、既存回帰テストの diff(test_agy_permission_policy.py / test_agy_permission_policy_oauth_token.py の変更は新挙動に整合したアサーション更新のみでスコープ逸脱なし)を独立検証した。

Safety-sensitive(.claude/skills/** の権限関連変更)と判定し、Safety Claim Matrix を確認。4件の claim はいずれも bounded で、Not controlled 列の記載(課金メタデータ取得不能、hook provenance 未解決)に対して follow-up(#1494, #1768)が明記されており妥当。

blocker は検出されなかった。

LOOP_VERDICT_V2

LOOP_VERDICT_V2:
  verdict: APPROVE
  reviewed_head_sha: "b2d1506c80c2f26e1590d9363e775382481bbf84"
  merge_ready: true
  mergeability:
    mergeable: "MERGEABLE"
    merge_state_status: "CLEAN"
  blockers: []
  allowed_paths_gate:
    status: ok
    changed_files_source: git_diff_name_status_find_renames_z
    producer_role: review_subagent
    worker_report_used_as_canonical: false
    notes: "changed files 6件はすべて Issue #1758 Allowed Paths と exact 一致(rename無し)。手動 diff 照合により確認。"
  required_auto_actions: []
  auto_fix_applied: []
  follow_up_issue_requests: []

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant