Skip to content

fix(eval): ignore UI-only InvocationEvent fields on eval case save - #7096

Closed
Anusha0501 wants to merge 2 commits into
google:mainfrom
Anusha0501:fix/eval-ignore-web-ui-invocation-indices
Closed

Anusha0501 wants to merge 2 commits into
google:mainfrom
Anusha0501:fix/eval-ignore-web-ui-invocation-indices

Conversation

@Anusha0501

@Anusha0501 Anusha0501 commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Please ensure you have read the contribution guide before creating a pull request.

Link to Issue or Description of Change

1. Link to an existing issue (if applicable):

2. Or, if no issue exists, describe the change:

Problem:
Saving an eval case from the adk web editor returns HTTP 422 Unprocessable Entity. The editor serializes UI-only transcript fields (invocationIndex, toolUseIndex) onto each InvocationEvent. EvalBaseModel uses extra="forbid", so FastAPI rejects the PUT body as extra_forbidden.

Solution:
Override InvocationEvent with extra="ignore" (same ConfigDict pattern as EvalCase / SessionInput). Unknown UI fields are dropped at parse time, the save succeeds, and those indices are not persisted in the eval-case JSON.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.

PYTHONPATH=src pytest tests/unittests/evaluation/test_eval_case.py

23 passed

Added test_eval_case_put_accepts_web_ui_transcript_indices, which validates the reporter payload from #7019 and asserts invocationIndex / toolUseIndex are not stored.

Manual End-to-End (E2E) Tests:

  • Run adk web for an agent that uses tools
  • Create a session, add it to an eval set, edit a message, click Save
  • Expect HTTP 200 (not 422)
  • Confirm the stored eval-case JSON does not contain invocationIndex or toolUseIndex

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

Additional context

#7026 only defaults RubricContent.text_property. The reporter confirmed that does not fix this save. Maintainer diagnosis on #7019: extra_forbidden on invocationIndex and toolUseIndex inside conversation[0].intermediateData.invocationEvents.

@google-cla

google-cla Bot commented Sep 12, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@Anusha0501
Anusha0501 force-pushed the fix/eval-ignore-web-ui-invocation-indices branch from 7d82908 to cecec57 Compare September 12, 2026 08:54
The adk web eval editor attaches invocationIndex and toolUseIndex to each
event. Those fields are not part of the eval schema, so PUT /eval-cases
returned 422. Ignore unknown fields so the save succeeds without persisting
the UI indices.

Fixes google#7019
@Anusha0501
Anusha0501 force-pushed the fix/eval-ignore-web-ui-invocation-indices branch from cecec57 to a553c55 Compare September 12, 2026 08:57
copybara-service Bot pushed a commit that referenced this pull request Sep 16, 2026
Merge #7096

**Please ensure you have read the [contribution guide](https://github.com/google/adk-python/blob/main/CONTRIBUTING.md) before creating a pull request.**

### Link to Issue or Description of Change

**1. Link to an existing issue (if applicable):**

- Closes: #7019
- Related: #7026 (different 422: missing `RubricContent.text_property` default; does not cover this extra-fields case)

**2. Or, if no issue exists, describe the change:**

**Problem:**
Saving an eval case from the `adk web` editor returns HTTP 422 Unprocessable Entity. The editor serializes UI-only transcript fields (`invocationIndex`, `toolUseIndex`) onto each `InvocationEvent`. `EvalBaseModel` uses `extra="forbid"`, so FastAPI rejects the PUT body as `extra_forbidden`.

**Solution:**
Override `InvocationEvent` with `extra="ignore"` (same ConfigDict pattern as `EvalCase` / `SessionInput`). Unknown UI fields are dropped at parse time, the save succeeds, and those indices are not persisted in the eval-case JSON.

### Testing Plan

**Unit Tests:**

- [x] I have added or updated unit tests for my change.
- [x] All unit tests pass locally.

`PYTHONPATH=src pytest tests/unittests/evaluation/test_eval_case.py`

```
23 passed
```

Added `test_eval_case_put_accepts_web_ui_transcript_indices`, which validates the reporter payload from #7019 and asserts `invocationIndex` / `toolUseIndex` are not stored.

**Manual End-to-End (E2E) Tests:**

- Run `adk web` for an agent that uses tools
- Create a session, add it to an eval set, edit a message, click Save
- Expect HTTP 200 (not 422)
- Confirm the stored eval-case JSON does not contain `invocationIndex` or `toolUseIndex`

### Checklist

- [x] I have read the [CONTRIBUTING.md](https://github.com/google/adk-python/blob/main/CONTRIBUTING.md) document.
- [x] I have performed a self-review of my own code.
- [x] I have commented my code, particularly in hard-to-understand areas.
- [x] I have added tests that prove my fix is effective or that my feature works.
- [x] New and existing unit tests pass locally with my changes.
- [ ] I have manually tested my changes end-to-end.
- [ ] Any dependent changes have been merged and published in downstream modules.

### Additional context

`#7026` only defaults `RubricContent.text_property`. The reporter confirmed that does not fix this save. Maintainer diagnosis on #7019: `extra_forbidden` on `invocationIndex` and `toolUseIndex` inside `conversation[0].intermediateData.invocationEvents`.

Co-authored-by: Yi Liu <yiliuly@google.com>
COPYBARA_INTEGRATE_REVIEW=#7096 from Anusha0501:fix/eval-ignore-web-ui-invocation-indices 782eb0c
PiperOrigin-RevId: 982699482
@adk-bot

adk-bot commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Thank you @Anusha0501 for your contribution! 🎉

Your changes have been successfully imported and merged via Copybara in commit a4a50a4.

Closing this PR as the changes are now in the main branch.

@adk-bot adk-bot added the merged [Status] This PR is merged label Sep 16, 2026
@adk-bot adk-bot closed this Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged [Status] This PR is merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

422 Unprocessable Entity in versions 2.6.0, 2.7.0, 2.8.0 when trying to save an eval case

3 participants