Skip to content

fix(cli): preserve plugin commands in split bundles - #2377

Merged
ymichael merged 1 commit into
mainfrom
bb/post-merge-fix-preserve-plugin-command-interop-thr_4xkse3sswa
Aug 25, 2026
Merged

fix(cli): preserve plugin commands in split bundles#2377
ymichael merged 1 commit into
mainfrom
bb/post-merge-fix-preserve-plugin-command-interop-thr_4xkse3sswa

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

What was wrong

The code-split CLI dynamically imported the CommonJS undici package and requested its named Agent export, but esbuild emitted that split chunk with only a default export. Every plugin-contributed command therefore failed while constructing its dispatcher, before the server-side handler ran; ordinary core commands were unaffected.

What changed

The plugin proxy now statically imports Agent inside its already lazy-loaded module and caches the dispatcher synchronously, preserving bundler interop without adding undici to core-command startup. The startup-graph suite now executes both a direct plugin command and bb plugin run from a real split artifact against a small HTTP fixture. No CLI contract, documentation, server/daemon wire behavior, or HOST_DAEMON_PROTOCOL_VERSION change is required.

How you verified

The new split-artifact regression test failed before the production change with Agent is not a constructor and passes after it.

  • pnpm exec turbo run test --filter=@bb/cli --force — 50 files, 476 tests passed
  • pnpm exec turbo run typecheck --filter=@bb/cli --force — 4 tasks passed
  • pnpm exec turbo run build --filter=bb-app --force — 11 tasks passed
  • Dev and packaged split artifacts both ran direct automation --help, explicit plugin run automations --help, and core status --json successfully

Fixes #2349

AGENT GENERATED

@ymichael
ymichael merged commit c2837e0 into main Aug 25, 2026
15 checks passed
@ymichael
ymichael deleted the bb/post-merge-fix-preserve-plugin-command-interop-thr_4xkse3sswa branch August 25, 2026 03:58
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.

1 participant