You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make session_id optional in TaskStore; reject stateless mode instead
Previously, session_id was required (str) throughout the task store
interface, which forced sessionless transports like stdio and memory
to fabricate UUIDs before running tasks. This was awkward because
those transports are single-client by architecture and have no session
concept.
The policy is now enforced at the handler layer instead of the store
layer: default task handlers reject requests when the server is in
stateless mode (where tasks cannot survive across requests), and pass
session_id through as-is otherwise. A None session_id simply means no
session-scoped isolation, which is correct for single-client transports.
Isolation in InMemoryTaskStore uses strict equality: None only matches
None, so tasks created by a sessionless transport are not visible to
session-scoped transports and vice versa, preventing cross-transport
leaks when a process serves multiple transports from one store.
Changes:
- TaskStore, InMemoryTaskStore, TaskContext, helpers: session_id is
now str | None
- ServerSession: expose stateless property
- Default task handlers: reject stateless mode, pass session_id as-is
- run_task() / ServerTaskContext: accept None session_id, reject
stateless mode
- Memory transport: revert fabricated UUID session_id
- New tests for None-session isolation (strict equality, no
cross-transport leaks)
:house: Remote-Dev: homespace
0 commit comments