google / google/adk-python

`create_gcs_eval_managers_from_uri` doesn't extract bucket from path, contradicting its own docstring

Ouverte
#6,881 3 commentaires 0 réactions 1 personne assignée Réclamée par @sanketpatil06 Voir sur GitHub
eval
Langage dominant
Python
Étoiles
21.5k
Forks
4k
Merge moyen
1 j 14 h
PR mergées (30 j)
37

Description

### Description

`create_gcs_eval_managers_from_uri()` in [`[src/google/adk/cli/utils/evals.py]`](https://github.com/google/adk-python/blob/main/src/google/adk/cli/utils/evals.py) has a docstring that says:

> `eval_storage_uri`: The evals storage URI to use. Supported URIs: `gs://`. If a path is provided, the bucket will be extracted.

But the implementation never extracts a bucket from a path; it treats everything after `gs://` as the literal bucket name:

```python
if eval_storage_uri.startswith('gs://'):
gcs_bucket = eval_storage_uri.split('://')[1]
```

`'gs://my-bucket/some/path'.split('://')[1]` returns `'my-bucket/some/path'`, slashes included, not `'my-bucket'`.

### Repro

```python
from google.adk.cli.utils.evals import create_gcs_eval_managers_from_uri

create_gcs_eval_managers_from_uri("gs://my-bucket/some/path")
```

### Expected behavior

Per the docstring, this should extract `my-bucket` as the bucket name and (presumably) use `some/path` as a prefix/subdirectory for eval storage.

### Actual behavior

`gcs_bucket` ends up as the literal string `"my-bucket/some/path"`. This is passed straight into both `GcsEvalSetsManager` and `GcsEvalSetResultsManager`:

```python
self.bucket = self.storage_client.bucket(self.bucket_name)
if not self.bucket.exists():
raise ValueError(f"Bucket `{self.bucket_name}` does not exist...")
```

`storage_client.bucket(name)` doesn't validate the name locally, so this only fails later at `.exists()`, which 404s because GCS bucket names can never contain `/`. The resulting error —

```
ValueError: Bucket `my-bucket/some/path` does not exist. Please create it before using the GcsEvalSetsManager.
```

— is misleading: the real bucket (`my-bucket`) may well exist; the tool just built an invalid bucket name from the path segment.

### Additional note

Even if bucket extraction were implemented, the path portion currently has nowhere to go — `_get_eval_history_dir()` / `_get_eval_sets_dir()` hard-code `{app_name}/evals/eval_history` and `{app_name}/evals/eval_sets` respectively, with no support for a custom prefix within the bucket.

### Environment

- `google-adk` version: 2.0.0 (confirmed still present on `main` as of 2026-08-24)
- Reproduced in both `GcsEvalSetsManager` and `GcsEvalSetResultsManager`

### Suggested fix
- Implement the extraction the docstring promises (e.g. `eval_storage_uri.split('://')[1].split('/')[0]` for the bucket, with the remainder threaded through as a storage prefix), or

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.