Repository navigation
Commit 52030cf
test(cluster): only require accepted follow-ups to survive the replica race (a2aproject#1303)
# Description
`tests/integration/test_multiserver.py::test_concurrent_followups_no_lost_update[mysql]`
fails intermittently in CI on unrelated pull requests (e.g. the runs for
a2aproject#1236, a2aproject#1300, the SSE grace-period and signing branches), always with:
```
AssertionError: ['m1', '<agent message id>', 'ma'] # assert 2 == 3
```
I reproduced it locally against `mysql:8.0` with the CI settings and
tallied 300 runs of the scenario:
| Follow-up results (replica A, replica B) | User turns persisted | Runs
|
|---|---|---|
| success, success | 3 | 297 |
| success, `InternalError` ("…was modified concurrently by another
writer") | 2 | 3 |
So nothing is lost silently: in every failing run the follow-up whose
message is missing was **rejected** with an `A2AError`. That is the
documented behaviour of `ActiveTask` — on
`ConcurrentTaskModificationError` it reloads and retries the event once,
and if the other replica keeps advancing the task it reports an
`InternalError`. The test, however, demanded all three user turns even
when one follow-up was rejected.
This PR changes only the assertion to the actual guarantee:
- the first turn and every follow-up that **returned successfully** are
in the persisted history;
- at least one of the two racing follow-ups succeeds.
A follow-up that is accepted but then dropped would still fail the test.
With the change, 300 consecutive runs against MySQL pass;
`scripts/lint.sh` is clean and the full suite passes with
`MYSQL_TEST_DSN` set (2271 passed).
Whether a rejected follow-up should instead be retried until it lands is
a design question for the cluster mode; this PR doesn't change runtime
behaviour.
- [x] Follow the [`CONTRIBUTING`
Guide](https://github.com/a2aproject/a2a-python/blob/main/CONTRIBUTING.md).
- [x] Make your Pull Request title in the
<https://www.conventionalcommits.org/> specification.
- [x] Ensure the tests and linter pass
- [x] Appropriate docs were updated (if necessary)
Co-authored-by: mykytanetipa <mykytanetipa@google.com>1 parent ee61dc1 commit 52030cf
1 file changed
Lines changed: 19 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
316 | | - | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
317 | 322 | | |
318 | 323 | | |
319 | 324 | | |
| |||
349 | 354 | | |
350 | 355 | | |
351 | 356 | | |
352 | | - | |
| 357 | + | |
353 | 358 | | |
354 | 359 | | |
355 | 360 | | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
360 | 373 | | |
361 | 374 | | |
362 | 375 | | |
| |||
0 commit comments