Skip to content

fix(coding-agent): include Bedrock in Node bundle - #860

Closed
imMamdouhaboammar wants to merge 1 commit into
PrimeIntellect-ai:mainfrom
imMamdouhaboammar:fix/bedrock-bundle-integrity
Closed

imMamdouhaboammar wants to merge 1 commit into
PrimeIntellect-ai:mainfrom
imMamdouhaboammar:fix/bedrock-bundle-integrity

Conversation

@imMamdouhaboammar

@imMamdouhaboammar imMamdouhaboammar commented Aug 7, 2026 •

Copy link
Copy Markdown

Summary

  • add the compiled Amazon Bedrock provider as an explicit esbuild entry alongside the CLI
  • keep the existing lazy node-only provider loading path intact
  • fail the bundle step when an importNodeOnlyProvider("./x.js") reference points to an asset that was not emitted

Root cause

packages/ai/src/providers/register-builtins.ts loads Bedrock through importNodeOnlyProvider("./amazon-bedrock.js"), where the helper calls import(specifier). Because that import specifier is dynamic from esbuild's perspective, the coding-agent bundle does not emit dist/bundle/amazon-bedrock.js even though the generated CLI chunk still references it.

This is reproducible on current main: a clean build produced no Bedrock bundle asset while the CLI chunk contained the unresolved ./amazon-bedrock.js reference.

Validation

Before the fix, the new integrity check failed with:

Bundle contains missing node-only provider assets:
- chunk-27BW5CFV.js -> ./amazon-bedrock.js

After adding the explicit entry:

  • root npm run build passed
  • dist/bundle/amazon-bedrock.js was emitted and imports successfully
  • the emitted module exports streamBedrock and streamSimpleBedrock
  • root npm run check passed
  • npm pack --workspace packages/coding-agent --dry-run --json includes dist/bundle/amazon-bedrock.js
  • git diff --check passed

This addresses the source-side cause of #751. The already-published v0.7.0 artifact still requires a replacement release or a new release after this lands.

Note

Include Amazon Bedrock provider in coding-agent Node bundle

  • Adds amazon-bedrock as a second esbuild entry point in bundle.mjs, alongside the existing cli entry, so the Bedrock provider is emitted into the bundle output.
  • Adds a verifyNodeOnlyProviderAssets post-build check that scans output .js files for importNodeOnlyProvider calls and throws if any referenced asset files are missing.

Macroscope summarized 36842d0.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@seankumar-tl

Copy link
Copy Markdown

Confirming this reproduces on the released v0.7.1, not just main, so the fix is still needed. A fresh 0.7.1 install has all eight other provider entry points in dist/bundle/ and no amazon-bedrock.js, and any Bedrock model dies with Cannot find module .../dist/bundle/amazon-bedrock.js.

Relevant to #751, where the missing chunk is still attributed to the @aws-sdk/core registry gap from #651: 0.7.1 was built after that cleared and the chunk is still missing, which points at your root cause rather than that one.

I landed on the same diagnosis from the shipped artifact before I found this PR, and confirmed the emitted module only has to satisfy streamBedrock / streamSimpleBedrock. A local re-export at dist/bundle/amazon-bedrock.js pointing at the packages/ai copy is enough to make Bedrock stream correctly, which matches your validation notes.

One small thing on verifyNodeOnlyProviderAssets: the regex requires a literal argument, so it covers today's call sites but would pass silently if anyone ever passed a variable into importNodeOnlyProvider, which is the exact shape that caused this bug. Probably fine as is, just noting the check inherits the blind spot it's guarding against.

@fettpl

fettpl commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

@badlogic this is now the remaining source fix for #751 and the official Homebrew submission tracked in #843. The released v0.7.1 archive still omits dist/bundle/amazon-bedrock.js, matching this PR's root cause.

CI is currently action_required because the branch comes from a fork. Could you approve run 31189426821 and review this PR? A corrected stable release after this and #846 will unblock the Prime Agent side of Homebrew/homebrew-core#297372.

Copy link
Copy Markdown
Member

Hi, thanks for taking the time to contribute to Prime Agent! Since open sourcing the project, we’ve received far more pull requests than we can responsibly review and validate. Prime Agent runs directly on users’ machines, so we need to be deliberate about which changes we accept and how they are reviewed. Rather than leave a large backlog that we cannot meaningfully work through, we’re closing the current PR queue and moving to a discussion-first contribution process.

We have established new contribution guidelines to help us continue iterating on Prime Agent and better manage contributions from the community. Going forward, we won’t review unsolicited pull requests. Instead, please start with a GitHub Discussion. We’ll identify recurring bugs and feature requests, create Issues for work we want to pursue, and invite pull requests from maintainers or vouched contributors when implementation is ready. Please read the full process documented in our contribution guidelines.

While we’re closing this backlog, we’re still reviewing it at a high level to identify recurring bugs, useful ideas, and important problems that we should address ourselves. Thanks again for the time you put into this!

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.

4 participants