Repository navigation
fix(core): wait for the automation target's plugin registry - #66104
Conversation
There was a problem hiding this comment.
Looks good. On the base, the new SDK test fails every time with Unknown Code Mode tool: fixture_ping (5 of 5 runs). With this change it passes, along with the rest of instances.test.ts (including the existing tests where a cold instance plugin creates an automation during setup) and the core automation and plugin tests. Core and sdk type-check cleanly with tsc -b.
Skipping the wait only when the calling plugin's registry is the one doing the authorization is the right check: a plugin never waits on its own setup, and every other registry is still awaited, including another one at the same Location.
Public API: unchanged. AutomationCode.FromPlugin and PluginHost.make are internal, and the plugin-facing automation.create keeps its shape.
# Conflicts: # packages/core/src/plugin/host.ts
There was a problem hiding this comment.
The new commit only merges dev into the branch, and it fits with this change: #66103's decode now sits next to the FromPlugin change in plugin/host.ts without conflict. At the new head, the SDK instance tests (including the new one) and the core automation tests pass, and core type-checks cleanly. Public API: unchanged. No new concerns.
#65987 let plugins create automations during setup without waiting on their own registry. In the SDK, an instance and its host can share a Location but have separate plugin registries. If the host is still activating a plugin that provides a Code Mode tool, the instance plugin's automation create can skip the host's readiness check and reject the tool as unknown. An uncaught rejection also prevents the instance from booting.
Pass the calling registry through the plugin context and skip the wait only when it's the same registry that authorization uses. The registry used for authorization and the permission checks are unchanged. No new feature flag is needed for this fix.
Verification
From
packages/sdk, using a host plugin that registers an inert tool only after the instance plugin starts the create:Before (test-only on
dev):After:
Found by the daily review job.