4e6cf185fa
## Summary Improved error handling in the StreamAgentChatJob to properly propagate and reject errors that occur during the agent chat stream processing. ## Key Changes - Added error re-throw in the catch block to ensure errors are not silently swallowed - Introduced `streamError` variable to capture errors from the stream's `onError` callback - Modified the promise resolution logic to reject with the captured stream error instead of silently resolving on success, ensuring proper error propagation to callers ## Implementation Details The changes ensure that errors occurring during stream processing are properly captured and propagated: 1. Stream errors are now captured in the `onError` callback and stored in the `streamError` variable 2. After the stream completes and the message is persisted to the database, the promise is rejected if a stream error occurred 3. The outer catch block now re-throws errors to prevent silent failures This fix prevents scenarios where stream processing errors would be masked by a successful database persistence operation. https://claude.ai/code/session_016DQodL32HYv6CR1cMASNHZ --------- Co-authored-by: Claude <noreply@anthropic.com>