Skip to content

fix(webhook): honor failedContinue for before callbacks - #3824

Open
somaz94 wants to merge 1 commit into
openimsdk:mainfrom
somaz94:fix-webhook-failed-continue-3808
Open

somaz94 wants to merge 1 commit into
openimsdk:mainfrom
somaz94:fix-webhook-failed-continue-3808

Conversation

@somaz94

@somaz94 somaz94 commented Oct 21, 2026

Copy link
Copy Markdown

Fixes #3808.

failedContinue in config/webhooks.yml is parsed into BeforeConfig.FailedContinue, but nothing has read it since the 3.7.0 refactor (b76816b). A before callback whose receiver is unreachable, times out, or answers with something that is not JSON therefore always fails the operation, whatever the flag says.

SyncPost now passes the flag to post, which logs a warning and returns nil on a request error or an undecodable response, the same two cases the v3.6 helper covered. A rejection the receiver sends back through actionCode and nextCode is still returned. If decoding fails partway, the response is reset first, because callers apply its fields after a nil error and json.Unmarshal keeps filling fields after a type error. After callbacks are unchanged.

Upgrade note: the shipped webhooks.yml sets failedContinue: true on most before callbacks, so a 3.7+ deployment that enabled one will now let the operation through when the receiver is down instead of rejecting it. Deployments that want to keep failing closed should set failedContinue: false. I left the defaults as they are, since that is your call.

How to test

go test ./pkg/common/webhook/ runs a new table test against an httptest receiver. A dropped connection and a non-JSON body each fail without the flag and pass with it, a partially decoded body leaves no fields behind, a normal answer is still applied, and a rejection is still returned with the flag on. The three continue cases fail on main. go build ./... and go vet ./pkg/common/webhook/ also pass locally.

Follow-ups

With the flag on, beforeSetGroupInfo and beforeSetGroupInfoEx still fail, with a record-not-found error. internal/rpc/group/callback.go copies resp.GroupID and the other fields with NotNilReplace(&req.X, &resp.X), which always replaces, so an empty response clears req.GroupID. The same thing already happens when a receiver answers without those fields. I can send that as a separate fix.

@pull-request-size pull-request-size Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 21, 2026
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

🤖 All Contributors have signed the CLA.
The signed information is recorded here
Posted by the CLA Assistant Lite bot.

@somaz94

somaz94 commented Oct 21, 2026

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

somaz94 added a commit to somaz94/somaz94 that referenced this pull request Oct 21, 2026
@somaz94
somaz94 marked this pull request as ready for review October 21, 2026 04:51

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] webhooks.yml failedContinue has had no effect since v3.7.0 — parsed but never read

1 participant