feat: inline error/error_omitted fields in webhook payloads for failed async jobs - #5398
Conversation
|
|
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 49 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: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughWebhook payload rendering now supports failed async-job errors, including inline JSON when within the response size limit and an ChangesWebhook error payload support
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (2): Last reviewed commit: "fix: inline job error in webhook payload..." | Re-trigger Greptile |
Merge activity
|
063a8ba to
44a1d09
Compare
…ailed async jobs (maximhq#5398) ## Summary Webhook payloads for failed async jobs now include an inlined `error` field, mirroring the existing `response` inlining behavior for completed jobs. Previously, failed job webhooks had no way to deliver error details inline to subscribers. ## Changes - Added `error` and `error_omitted` fields to the webhook `eventData` struct and the example envelope struct, following the same pattern as `response`/`response_omitted`. - `renderPayload` now checks `job.Error` when `includeResponse` is enabled: if the error fits within `maxResponseBytes` it is inlined as `error`; if it exceeds the limit, `error_omitted` is set to `true` so the receiver knows to fetch it separately. - Added a `testFailedAsyncJob` helper and `TestRenderPayloadIncludeError` test covering inline delivery, the `includeResponse` toggle gate, and oversized error truncation behavior. ## Type of change - [ ] Bug fix - [x] Feature - [ ] Refactor - [ ] Documentation - [ ] Chore/CI ## Affected areas - [x] Core (Go) - [ ] Transports (HTTP) - [ ] Providers/Integrations - [ ] Plugins - [ ] UI (React) - [ ] Docs ## How to test ```sh go test ./framework/webhooks/... ``` Verify that a webhook endpoint configured with response inlining enabled receives an `error` field in the payload when a job fails, and that `error_omitted` is set instead when the error body exceeds the configured size limit. ## Breaking changes - [ ] Yes - [x] No ## Related issues ## Security considerations Error bodies may contain upstream provider messages or internal details. The existing `includeResponse` opt-in gate and `maxResponseBytes` size cap apply equally to the new `error` field, limiting unintended exposure of large or sensitive error payloads. ## Checklist - [ ] I read `docs/contributing/README.md` and followed the guidelines - [x] I added/updated tests where appropriate - [ ] I updated documentation where needed - [x] I verified builds succeed (Go and UI) - [ ] I verified the CI pipeline passes locally if applicable

Summary
Webhook payloads for failed async jobs now include an inlined
errorfield, mirroring the existingresponseinlining behavior for completed jobs. Previously, failed job webhooks had no way to deliver error details inline to subscribers.Changes
erroranderror_omittedfields to the webhookeventDatastruct and the example envelope struct, following the same pattern asresponse/response_omitted.renderPayloadnow checksjob.ErrorwhenincludeResponseis enabled: if the error fits withinmaxResponseBytesit is inlined aserror; if it exceeds the limit,error_omittedis set totrueso the receiver knows to fetch it separately.testFailedAsyncJobhelper andTestRenderPayloadIncludeErrortest covering inline delivery, theincludeResponsetoggle gate, and oversized error truncation behavior.Type of change
Affected areas
How to test
go test ./framework/webhooks/...Verify that a webhook endpoint configured with response inlining enabled receives an
errorfield in the payload when a job fails, and thaterror_omittedis set instead when the error body exceeds the configured size limit.Breaking changes
Related issues
Security considerations
Error bodies may contain upstream provider messages or internal details. The existing
includeResponseopt-in gate andmaxResponseBytessize cap apply equally to the newerrorfield, limiting unintended exposure of large or sensitive error payloads.Checklist
docs/contributing/README.mdand followed the guidelines