fix(packages/agents): prevent unhandled promise rejections in stream()#11
fix(packages/agents): prevent unhandled promise rejections in stream()#11zrosenbauer merged 2 commits intomainfrom
Conversation
Add no-op .catch() handlers on derived promises (output, messages, usage, finishReason) in both agent.stream() and flowAgent.stream(). When the underlying stream errors and consumers don't await all promises, this prevents Node.js UnhandledPromiseRejection warnings. Co-Authored-By: Claude <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 642743c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds unhandled rejection handlers to stream result promises in two agent implementations (base and flow) to prevent unhandledRejection warnings when consumers don't await derived promises. Includes corresponding test coverage validating this safety mechanism. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📝 Coding Plan
Comment |
Co-Authored-By: Claude <noreply@anthropic.com>
Summary
.catch(() => {})handlers on all 4 derived promises (output,messages,usage,finishReason) in bothagent.stream()andflowAgent.stream()UnhandledPromiseRejectionwarningsagent.test.tsandflow-agent.test.tsverifying nounhandledRejectionevent firesTest plan
pnpm test --filter=@funkai/agentspasses