Skip to content

feat: .gemini/settings.json に Serena MCP excludeTools denylist を追加 (#140) - #261

Merged
squne121 merged 2 commits into
mainfrom
worktree-issue-140-gemini-settings-json-serena-mcp-excludet
May 23, 2026
Merged

squne121 merged 2 commits into
mainfrom
worktree-issue-140-gemini-settings-json-serena-mcp-excludet

Conversation

@squne121

@squne121 squne121 commented May 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • .gemini/settings.json の mcpServers.serena に excludeTools 配列を追加し、SERENA_DANGEROUS_TOOLS(21 ツール)を列挙する
  • これにより preflight_gemini_headless.py の local_asset_research dangerous tool denylist チェックが PASS する
  • trust: false と includeTools(read-only 6 ツール)の既存値は保持
  • 設定ファイルが未追跡だったため、初回コミットとして git に追加

Closes #140

Safety Claim Matrix

本 PR は .gemini/settings.json の MCP tool access control 設定(trust, excludeTools, includeTools)を変更するため、safety-sensitive な変更として扱う。

Claim 種別 根拠 証跡
trust: false — Serena MCP は untrusted として扱われる 既存値保持 diff / AC3 PASS Verification Commands AC3 参照
excludeTools に SERENA_DANGEROUS_TOOLS 21 ツールを列挙 新規追加 AC1 / preflight PASS Verification Commands AC1/AC2 参照
includeTools は read-only 6 ツールのみ 既存値保持 diff / AC4 PASS Verification Commands AC4 参照

本 PR がコントロールしないこと:

  • Serena MCP サーバー本体のインストール・権限設定
  • includeTools リストの変更(変更なし・既存値保持のみ)
  • Gemini CLI のその他のセキュリティ設定

本 PR でコントロールできない範囲の follow-up:

変更内容

.gemini/settings.json の mcpServers.serena に excludeTools フィールドを追加:

"excludeTools": [
  "activate_project", "create_text_file", "delete_lines", "execute_shell_command",
  "insert_after_symbol", "insert_at_line", "insert_before_symbol", "prepare_for_new_conversation",
  "read_file_content", "read_memory", "remove_project", "replace_lines",
  "replace_regex", "replace_symbol_body", "restart_language_server", "switch_modes",
  "think_about_collected_information", "think_about_task_adherence",
  "think_about_whether_you_are_done", "write_file", "write_memory"
]

Verification Commands 実行結果

AC1: excludeTools の存在と21ツール全含有確認

PASS: AC1

AC2: preflight denylist チェック

[gemini-preflight] ok: Gemini CLI 0.43.0 is ready
[gemini-preflight] result saved to: /tmp/preflight_ac2_result.json
PASS: AC2

preflight 全体結果(/tmp/preflight_ac2_result.json):

  • ok: true
  • failure_reason: null
  • local_asset_research.ok: true
  • local_asset_research.errors: []
  • validated_tool_profiles: ["no_tools", "grounded_research", "local_asset_research", "proposal_only", "github_research"](全5プロファイル検証済み)

AC3: trust が false であること

PASS: AC3

AC4: includeTools が read-only 6 ツールのみ

PASS: AC4

AC5: Known remaining preflight errors

preflight 実行結果: ok: true, failure_reason: null。denylist / excludeTools 系以外の残余エラーなし。

warnings(non-blocking):

  • "Warning: True color (24-bit) support not detected. Using a terminal with true color enabled will result in a better visual experience."
  • "Ripgrep is not available. Falling back to GrepTool."

これらは環境の警告であり、preflight の合否判定には影響しない。

標準品質ゲート

コマンド 結果
pnpm typecheck PASS
pnpm lint PASS
pnpm test PASS(5 tests, 4 files)
pnpm build PASS
uv run pytest test_model_routing.py PASS(21 tests)

Allowed Paths 遵守

変更ファイル: .gemini/settings.json のみ(Allowed Paths 内)

観察事項・改善提案

  • .gemini/settings.json は本 PR 以前、git 未追跡状態だった(?? .gemini/ として git status に出現)。本 PR で初めて repository-tracked ファイルになる。
  • contract-snapshot warning「AC2 の VC step2 が errors フィールドを参照しているが実際は failure_reason に格納」→ 本 PR では修正版コマンド(failure_reason 参照)を使用し、PASS を確認済み。Issue 実装: .gemini/settings.json に Serena MCP excludeTools denylist を追加し local_asset_research preflight を通過させる #140 の VC コマンドが failure_reason ではなく errors フィールドを参照している問題は、Issue 本文の VC 設計ミスとして記録する(実装への影響なし)。
  • SERENA_DANGEROUS_TOOLS のツール名は本リポジトリの preflight 契約に対する denylist であり、Serena upstream の最新ツール集合との完全な一致を保証するものではない(Known Risk: Issue 改善: SERENA_DANGEROUS_TOOLS のツール名と Serena upstream 公式ツール名の乖離を定期検証・更新する仕組みを整備する #256 で追跡)。
  • Safety Claim Matrix の要否判定: trust/MCP/tool キーワードを含む config 変更は pr-review-judge の Safety Claim Gate で safety-sensitive と判定される。今後同種の MCP 設定変更 PR では、PR テンプレートまたは implement-issue skill の PR 本文生成ステップに Safety Claim Matrix セクションを含める運用を検討する(follow-up)。

Contract Snapshot

#140 (comment)


IMPLEMENT_RESULT_V1:
  status: ok
  generated_at: "2026-05-23T14:10:00Z"
  generated_by: implement-issue
  issue_url: https://github.com/squne121/loop-protocol/issues/140
  worktree: .claude/worktrees/issue-140-gemini-settings-json-serena-mcp-excludet
  branch: worktree-issue-140-gemini-settings-json-serena-mcp-excludet
  verification:
    typecheck: pass
    lint: pass
    test:
      passed: 5
      failed: 0
      files: 4
    build: pass
  allowed_paths_compliance: true
  warnings:
    - ".gemini/settings.json was untracked before this PR; now added to git tracking"
    - "SERENA_DANGEROUS_TOOLS names may drift from Serena upstream (tracked in #256)"
  errors: []

)

mcpServers.serena に excludeTools 配列を追加し、SERENA_DANGEROUS_TOOLS
(21 ツール)を列挙する。これにより preflight_gemini_headless.py の
local_asset_research dangerous tool denylist チェックが PASS し、
codebase-investigator SubAgent が Gemini に委譲できる状態になる。

設定ファイルが未追跡だったため、初回コミットとして追加する。
trust: false と includeTools(read-only 6 ツール)の既存値は保持。

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@squne121

Copy link
Copy Markdown
Owner Author
TEST_VERDICT:
  result: PASS
  mergeable: MERGEABLE
  merge_state_status: BEHIND
  baseline_only: false
  verification_commands_pass: 5
  verification_commands_fail: 0

検証結果レポート

Issue #140: .gemini/settings.json に serena MCP の excludeTools を設定する

AC 確認コマンド 実行結果(要約) 判定
AC1 21 dangerous tools を excludeTools に確認 全ツールが存在 PASS
AC2 preflight_gemini_headless.py 実行 ok: true, denylist/excludeTools エラーなし PASS
AC3 trust が false か確認 trust: false PASS
AC4 includeTools が 6 read-only tools か確認 完全一致 PASS
AC5 PR 本文に Known remaining preflight errors 記載 明示されている(warnings のみ、non-blocking) PASS

標準品質ゲート

コマンド 結果
pnpm typecheck PASS
pnpm lint PASS
pnpm test PASS (5 tests, 4 files)
pnpm build PASS
uv run pytest test_model_routing.py PASS (21 tests)

総合判定

  • 全 AC PASS: YES
  • 品質ゲート PASS: YES
  • マージ可能状態: MERGEABLE (main に 3 commits behind)

Generated with Claude Code

@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.

Verdict: REQUEST_CHANGES

Mergeability

  • mergeable=MERGEABLE, mergeStateStatus=BEHIND
  • BEHIND は conflict blocker ではないが、マージ前に base branch との同期が必要。

Evidence Check

AC coverage:

  • AC1: PASS — excludeTools に 21 ツール全含有を diff と TEST_VERDICT で確認済み
  • AC2: PASS — runtime verification evidence あり(preflight ok:true, local_asset_research.ok:true, errors:[])。SKIP のみ・fallback PASS ではなく実実行証跡
  • AC3: PASS — diff で trust: false を確認
  • AC4: PASS — includeTools に read-only 6 ツールのみ(find_file, find_referencing_symbols, find_symbol, get_symbols_overview, list_dir, search_for_pattern)
  • AC5: PASS — known remaining warnings(terminal color, ripgrep fallback)を PR 本文に明示、non-blocking であると明記

Allowed Paths: 遵守 — gh pr diff --name-only の出力は .gemini/settings.json のみ。Allowed Paths(.gemini/settings.json)と完全一致。

CI Verification: 全 5 チェック PASS(build / lint / python-test / test / typecheck)

検証コマンド結果: PR 本文の ## Verification Commands 実行結果 セクションに AC1〜AC4 の実行結果が記載済み。TEST_VERDICT_MACHINE コメントで verification_commands_pass:5, fail:0 を確認。

Runtime Verification(decision: immediate): AC2 の runtime-verification 証跡が PR 本文に存在し、SKIP のみ / fallback FAIL 相当の記述なし。要件を満たす。

Schema Change Applicability: .gemini/settings.json の変更は schema-governance.md の Initial Known Schemas に該当しない config 変更であり、schema_change_applicability: not_schema_change と判定。Schema Consumer Inventory 不要。

Blockers

  1. Safety Claim Matrix 欠如(APPROVE 禁止)

    本 PR は .gemini/settings.json の mcpServers.serena に trust、excludeTools、includeTools を設定し、MCP tool access control を構成する変更である。

    pr-review-judge SKILL の Safety Claim Gate 判定基準:

    • PR diff/本文に trust、MCP (mcpServers)、tool(excludeTools/includeTools)のキーワードが含まれる
    • 安全境界(MCP tool denylist / allowlist)に直接関わる変更である

    上記より safety-sensitive PR と判定。しかし PR 本文に ## Safety Claim Matrix セクションが存在しない。

    必要な対応: PR 本文に ## Safety Claim Matrix セクションを追加し、以下を記載すること:

    • Claim 列: trust: false 保持、excludeTools による危険ツール排除、includeTools による read-only 限定
    • Implemented? 列: 各 Claim の実装状況
    • Not controlled 列: .gemini/settings.json の設定が実際に Gemini CLI に適用されるかは Gemini CLI 側の読み込み実装に依存(本 PR では未制御)
    • Evidence 列: AC2/AC3/AC4 の検証コマンド結果への参照
    • Follow-up 列: Not controlled 項目に対する follow-up Issue 参照(該当する場合)

Non-blockers(任意改善)

  1. mergeStateStatus: BEHIND — main に 3 commits 遅れている。マージ前に git merge main または rebase を実施することを推奨(コンフリクトリスク軽減)。Safety Claim Matrix 追加と合わせて対応可能。

LOOP_VERDICT

LOOP_VERDICT:
  verdict: REQUEST_CHANGES
  blockers:
    - "Safety Claim Matrix セクションが PR 本文に存在しない(MCP tool access control 変更は safety-sensitive)"
  mergeable: MERGEABLE
  mergeStateStatus: BEHIND
  reviewed_head_sha: 1d7164bd60643b14680c92d2f52a7efe3889c340
  follow_up_issue_requests: []

@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.

Verdict: APPROVE

iteration: 1 (前回: REQUEST_CHANGES — Safety Claim Matrix 欠落)

Mergeability

  • mergeable=MERGEABLE, mergeStateStatus=BEHIND
  • BEHIND は conflict blocker ではない(main より 3 commits 遅れているが、マージ可能)

Evidence Check

AC coverage:

  • AC1 (excludeTools 21 ツール全含有): PASS — Verification Commands 実行結果に根拠あり
  • AC2 (preflight denylist チェック): PASS — ok: true, local_asset_research.errors: [] を記録。Runtime Verification (decision: immediate) の実行証跡あり、SKIP / fallback PASS なし
  • AC3 (trust: false 保持): PASS — 根拠あり
  • AC4 (includeTools read-only 6 ツール保持): PASS — 根拠あり
  • AC5 (残余エラー明示): PASS — warnings(non-blocking 2 件)を明示。denylist / excludeTools 系エラーなし

Allowed Paths: 遵守 — 変更ファイルは .gemini/settings.json のみ(Allowed Paths 内)

CI Verification: 全 5 チェック pass(build / lint / python-test / test / typecheck)

検証コマンド結果: ## Verification Commands 実行結果 セクションに各 AC の実行結果(PASS / 出力)を記録済み

scope 混入: なし

Runtime Verification Evidence (immediate): ## Verification Commands 実行結果 > AC2 に preflight 実行ログあり。SKIP / fallback PASS なし — blocker なし

Safety Claim Gate:

  • safety-sensitive 判定: 該当(trust, MCP, excludeTools, tool キーワード含む)
  • ## Safety Claim Matrix セクション: 存在する
  • Not controlled 範囲: 明示されている(Serena MCP 本体・Gemini CLI その他設定)
  • Follow-up: Issue #256(upstream drift 追跡)が参照されている
  • PR タイトルに無限定安全主張なし
  • 備考: マトリクス列名が SKILL.md 規定(Implemented? / Not controlled / Evidence / Follow-up)と異なり(種別 / 根拠 / 証跡)、「Not controlled」が列ではなく本文 prose に記載されている。ただし実質的な情報(非制御範囲の特定・follow-up Issue 参照)は存在するため blocker としない。

Schema Change Applicability: not_schema_change — .gemini/settings.json は consumer 境界をまたぐ contract schema ではない。Schema Consumer Inventory 提出不要。

Blockers

なし

Non-blockers(任意改善)

  1. Safety Claim Matrix の列名を SKILL.md 規定(Claim / Implemented? / Not controlled / Evidence / Follow-up)に合わせることで、次回 pr-review-judge の自動検査がより明確になる。今後同種の MCP 設定変更 PR では PR テンプレートに列名を含める運用を推奨(PR 本文の観察事項に同旨の note あり)。

LOOP_VERDICT

LOOP_VERDICT:
  verdict: APPROVE
  blockers: []
  mergeable: MERGEABLE
  mergeStateStatus: BEHIND
  reviewed_head_sha: 1d7164bd60643b14680c92d2f52a7efe3889c340
  follow_up_issue_requests:
    - title: "Safety Claim Matrix 列フォーマットを PR テンプレートに追加し、MCP 設定変更 PR の標準化"
      issue_kind: implementation
      severity: optional_follow_up
      source:
        kind: pr_review
        url: "https://github.com/squne121/loop-protocol/pull/261"
        note_id: "1"
      dedupe_key: "follow-up:squne121/loop-protocol:https://github.com/squne121/loop-protocol/pull/261:1"
      desired_destination: "PR テンプレートまたは implement-issue skill の PR 本文生成ステップに Safety Claim Matrix(規定列名)が含まれ、MCP 設定変更 PR で列欠落が発生しない"
      validated_scope_delta: "PR テンプレートまたは implement-issue skill に Safety Claim Matrix セクション(Claim / Implemented? / Not controlled / Evidence / Follow-up 列)を追加"
      origin_skill: pr-review-judge
      labels:
        - triage-required

@squne121
squne121 marked this pull request as ready for review May 23, 2026 05:20
@squne121
squne121 merged commit a9848ca into main May 23, 2026
5 checks passed
@squne121
squne121 deleted the worktree-issue-140-gemini-settings-json-serena-mcp-excludet branch May 23, 2026 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

実装: .gemini/settings.json に Serena MCP excludeTools denylist を追加し local_asset_research preflight を通過させる

1 participant