google / google/adk-python

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

Abierto
#6,881 3 comentarios 0 reacciones 1 asignado Reclamado por @sanketpatil06 Ver en GitHub
eval
Lenguaje dominante
Python
Estrellas
21.5k
Forks
4k
Merge medio
1 d 22 h
PR fusionados (30 d)
31

Descripción

### 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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.