Repository navigation
Conversation
The Google Chat add-on payload parser only handled chat.messagePayload, rejecting valid addedToSpacePayload and removedFromSpacePayload events with "invalid payload". Expand parseGoogleChatInboundPayload to recognise all three payload variants and map them to the correct event types. Partially addresses openclaw#65007
Greptile SummaryThis PR expands Confidence Score: 5/5Safe to merge; the only finding is a P2 logic-clarity issue that does not affect current Google Chat payloads. All three real-world payload variants are handled correctly. The type-determination issue only manifests if both messagePayload and addedToSpacePayload appear simultaneously in one envelope, which the Google Chat API does not produce. No security, data-loss, or auth-boundary concerns introduced. extensions/googlechat/src/monitor-webhook.ts — minor type-determination coupling worth cleaning up. Prompt To Fix All With AIThis is a comment left during a code review.
Path: extensions/googlechat/src/monitor-webhook.ts
Line: 68-73
Comment:
**Type determination decoupled from payload selection**
`messagePayload` is resolved with `??` (preferring `chat.messagePayload`), but the event type is determined by checking `chat.addedToSpacePayload` independently. If both fields were ever present in the same envelope, the event would be extracted from `messagePayload` but labelled `"ADDED_TO_SPACE"`. The `?? undefined` tail is also redundant since `??` already returns `undefined` when the left side is `null`/`undefined`.
A clearer approach keeps selection and labelling in the same branch:
```suggestion
if (chat.messagePayload) {
eventPayload = {
type: "MESSAGE",
space: chat.messagePayload.space,
message: chat.messagePayload.message,
user: chat.user,
eventTime: chat.eventTime,
};
addOnBearerToken =
typeof rawObj.authorizationEventObject?.systemIdToken === "string"
? rawObj.authorizationEventObject.systemIdToken.trim()
: "";
} else if (chat.addedToSpacePayload) {
eventPayload = {
type: "ADDED_TO_SPACE",
space: chat.addedToSpacePayload.space,
message: chat.addedToSpacePayload.message,
user: chat.user,
eventTime: chat.eventTime,
};
addOnBearerToken =
typeof rawObj.authorizationEventObject?.systemIdToken === "string"
? rawObj.authorizationEventObject.systemIdToken.trim()
: "";
} else if (chat.removedFromSpacePayload) {
eventPayload = {
type: "REMOVED_FROM_SPACE",
space: chat.removedFromSpacePayload.space,
user: chat.user,
eventTime: chat.eventTime,
};
addOnBearerToken =
typeof rawObj.authorizationEventObject?.systemIdToken === "string"
? rawObj.authorizationEventObject.systemIdToken.trim()
: "";
}
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(googlechat): accept add-on space lif..." | Re-trigger Greptile |
| const messagePayload = | ||
| chat.messagePayload ?? chat.addedToSpacePayload ?? undefined; | ||
| const isRemoval = !messagePayload && chat.removedFromSpacePayload != null; | ||
| if (messagePayload) { | ||
| eventPayload = { | ||
| type: chat.addedToSpacePayload ? "ADDED_TO_SPACE" : "MESSAGE", |
There was a problem hiding this comment.
Type determination decoupled from payload selection
messagePayload is resolved with ?? (preferring chat.messagePayload), but the event type is determined by checking chat.addedToSpacePayload independently. If both fields were ever present in the same envelope, the event would be extracted from messagePayload but labelled "ADDED_TO_SPACE". The ?? undefined tail is also redundant since ?? already returns undefined when the left side is null/undefined.
A clearer approach keeps selection and labelling in the same branch:
| const messagePayload = | |
| chat.messagePayload ?? chat.addedToSpacePayload ?? undefined; | |
| const isRemoval = !messagePayload && chat.removedFromSpacePayload != null; | |
| if (messagePayload) { | |
| eventPayload = { | |
| type: chat.addedToSpacePayload ? "ADDED_TO_SPACE" : "MESSAGE", | |
| if (chat.messagePayload) { | |
| eventPayload = { | |
| type: "MESSAGE", | |
| space: chat.messagePayload.space, | |
| message: chat.messagePayload.message, | |
| user: chat.user, | |
| eventTime: chat.eventTime, | |
| }; | |
| addOnBearerToken = | |
| typeof rawObj.authorizationEventObject?.systemIdToken === "string" | |
| ? rawObj.authorizationEventObject.systemIdToken.trim() | |
| : ""; | |
| } else if (chat.addedToSpacePayload) { | |
| eventPayload = { | |
| type: "ADDED_TO_SPACE", | |
| space: chat.addedToSpacePayload.space, | |
| message: chat.addedToSpacePayload.message, | |
| user: chat.user, | |
| eventTime: chat.eventTime, | |
| }; | |
| addOnBearerToken = | |
| typeof rawObj.authorizationEventObject?.systemIdToken === "string" | |
| ? rawObj.authorizationEventObject.systemIdToken.trim() | |
| : ""; | |
| } else if (chat.removedFromSpacePayload) { | |
| eventPayload = { | |
| type: "REMOVED_FROM_SPACE", | |
| space: chat.removedFromSpacePayload.space, | |
| user: chat.user, | |
| eventTime: chat.eventTime, | |
| }; | |
| addOnBearerToken = | |
| typeof rawObj.authorizationEventObject?.systemIdToken === "string" | |
| ? rawObj.authorizationEventObject.systemIdToken.trim() | |
| : ""; | |
| } |
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/googlechat/src/monitor-webhook.ts
Line: 68-73
Comment:
**Type determination decoupled from payload selection**
`messagePayload` is resolved with `??` (preferring `chat.messagePayload`), but the event type is determined by checking `chat.addedToSpacePayload` independently. If both fields were ever present in the same envelope, the event would be extracted from `messagePayload` but labelled `"ADDED_TO_SPACE"`. The `?? undefined` tail is also redundant since `??` already returns `undefined` when the left side is `null`/`undefined`.
A clearer approach keeps selection and labelling in the same branch:
```suggestion
if (chat.messagePayload) {
eventPayload = {
type: "MESSAGE",
space: chat.messagePayload.space,
message: chat.messagePayload.message,
user: chat.user,
eventTime: chat.eventTime,
};
addOnBearerToken =
typeof rawObj.authorizationEventObject?.systemIdToken === "string"
? rawObj.authorizationEventObject.systemIdToken.trim()
: "";
} else if (chat.addedToSpacePayload) {
eventPayload = {
type: "ADDED_TO_SPACE",
space: chat.addedToSpacePayload.space,
message: chat.addedToSpacePayload.message,
user: chat.user,
eventTime: chat.eventTime,
};
addOnBearerToken =
typeof rawObj.authorizationEventObject?.systemIdToken === "string"
? rawObj.authorizationEventObject.systemIdToken.trim()
: "";
} else if (chat.removedFromSpacePayload) {
eventPayload = {
type: "REMOVED_FROM_SPACE",
space: chat.removedFromSpacePayload.space,
user: chat.user,
eventTime: chat.eventTime,
};
addOnBearerToken =
typeof rawObj.authorizationEventObject?.systemIdToken === "string"
? rawObj.authorizationEventObject.systemIdToken.trim()
: "";
}
```
How can I resolve this? If you propose a fix, please make it concise.|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Keep open: current main and the latest release still lack Google Chat add-on added/removed-space lifecycle payload parsing, and no merged or viable open replacement owns that exact fix. This PR is not merge-ready because the branch is conflicting against current main and still lacks inspectable real Google Chat behavior proof. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review. So I’m closing this here because the remaining work is already tracked in the canonical issue. Review detailsBest possible solution: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review. Do we have a high-confidence way to reproduce the issue? Yes at source level. Current main only unwraps Is this the best way to solve the issue? No as currently submitted. The parser boundary is the right place, but the best fix must be rebased over current main's card-click parser, covered by tests, and backed by real Google Chat proof. Security review: Security review cleared: Cleared: the diff only changes Google Chat payload normalization and adds no dependency, workflow, secret, package, or code-execution surface. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 4e6933c84f18. |
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
|
Heads up: this PR needs to be updated against current |
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |
The Google Chat add-on payload parser only handled
chat.messagePayload, rejecting validaddedToSpacePayloadandremovedFromSpacePayloadevents as "invalid payload".Expand
parseGoogleChatInboundPayloadto recognise all three payload variants and map to correct event types (MESSAGE, ADDED_TO_SPACE, REMOVED_FROM_SPACE).Partially addresses #65007