Skip to content

feat(core): support strict plugin activation waits - #46615

Closed
kitlangton wants to merge 1 commit into
v2from
strict-plugin-readiness
Closed

feat(core): support strict plugin activation waits#46615
kitlangton wants to merge 1 commit into
v2from
strict-plugin-readiness

Conversation

@kitlangton

@kitlangton kitlangton commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Why

An instance constructor may need to reject a plugin generation that could not activate, such as host and instance definitions sharing a plugin ID. Core's normal awaitActivation deliberately reports settlement, not success, and logs generation failures without failing the waiter.

Constructors need an opt-in way to observe that failure without changing readiness behavior for existing callers.

What Changes

Add PluginSupervisor.configured({ failOnError: true }) for graph replacements:

Instance.layer(location, {
  plugins,
  replacements: [
    PluginSupervisor.node.replace(PluginSupervisor.configured({ failOnError: true })),
  ],
})

The strict readiness wait propagates the settled activation result. The ordinary node and omitted or false options retain log-and-continue behavior.

Generation failure is distinct from an individual plugin's setup failure: setup failures remain in plugin inventory. Consumers still decide which individual plugins are required.

Scope

Core capability prerequisite extracted from #46496, not a change to default readiness policy. SDK instance selection and admission policy remain in that dependent PR.

The former shared build prerequisite landed independently in 43d09b9d75; this PR now targets v2 directly.

Verification

Using Bun 1.4.0, from packages/core:

bun typecheck
bun run test test/config/plugin.test.ts test/instance-plugins.test.ts test/instance-vanilla.test.ts test/plugin.test.ts test/plugin-hooks.test.ts test/plugin/module.test.ts test/plugin/update.test.ts
bun run test test/config/plugin.test.ts --test-name-pattern 'PluginSupervisor awaitActivation' --rerun-each 10

After rebasing onto v2 at e2e82f18e2, the focused regression suite passed 57 tests and the eight readiness cases passed 80/80 repeated runs. Core typechecking, formatting, Effect AST rules, and diff checks passed. Scoped lint had no errors and one warning on an unchanged spread expression. Upstream's sanitized plugin-load errors, diagnostic references, and regression assertions are preserved. The normal pre-push workspace typecheck passed all 33 tasks.

The collision regression now uses an actual host/builtin duplicate ID; the old test registered the same host ID twice, which only overwrote a Map entry. Against the previous log-only behavior, the three non-strict cases pass and the strict assertion fails as expected.

Coverage includes gated package activation, isolated waiter interruption, coalesced pending updates, failure followed by successful reload, repeated waits, and individual setup failures remaining in inventory. The unchanged 24-hour timer was not time-advanced.

Earlier CI failed in the separate shell-retention stress test (#46610). The TUI Home-fixture repair landed independently in #46618; upstream later removed the scroll fixture in #46640, so #46620 was closed as superseded. None of those changes is part of this capability diff.

At the rebased head, run 33550675221 passed the Linux unit suites, then failed the generated-documentation check: the website OpenAPI copies in base v2 omit the diagnostic ref added in #46594. Windows exited with a native Bun 1.4.0 segmentation fault during the TUI suite, not a reported test assertion; its cause is not established. No documentation repair or crash workaround is included here.

@kitlangton
kitlangton force-pushed the strict-plugin-readiness branch from b350c7a to f217621 Compare September 1, 2026 15:44
@kitlangton
kitlangton changed the base branch from activation-check to v2 September 1, 2026 15:46
@kitlangton
kitlangton force-pushed the strict-plugin-readiness branch from f217621 to 7c8eda8 Compare September 1, 2026 19:38
@kitlangton

Copy link
Copy Markdown
Contributor Author

Superseded by #46639, which removed PluginSupervisor.Service and made the supervisor a boot task. The host/instance plugin ID collision this guarded for #46496 is now rejected in the SDK selector before construction, so no new Core readiness surface is needed.

@kitlangton kitlangton closed this Sep 2, 2026
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