Repository navigation
fix(googlechat): handle non-MESSAGE Workspace Add-on event payloads - #80833
jamb-agent wants to merge 1 commit into
Conversation
Closes openclaw#13856. The add-on event payload extractor in parseGoogleChatInboundPayload only handled chat.messagePayload and hardcoded type='MESSAGE'. Per Google's Workspace Add-on docs (https://developers.google.com/workspace/add-ons/chat/event-objects), event kind is signaled by which 'chat.<kind>Payload' field is populated; the framework does NOT include a top-level 'type' field. Effect of the bug: - ADDED_TO_SPACE / REMOVED_FROM_SPACE / APP_COMMAND / CARD_CLICKED events were dropped silently (returned HTTP 400 'invalid payload' before reaching the agent). This matches user reports in openclaw#13856 (space events not received) and explains why DMs worked but group spaces didn't — every space membership change emits one of these add-on events first, and the failures put Google's add-on framework into a back-off that eventually stops MESSAGE delivery too. Fix: - Broaden the extractor to handle messagePayload, addedToSpacePayload, removedFromSpacePayload, appCommandPayload, buttonClickedPayload, cardClickedPayload. - Derive event.type from which payload variant is populated, and prefer rawObj.type when the host actually sets one. - Add console.warn diagnostics on every 400 return path. Silent 400s are why the original bug stayed in production unnoticed; structured logs make the failure obvious in journalctl/stderr without patching dist. Test coverage: - Added two cases to monitor-webhook.test.ts: addedToSpacePayload accepted with derived type ADDED_TO_SPACE, and explicit rawObj.type beats the derived type. Related issues: openclaw#13856, openclaw#35095, openclaw#53888, openclaw#57386.
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: yes. from source inspection: a current-main Workspace Add-on request with Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Accept add-on envelopes through the full Google-documented Chat payload union, return successful acknowledgements for non-message events, keep message dispatch unchanged, and consolidate the result with the open Google Chat parser cluster. Do we have a high-confidence way to reproduce the issue? Yes from source inspection: a current-main Workspace Add-on request with Is this the best way to solve the issue? No: the direction is right, but the patch should include the documented Full review comments:
Overall correctness: patch is incorrect Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 3cbc88970120. |
Summary
Closes #13856.
parseGoogleChatInboundPayloadonly handledchat.messagePayloadand hardcodedtype: "MESSAGE". Per Workspace Add-on Chat docs, event kind is signaled by whichchat.<kind>Payloadfield is populated, and the framework does not include a top-leveltypefield.Effect:
ADDED_TO_SPACE,REMOVED_FROM_SPACE,APP_COMMAND,CARD_CLICKEDevents silently 400'd. Empirically observed: this puts Google's add-on framework into back-off that eventually stopsMESSAGEdelivery too, matching #13856's symptom (DMs work, space events never arrive).Changes
chat.<kind>Payloadvariants.event.typefrom which payload variant is populated; preferrawObj.typewhen the host sets one explicitly.console.warndiagnostics on every 400 return path. Silent 400s are how this bug stayed in production unnoticed — operators had to grep journalctl with no signal pointing them at the parser. Structured logs surfacerootKeys,chatKeys,hostAppso the next regression is obvious.Test plan
addedToSpacePayloadaccepted (previously 400'd)rawObj.typeoverrides derived typemessagePayloadhappy-path test still passesRelated issues
🤖 Generated with Claude Code