fix(ci): lazy-load Anthropic SDK so the bots' OAuth path needs no SDK#251
fix(ci): lazy-load Anthropic SDK so the bots' OAuth path needs no SDK#251KrasimirKralev wants to merge 1 commit into
Conversation
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.
|
Warning Review limit reached
Next review available in: 47 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Superseded by the mascot reshape PR, which includes this exact SDK lazy-load fix as its first commit. |
Hotfix for the live bots on main. The OAuth transport (#248) installs only the Claude Code CLI, not
@anthropic-ai/sdk— but bothscripts/pr-review.mjsandscripts/issue-triage.mjshad a static top-levelimport Anthropic from "@anthropic-ai/sdk", evaluated at module load regardless of which transport runs. Result: thereview/triagejob crashes withERR_MODULE_NOT_FOUNDbefore 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")insidereviewViaSdk/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_modulesremoved — full review produced, no SDK present. The identical fix rides to beta in #250.