Skip to content

fix(core): wait for the automation target's plugin registry - #66104

Merged
vimtor merged 2 commits into
devfrom
fix-registry-readiness
Nov 24, 2026
Merged

vimtor merged 2 commits into
devfrom
fix-registry-readiness

Conversation

@vimtor

@vimtor vimtor commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

#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:

bun test test/instances.test.ts -t "waits for the host's tool registry" --rerun-each 10

Before (test-only on dev):

error: expect(received).toEqual(expected)

  [
-   "hourly",
+   [InvalidError: Unknown Code Mode tool: fixture_ping],
  ]

0 pass
10 fail

After:

10 pass
0 fail

Found by the daily review job.

@vimtor
vimtor marked this pull request as ready for review November 24, 2026 13:56
@vimtor
vimtor enabled auto-merge (squash) November 24, 2026 13:57

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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
@vimtor
vimtor merged commit f84258d into dev Nov 24, 2026
10 checks passed
@vimtor
vimtor deleted the fix-registry-readiness branch November 24, 2026 14:13

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant