ApplicationIntegrationToolset silently builds no tools when a Connectors schema operation fails, and waits forever on one that never finishes

オープン
#7,165 コメント 2 件 リアクション 0 件 担当者 1 名 GitHub で見る

@sanketpatil06 がすでに取り組んでいます。

2026年9月18日 から。

評価

この issue はまだ評価されていません。

説明

tools

🔴 Required Information

Describe the Bug:

ConnectionsClient._poll_operation() (used by ApplicationIntegrationToolset for connection entities and actions) has two problems:

  1. A failed operation is treated as success. A finished Connectors long-running operation carries either response or error (google.longrunning.Operation). The loop only checks done, and the callers then read response.jsonSchema / response.operations, falling back to {} / []. So when the lookup fails, for example because of a mistyped entity or action name or a missing permission on the connection, the toolset builds without error and with no tools for that entity. With explicit operations it builds tools against an empty schema, and a failed action produces a tool with an empty display name. Nothing tells the developer why the agent can't reach the connector.
  2. The wait is unbounded. while not operation_done: has no deadline, so an operation that never finishes blocks toolset construction, and therefore agent startup, forever. bf4143ac bounded each HTTP call in this client for exactly this reason ("an unavailable endpoint could block agent execution indefinitely"), but the polling loop around those calls is still open-ended.

It also sleeps one extra second after the operation is already done, which slows every entity and action lookup.

Steps to Reproduce:

  1. pip install google-adk (reproduced on main @ f33d4923 / 2.9.0).
  2. Run the script below. It builds a real ApplicationIntegrationToolset for a connection whose getEntityType operation finishes with error (entity Acount does not exist). HTTP is stubbed, so no GCP project is needed.

Expected Behavior:
Toolset construction fails with the operation's error message, and a stuck operation fails after a bounded wait.

Observed Behavior:

toolset built; tools: []
elapsed: 1.0s

Environment Details:

  • ADK Library Version (pip show google-adk): 2.9.0 (main @ f33d4923)
  • Desktop OS: Windows 11
  • Python Version (python -V): 3.12.10

Model Information:

  • Are you using LiteLLM: No
  • Which model is being used: N/A (toolset construction, no model call)

🟡 Optional Information

Minimal Reproduction Code:

import asyncio
from unittest import mock

from google.adk.tools.application_integration_tool import ApplicationIntegrationToolset
from google.adk.tools.application_integration_tool.clients.connections_client import ConnectionsClient

FAILED_OP = {
    "name": "operations/op-1",
    "done": True,
    "error": {"code": 5, "message": "Entity type 'Acount' not found."},
}


def fake_get(url, headers=None, timeout=None):
  resp = mock.MagicMock(status_code=200)
  if url.endswith("?view=BASIC"):
    resp.json.return_value = {"name": "projects/p/locations/us-central1/connections/sfdc",
                              "serviceDirectory": "sd", "host": ""}
  elif "getEntityType" in url:
    resp.json.return_value = {"name": "operations/op-1"}
  else:
    resp.json.return_value = FAILED_OP
  return resp


mod = "google.adk.tools.application_integration_tool.clients.connections_client"
with mock.patch(f"{mod}._mtls_utils.get_api_endpoint", return_value="connectors.googleapis.com"), \
     mock.patch.object(ConnectionsClient, "_get_access_token", return_value="token"), \
     mock.patch(f"{mod}.requests.get", side_effect=fake_get):
  toolset = ApplicationIntegrationToolset(
      project="p", location="us-central1", connection="sfdc",
      entity_operations={"Acount": []},  # typo for "Account"
  )
  print("toolset built; tools:", [t.name for t in asyncio.run(toolset.get_tools())])

Suggested fix: in _poll_operation, raise ValueError with the operation's error message when a finished operation carries error. That's the error type the callers already document. Stop polling after a deadline with TimeoutError, and don't sleep once done is set. I have a PR ready with tests.

How often has this issue occurred?:

  • Always (100%): any failed entity or action schema lookup.
主要言語
Python
スター
21.6k
フォーク
4k
平均マージ
13時間 49分
マージ済み PR(30日)
10

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

google/adk-python のほかの issue

google/adk-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。