Add onError callback to durable agent stream calls - #200
Conversation
The DurableAgent.stream() options expose an onError callback that fires on streaming errors. Wire it up for the invocation and heartbeat handlers to log the error and emit a best-effort activity breadcrumb. The realtime ToolLoopAgent runner does not expose onError, so it is left unchanged.
…ages ToolLoopAgent.stream() does not expose an onError option, so non-fatal errors arrive as 'error' parts on the fullStream rather than thrown. Intercept them in the tap, log them, and swallow the raw chunk so channels never render provider internals. Add a shared humanReadableAgentError() helper that maps known errors (missing credentials, provider 401/403/429/5xx, aborts) to concise user-facing text and falls back to a generic message instead of leaking raw provider output. Wire it into the web chat UI streams (createUIMessageStream + createAgentUIStream onError, replacing the SDK default 'An error occurred.') and the channel text-only path (posted via postText).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
WalkthroughThe PR adds human-readable error handling throughout the agent runtime's streaming infrastructure. A new utility converts agent errors into safe user messages, then integrates that utility into realtime chat streaming with error callbacks for both UI and text-only channels, and extends workflow handlers to report stream failures gracefully. ChangesAgent streaming error handling
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
The DurableAgent.stream() options expose an onError callback that fires on
streaming errors. Wire it up for the invocation and heartbeat handlers to log
the error and emit a best-effort activity breadcrumb. The realtime ToolLoopAgent
runner does not expose onError, so it is left unchanged.
Summary by CodeRabbit
New Features
Bug Fixes
Tests