-
Notifications
You must be signed in to change notification settings - Fork 10
[extensions] Avoid global state in the ADK plugin #169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the ADK plugin to eliminate global state by moving plugin state management from class-level dictionaries to per-invocation context extension data. This improves thread safety and prevents state leakage between concurrent invocations.
Key changes:
- Introduced extension data storage in
ServerInvocationContextwith lifecycle management - Replaced global
_modelsand_turnstilesdictionaries with context-boundPluginState - Added automatic cleanup of extension data via
auto_close_extension_datacontext manager
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| python/restate/server_context.py | Adds extension data API (get/set/clear) and auto-cleanup context manager to ServerInvocationContext |
| python/restate/ext/adk/plugin.py | Refactors RestatePlugin to use context extension data instead of instance-level dictionaries for state management |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
No description provided.