Skip to content

fix(core): flush plugin reload generations - #41309

Merged
kitlangton merged 1 commit into
v2from
fix-location-flush
Aug 9, 2026
Merged

fix(core): flush plugin reload generations#41309
kitlangton merged 1 commit into
v2from
fix-location-flush

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

What

Makes PluginSupervisor.flush wait for the current plugin activation generation, including hot reloads after startup, and repairs the regression test so it cannot deadlock.

Before / After

Before: 5b3997294757758c8d0e4fc13196a4c3211286fa introduced flush as an await of one startup Deferred. Once startup completed, every later flush returned immediately even if a hot reload was active. Its "keeps flush open while later hot reload runs" test synchronously awaited that flush before releasing the deliberately blocked activation. Depending on update observation timing, the test either passed for the wrong reason (flush returned too early) or deadlocked until Bun's 5-second timeout.

After: accepting work replaces a completed generation barrier, activation completes the current barrier only after all observed work settles, and each flush resolves the barrier current at execution time. The test forks flush, verifies it remains pending, releases activation, and joins it.

How

  • packages/core/src/plugin/supervisor.ts rotates the readiness Deferred when post-ready work is observed.
  • flush uses Effect.suspend so callers await the current generation rather than the startup generation captured while constructing the service.
  • packages/core/test/location-layer.test.ts exercises the intended ordering without blocking its own release step.

This is a fix rather than a revert because the plugin readiness behavior introduced by the culprit commit is required; only its one-shot generation tracking was incomplete.

Scope

This PR only addresses plugin flush generation tracking. The independent recorded OpenAI cassette mismatch and TUI CI races are handled in separate PRs.

Testing

  • cd packages/core && bun typecheck passes.
  • cd packages/core && bun run test test/location-layer.test.ts passes three consecutive runs: 18 tests each, 0 failures.
  • cd packages/core && bun run test passes all location-layer tests. The full suite still reports the independent recorded session-runner timeout and the documented local-only PluginSupervisor config > logs invalid packages and continues loading failure caused by global user plugins.
  • The repository pre-push typecheck passes all 33 configured package tasks.

@kitlangton
kitlangton merged commit 4eff0ee into v2 Aug 9, 2026
8 of 10 checks passed
@kitlangton
kitlangton deleted the fix-location-flush branch August 9, 2026 00:18
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