Skip to content

💥 Unify SimplePlugin interceptors into single parameter#1328

Open
tconley1428 wants to merge 1 commit intomainfrom
simpleplugin-unified-interceptors
Open

💥 Unify SimplePlugin interceptors into single parameter#1328
tconley1428 wants to merge 1 commit intomainfrom
simpleplugin-unified-interceptors

Conversation

@tconley1428
Copy link
Contributor

Summary

  • 💥 BREAKING CHANGE: Replace separate client_interceptors and worker_interceptors parameters with a single unified interceptors parameter in SimplePlugin
  • Automatically separate client and worker interceptors based on type implementation
  • Ensure exactly one instance of each interceptor per worker to prevent duplication

Breaking Changes

For SimplePlugin Users

Before:

plugin = SimplePlugin(
    "MyPlugin",
    client_interceptors=[my_client_interceptor],
    worker_interceptors=[my_worker_interceptor]
)

After:

plugin = SimplePlugin(
    "MyPlugin",
    interceptors=[my_client_interceptor, my_worker_interceptor]  # Mixed list
)

The plugin will automatically:

  • Apply client interceptors to clients
  • Apply worker interceptors to workers and replayers
  • Prevent duplicate invocation when the same interceptor implements both interfaces

Implementation Details

  • Updated configure_client() to filter unified interceptors to client-only types
  • Updated configure_worker() to filter unified interceptors to worker types and prevent duplication with client-registered interceptors
  • Updated configure_replayer() to use worker interceptors from unified list
  • Fixed OpenTelemetryPlugin and OpenAIAgentsPlugin to use new parameter
  • Added comprehensive type casting to handle union types properly

Test Coverage

  • All existing plugin tests pass with updated parameter usage
  • Comprehensive test coverage for interceptor duplication prevention
  • Tests verify exactly one invocation per worker for combined client/worker interceptors

🤖 Generated with Claude Code

BREAKING CHANGE: SimplePlugin constructor now takes a single `interceptors` parameter instead of separate `client_interceptors` and `worker_interceptors` parameters.

Changes:
- Replace `client_interceptors` and `worker_interceptors` with unified `interceptors` parameter
- Automatically separate client and worker interceptors based on type
- Ensure exactly one instance of each interceptor per worker to prevent duplication
- Update OpenTelemetryPlugin and OpenAIAgentsPlugin to use new parameter
- Update all tests to use new unified parameter

Migration guide for SimplePlugin users:
- Before: `SimplePlugin("name", client_interceptors=[...], worker_interceptors=[...])`
- After: `SimplePlugin("name", interceptors=[...])`

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@tconley1428 tconley1428 requested a review from a team as a code owner February 13, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant