Skip to content

Conversation

tconley1428
Copy link
Contributor

@tconley1428 tconley1428 commented Oct 2, 2025

What was changed

  • Changed Plugin interfaces to remove initializers and use invocation provided callables instead. This will prevent issues if the same plugin is used across multiple objects: clients, workers, etc.
  • Added a method for easy creation of relatively simple plugins. The underlying interface can still be implemented if needed.

Why?

Checklist

  1. Closes

  2. How was this tested:
    New Tests

  3. Any docs updates needed?

@tconley1428 tconley1428 changed the title Add static plugin constructor 💥 Plugin Overhaul Oct 3, 2025
@tconley1428 tconley1428 marked this pull request as ready for review October 3, 2025 20:43
@tconley1428 tconley1428 requested a review from a team as a code owner October 3, 2025 20:43
Copy link
Member

@Sushisource Sushisource left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks awesome to me

Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nothing blocking, but I do wish we didn't have to introduce an entirely new top-level module for this one class.

Comment on lines 49 to 50
# Activities won't be used by replayer
register_activities=False,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something we expect users to do or should the plugin be self-aware enough to account for this itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a fair point. It's all a bit odd with the change to SimplePlugin because the activity won't actually be registered, since they aren't part of ReplayerConfig but they need to be constructed to pass to the SimplePlugin constructor. I'll give it some thought. We could switch to callable use to delay it.

Copy link
Member

@cretz cretz Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, just because we have SimplePlugin doesn't mean the OpenAIPlugin has to leverage it. And even if it does leverage it, now that SimplePlugin is a class, just because it accepts activities doesn't mean you have to use it, you can just append the activity at worker creation/run time only.

However, what you are facing here is what other plugin developers will face. The benefit of the existing plugin interface is that they must think about this as authors of plugins that need to be properly usable by users. Had you not been familiar with Temporal, you would have been surprised by a user talking about the plugin not properly understanding replayers.

(note this thread is more just chatter, it does not affect my already-set approval)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely doesn't have to, but it is a good exercise. I considered subclassing instead and went with a callable for now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do think this is a bit complicated compared to just overriding the method. Hopefully users understand that they need to initialize the activity in the callable too, not just return it there.

I saw the decision to use callables was made, this conversation was marked resolved, and the merge was performed. I also saw as part of this we removed the ability to not register activities in OpenAI plugin. Can we make sure we track the effort to allow splitting workflow workers and activity workers with this plugin?

Copy link
Member

@Sushisource Sushisource left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok! Sold! This is the best consensus we've had on this interface, and I think we've got a nice API that allows for progressive complexity now. Thanks for the work on this Tim.

@tconley1428 tconley1428 merged commit 5e93e63 into main Oct 7, 2025
15 checks passed
@tconley1428 tconley1428 deleted the static_plugin branch October 7, 2025 17:01
assert worker.config().get("workflows") == []


class MediumPlugin(SimplePlugin):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beautiful

@drewhoskins-temporal
Copy link

Beautiful, thanks for adding the test and overall to the team for rallying around this and building something really polished.

1 similar comment
@drewhoskins-temporal
Copy link

Beautiful, thanks for adding the test and overall to the team for rallying around this and building something really polished.

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.

5 participants