Repository navigation
Commit 20ee4a2
docs(sessions): correct the rationale for InMemorySessionService event deduplication
The deduplication guard in `InMemorySessionService.append_event` was documented as protecting against an orchestrator broadcasting the same `Event` to several concurrent `Session` references (#5723). ADK has no such broadcast: within one invocation all parallel branches share a single `InvocationContext.session` and serialize their appends, every produced event carries a fresh id, and persistent backends reject stale snapshots with `StaleSessionError` and enforce unique `event.id` keys.
The guard is still worth keeping for a different reason: it makes `append_event` idempotent for an equal re-delivery of an event, which callers that retry the call (e.g. a write buffer behind an RPC) rely on to avoid double-applying state or inflating their buffer. Reword the comment and the test docstrings to describe that contract; no behavior change.
Co-authored-by: Shangjie Chen <deanchen@google.com>
PiperOrigin-RevId: 9966374581 parent cb6d679 commit 20ee4a2
2 files changed
Lines changed: 15 additions & 14 deletions
File tree
- src/google/adk/sessions
- tests/unittests/sessions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3889 | 3889 | | |
3890 | 3890 | | |
3891 | 3891 | | |
3892 | | - | |
| 3892 | + | |
3893 | 3893 | | |
3894 | 3894 | | |
3895 | 3895 | | |
| |||
3902 | 3902 | | |
3903 | 3903 | | |
3904 | 3904 | | |
3905 | | - | |
3906 | | - | |
| 3905 | + | |
| 3906 | + | |
| 3907 | + | |
3907 | 3908 | | |
3908 | 3909 | | |
3909 | 3910 | | |
| |||
3917 | 3918 | | |
3918 | 3919 | | |
3919 | 3920 | | |
3920 | | - | |
3921 | | - | |
| 3921 | + | |
| 3922 | + | |
3922 | 3923 | | |
3923 | 3924 | | |
3924 | 3925 | | |
| |||
0 commit comments