#3727: fix(googlechat): space type detection for modern API
channel: googlechat
Cluster:
WhatsApp and Google Chat Fixes
## Summary
- Fix space type detection to use modern `spaceType` field instead of deprecated `type`
- Add backwards-compatible fallback for legacy API responses
## Problem
Google Chat deprecated `space.type` (values: `DM`, `ROOM`) in favor of `space.spaceType` (values: `DIRECT_MESSAGE`, `GROUP_CHAT`, `SPACE`). Modern API responses may only include `spaceType`, causing the integration to misidentify space types and return bad request errors for group chats/spaces.
## References
- [Google Chat spaces REST API](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces) - documents `spaceType` enum values
- [Google Chat Event reference](https://developers.google.com/workspace/chat/api/reference/rest/v1/Event) - webhook payload structure
## AI-Assisted 🤖
- [x] AI-assisted (Claude)
- [x] Lightly tested (unit tests pass, no live Google Chat testing)
- [x] I understand what the code does
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates Google Chat space type detection to support the modern `space.spaceType` field (e.g., `DIRECT_MESSAGE`, `GROUP_CHAT`, `SPACE`) and adds unit tests for the new resolution logic. It introduces `resolveSpaceType()` in `extensions/googlechat/src/monitor.ts` and uses it when deciding whether an inbound message is a group chat vs DM, with a fallback to the deprecated legacy `space.type` field.
<h3>Confidence Score: 4/5</h3>
- This PR is mostly safe to merge; it’s a small behavioral change with test coverage, with one edge-case mapping that could misclassify legacy space types.
- Changes are localized (space type normalization + tests) and should fix modern API payloads. The main concern is the legacy `type` fallback mapping any non-`DM` value to `SPACE`, which could over-classify unknown/empty legacy values as group chats and affect policy enforcement paths.
- extensions/googlechat/src/monitor.ts (legacy type fallback mapping logic)
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#3837: fix(googlechat): space events response and thread reply context
by rehanchrl · 2026-01-29
85.3%
#15643: fix(googlechat): DM's works, but groups don't - return add-on actio...
by kamil-rudnicki · 2026-02-13
77.4%
#13829: fix(googlechat): detect bot @mentions via user.type when botUser no...
by mcaxtr · 2026-02-11
77.2%
#14940: fix(googlechat): convert Markdown formatting to Google Chat markup
by brandonwise · 2026-02-12
75.5%
#17842: Fix Google Chat media upload failure by inferring content-type from...
by Clawborn · 2026-02-16
74.6%
#19043: googlechat: fix runtime.error signature in startup error handling
by markesphere · 2026-02-17
74.6%
#7940: fix(googlechat): add messageReplyOption for proper thread replies
by sapko7a · 2026-02-03
73.5%
#16733: fix(ui): avoid injected newlines when tool output is hidden
by jp117 · 2026-02-15
73.2%
#13881: fix: Address Greptile feedback - test isolation and channel resolution
by trevorgordon981 · 2026-02-11
72.4%
#14309: fix(ui): resolve chat event session key mismatch
by justonlyforyou · 2026-02-11
72.1%