Skip to content

Commit f81270d

Browse files
committed
Remove dead code involving TOOLSET_AUTH_CREDENTIAL_ID_PREFIX
1 parent d19e316 commit f81270d

2 files changed

Lines changed: 2 additions & 35 deletions

File tree

src/google/adk/auth/auth_preprocessor.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@
3131
from .auth_tool import AuthConfig
3232
from .auth_tool import AuthToolArguments
3333

34-
# Prefix used by toolset auth credential IDs.
35-
# Auth requests with this prefix are for toolset authentication (before tool
36-
# listing) and don't require resuming a function call.
37-
TOOLSET_AUTH_CREDENTIAL_ID_PREFIX = '_adk_toolset_auth_'
38-
3934

4035
async def _store_auth_and_collect_resume_targets(
4136
events: list[Event],
@@ -50,7 +45,7 @@ async def _store_auth_and_collect_resume_targets(
5045
``AuthToolArguments`` args, merges ``credential_key`` into the
5146
corresponding auth response, stores credentials via ``AuthHandler``,
5247
and returns the set of original function call IDs that should be
53-
re-executed (excluding toolset auth).
48+
re-executed.
5449
5550
Args:
5651
events: Session events to scan.
@@ -96,8 +91,7 @@ async def _store_auth_and_collect_resume_targets(
9691
state=state
9792
)
9893

99-
# Step 3: Collect original function call IDs to resume, skipping
100-
# toolset auth entries which don't map to a resumable function call.
94+
# Step 3: Collect original function call IDs to resume.
10195
tools_to_resume: set[str] = set()
10296
for fc_id in auth_fc_ids:
10397
requested_auth_config = requested_auth_config_by_id.get(fc_id)
@@ -115,10 +109,6 @@ async def _store_auth_and_collect_resume_targets(
115109
and function_call.name == REQUEST_EUC_FUNCTION_CALL_NAME
116110
):
117111
args = AuthToolArguments.model_validate(function_call.args)
118-
if args.function_call_id.startswith(
119-
TOOLSET_AUTH_CREDENTIAL_ID_PREFIX
120-
):
121-
continue
122112
tools_to_resume.add(args.function_call_id)
123113

124114
return tools_to_resume

tests/unittests/auth/test_toolset_auth.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -244,29 +244,6 @@ async def side_effect(*args, **kwargs):
244244
assert auth_config_without_cred.exchanged_auth_credential is None
245245

246246

247-
class TestAuthPreprocessorToolsetAuthSkip:
248-
"""Tests for auth preprocessor skipping toolset auth."""
249-
250-
def test_toolset_auth_prefix_skipped(self):
251-
"""Test that function calls with toolset auth prefix are skipped."""
252-
from google.adk.auth.auth_preprocessor import TOOLSET_AUTH_CREDENTIAL_ID_PREFIX
253-
254-
# Verify the prefix is correct
255-
assert TOOLSET_AUTH_CREDENTIAL_ID_PREFIX == "_adk_toolset_auth_"
256-
257-
# Test that a function_call_id starting with this prefix would be skipped
258-
toolset_function_call_id = f"{TOOLSET_AUTH_CREDENTIAL_ID_PREFIX}McpToolset"
259-
assert toolset_function_call_id.startswith(
260-
TOOLSET_AUTH_CREDENTIAL_ID_PREFIX
261-
)
262-
263-
# Regular tool auth function_call_id should NOT start with prefix
264-
regular_function_call_id = "call_123"
265-
assert not regular_function_call_id.startswith(
266-
TOOLSET_AUTH_CREDENTIAL_ID_PREFIX
267-
)
268-
269-
270247
class TestCallbackContextGetAuthResponse:
271248
"""Tests for CallbackContext.get_auth_response method."""
272249

0 commit comments

Comments
 (0)