[PR #9854] fix: cache BunProc.install for 'latest' to avoid repeated AWS SDK installs on startup #13244

Open
opened 2026-02-16 18:18:06 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/9854

State: open
Merged: No


Summary

When AWS_PROFILE is set, the amazon-bedrock provider installs @aws-sdk/credential-providers via BunProc.install with version latest. Previously, latest never matched the recorded dependency version, causing bun add to run on every startup (~5s delay).

Now BunProc.install skips bun add when:

  • The module directory exists AND
  • A resolved version is already recorded, OR
  • The installed package.json has a version (which we then record)

Metrics (with AWS_PROFILE set, fresh vs cached)

  • Cold start: ~4.93s
  • Warm start: ~1.20s

Changes

  • packages/opencode/src/bun/index.ts: Cache latest installs by reusing existing module and recording resolved version
  • packages/opencode/test/bun.test.ts: Add tests for the new caching behavior

Fixes #7614

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/9854 **State:** open **Merged:** No --- ## Summary When `AWS_PROFILE` is set, the amazon-bedrock provider installs `@aws-sdk/credential-providers` via `BunProc.install` with version `latest`. Previously, `latest` never matched the recorded dependency version, causing `bun add` to run on every startup (~5s delay). Now `BunProc.install` skips `bun add` when: - The module directory exists AND - A resolved version is already recorded, OR - The installed package.json has a version (which we then record) ## Metrics (with AWS_PROFILE set, fresh vs cached) - **Cold start:** ~4.93s - **Warm start:** ~1.20s ## Changes - `packages/opencode/src/bun/index.ts`: Cache `latest` installs by reusing existing module and recording resolved version - `packages/opencode/test/bun.test.ts`: Add tests for the new caching behavior Fixes #7614
yindo added the pull-request label 2026-02-16 18:18:06 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13244