Skip to content

fix(ci): lazy-load Anthropic SDK so the bots' OAuth path needs no SDK#251

Closed
KrasimirKralev wants to merge 1 commit into
ID-Robots:mainfrom
KrasimirKralev:fix/bot-lazy-sdk-import
Closed

fix(ci): lazy-load Anthropic SDK so the bots' OAuth path needs no SDK#251
KrasimirKralev wants to merge 1 commit into
ID-Robots:mainfrom
KrasimirKralev:fix/bot-lazy-sdk-import

Conversation

@KrasimirKralev

Copy link
Copy Markdown
Contributor

Hotfix for the live bots on main. The OAuth transport (#248) installs only the Claude Code CLI, not @anthropic-ai/sdk — but both scripts/pr-review.mjs and scripts/issue-triage.mjs had a static top-level import Anthropic from "@anthropic-ai/sdk", evaluated at module load regardless of which transport runs. Result: the review / triage job crashes with ERR_MODULE_NOT_FOUND before doing anything.

It slipped through because my local test machine still had the SDK installed from an earlier run; CI (OAuth-only install) exposed it — caught on the #250 CI run.

Fix: move the import to a dynamic await import("@anthropic-ai/sdk") inside reviewViaSdk / classifyViaSdk, reached only on the API-key fallback path. The OAuth/CLI path never touches it.

Verified by running the OAuth path locally with scripts/node_modules removed — full review produced, no SDK present. The identical fix rides to beta in #250.

The OAuth transport (shipped in ID-Robots#248) installs only the Claude Code CLI, not
@anthropic-ai/sdk, but both bot scripts had a static top-level 'import
Anthropic from @anthropic-ai/sdk' evaluated at module load regardless of
transport — so the live bots on main crash with ERR_MODULE_NOT_FOUND before
running. Moved the import into a dynamic import() inside
reviewViaSdk/classifyViaSdk, reached only on the API-key fallback. Verified
by running the OAuth path with node_modules removed. Same fix rides to beta
in ID-Robots#250.
@KrasimirKralev
KrasimirKralev requested a review from a team as a code owner July 5, 2026 09:40
@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@KrasimirKralev, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 47 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: f2c49ab8-1cbb-445b-afe7-4b61af45ad2a

📥 Commits

Reviewing files that changed from the base of the PR and between e4bd878 and 62f5a45.

📒 Files selected for processing (2)
  • scripts/issue-triage.mjs
  • scripts/pr-review.mjs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@KrasimirKralev

Copy link
Copy Markdown
Contributor Author

Superseded by the mascot reshape PR, which includes this exact SDK lazy-load fix as its first commit.

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