Repository navigation
fix(googlechat): drop invalid thread resource names before send - #108324
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 2:58 PM ET / 18:58 UTC. ClawSweeper reviewWhat this changesThe PR validates optional Google Chat reply-thread resource names before creating an outbound message, omitting invalid or foreign-space targets so the completed reply is delivered as a new top-level message instead of being rejected. Merge readinessThis PR remains necessary: current main still forwards every nonempty reply-thread value into the Google Chat create-message request, so malformed or cross-space values can reject a completed reply. The patch places one strict resource-name guard at the shared outbound owner, preserves valid same-space threading, and has both focused request-shape coverage and supplied live Google Chat proof; no blocking patch defect was found. Priority: P1 Review scores
Verification
How this fits togetherGoogle Chat inbound handling resolves a space and optional reply target, then reply delivery calls the extension’s shared outbound sender. That sender builds the Google Chat create-message URL and body, which determines whether the user receives a threaded reply, a top-level reply, or no reply after an API rejection. flowchart LR
A[Incoming Google Chat event] --> B[Reply target resolution]
B --> C[Reply delivery]
C --> D[Shared outbound sender]
D --> E{Valid same-space thread?}
E -->|Yes| F[Threaded Chat API message]
E -->|No| G[Top-level Chat API message]
F --> H[Visible completed reply]
G --> H
Before merge
Agent review detailsSecurityNone. PR surfaceSource +14, Tests +52. Total +66 across 2 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge the shared outbound validation so every Google Chat caller preserves valid same-space threads while invalid routing state is converted into a visible top-level reply instead of a silent failed delivery. Do we have a high-confidence way to reproduce the issue? Yes. Current main’s shared sender forwards any nonempty thread value, and the supplied maintainer path proof shows a bare identifier is rejected by Google Chat after the typing placeholder is deleted; the branch’s guard omits that field and preserves a valid same-space control. Is this the best way to solve the issue? Yes. Guarding the common outbound sender is the narrowest canonical fix because reply delivery, channel-adapter sends, and action sends all converge there; caller-specific filtering would leave paths to drift. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 063907e9701c. LabelsLabel justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
+1 real-world hit on this, no dedicated issue existed so filed oneHit exactly this on Filed #115742 with our full repro/logs since there wasn't an open issue tracking this specific regression yet (only the older, already-closed #39554/#64313). This PR's test plan (39/39, |
Real-behavior verification (2026-07-30, live Google Chat traffic)Following up on my earlier "+1 real-world hit" comment — we built a test image that applies this PR's fix ( Setup: the PR branch itself is based on a pre-beta.5 Result: 4 separate DM exchanges over ~10 minutes, each going through the anthropic-vertex → Gemini fallback chain (a separate, known auth bug — #110103), including one 156s multi-tool-call turn. Zero Logs redacted (space/message IDs, no user content): No |
Follow-up detail on the verification aboveOne more precise detail worth recording: in the exchange that hit an invalid/mismatched thread, the Google Chat UI showed the typing placeholder as "This message was deleted by its author", followed by the actual reply as a new, separate message (no That matches this PR's fallback design precisely: drop the invalid thread, delete the stale placeholder, and deliver the reply as a new top-level message rather than editing in place or failing the send. Worth calling out for reviewers/UX awareness — the user does see a brief "deleted" ghost message before the real reply lands — but no message loss and no duplication, which is the meaningful fix over current |
Reply routing can hand sendGoogleChatMessage a `thread` that is not a
valid `spaces/{space}/threads/{thread}` resource name — a bare id, a
`spaces/{space}/messages/{message}` name, or a thread from a different
(or wrongly-cased) space. The Chat API rejects the whole request with
`400 INVALID_ARGUMENT`, so the reply is never delivered even though the
agent already produced it (and did any side effects).
Guard the send so the `thread` field and the messageReplyOption fallback
are applied only when the thread is a well-formed name belonging to the
target space; otherwise post to the space as a new thread. Revives the
approach of openclaw#28153 (auto-closed as stale) and addresses the failure mode
behind openclaw#64313.
5721431 to
b0f4dde
Compare
|
Maintainer reproduced this through the identical actual production path before and after, using Independent customer live Google Chat proof: four DM exchanges, zero lost replies: #108324 (comment). Focused owner and delivery regressions: Fresh |
|
Merged via squash.
|
…reentrant-stop-20260801 * origin/main: fix(openai): keep embedding identity stable across upgrades (#117557) fix(googlechat): drop invalid thread resource names before send (#108324) fix(skills): preserve profile in ClawHub command hints (#117555) fix(cli): explain filtered plugin policy without unsafe recovery (#117556) fix(irc): strip markdown from outbound text (#112961)
* origin/main: refactor(policy): centralize doctor health-check descriptors (openclaw#117578) perf(gateway): mark recovery before model preparation (openclaw#117544) fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) fix(skills): preserve profile in ClawHub command hints (openclaw#117555) fix(cli): explain filtered plugin policy without unsafe recovery (openclaw#117556) fix(irc): strip markdown from outbound text (openclaw#112961)
* origin/main: (22 commits) refactor(ui): consolidate cron form control rendering (#117576) fix(memory): recover restored session freshness (#117548) fix(whatsapp): normalize future-proof QA poll and video note ingress (#117579) fix(perf): separate warm and first-device health probes (#117525) fix(ci): repair plugin prerelease validation (#117562) fix(tasks): sanitize every human task and flow detail (#117568) fix(feishu): cancel unread streaming-card error bodies before release (#117312) fix(status): honor explicit local RPC fallback timeouts (#117519) fix(ui): preserve Talk transcript surrogate bounds fix(tasks): validate notification policy before persistence (#117554) refactor: consolidate full release child workflows (#117385) refactor(policy): centralize doctor health-check descriptors (#117578) perf(gateway): mark recovery before model preparation (#117544) fix(ui): harden Talk transcript marker bounds test(openai): parse realtime websocket frames safely fix(openai): keep embedding identity stable across upgrades (#117557) fix(googlechat): drop invalid thread resource names before send (#108324) test(ui): cover bounded realtime Talk entries fix(ui): bound realtime Talk conversation text test(ui): cover reentrant Talk meter cleanup ...
* origin/main: perf(gateway): mark recovery before model preparation (openclaw#117544) fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) fix(skills): preserve profile in ClawHub command hints (openclaw#117555) fix(cli): explain filtered plugin policy without unsafe recovery (openclaw#117556) fix(irc): strip markdown from outbound text (openclaw#112961) refactor(plugins): consolidate registry snapshots (openclaw#117561) fix(plugins): fail blocked enable commands (openclaw#117536) test(secrets): dedupe runtime state fixtures (openclaw#117563)
* origin/main: (28 commits) refactor(ui): consolidate cron form control rendering (openclaw#117576) fix(memory): recover restored session freshness (openclaw#117548) fix(whatsapp): normalize future-proof QA poll and video note ingress (openclaw#117579) fix(perf): separate warm and first-device health probes (openclaw#117525) fix(ci): repair plugin prerelease validation (openclaw#117562) fix(tasks): sanitize every human task and flow detail (openclaw#117568) fix(feishu): cancel unread streaming-card error bodies before release (openclaw#117312) fix(status): honor explicit local RPC fallback timeouts (openclaw#117519) fix(ui): preserve Talk transcript surrogate bounds fix(tasks): validate notification policy before persistence (openclaw#117554) refactor: consolidate full release child workflows (openclaw#117385) refactor(policy): centralize doctor health-check descriptors (openclaw#117578) perf(gateway): mark recovery before model preparation (openclaw#117544) fix(ui): harden Talk transcript marker bounds test(openai): parse realtime websocket frames safely fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) fix(skills): preserve profile in ClawHub command hints (openclaw#117555) fix(cli): explain filtered plugin policy without unsafe recovery (openclaw#117556) fix(irc): strip markdown from outbound text (openclaw#112961) ...
* origin/main: (53 commits) fix(whatsapp): normalize future-proof QA poll and video note ingress (openclaw#117579) fix(perf): separate warm and first-device health probes (openclaw#117525) fix(ci): repair plugin prerelease validation (openclaw#117562) fix(tasks): sanitize every human task and flow detail (openclaw#117568) fix(feishu): cancel unread streaming-card error bodies before release (openclaw#117312) fix(status): honor explicit local RPC fallback timeouts (openclaw#117519) fix(tasks): validate notification policy before persistence (openclaw#117554) refactor: consolidate full release child workflows (openclaw#117385) refactor(policy): centralize doctor health-check descriptors (openclaw#117578) perf(gateway): mark recovery before model preparation (openclaw#117544) test(openai): parse realtime websocket frames safely fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) fix(skills): preserve profile in ClawHub command hints (openclaw#117555) fix(cli): explain filtered plugin policy without unsafe recovery (openclaw#117556) fix(irc): strip markdown from outbound text (openclaw#112961) refactor(plugins): consolidate registry snapshots (openclaw#117561) test(ui): cover reentrant Talk meter cleanup fix(plugins): fail blocked enable commands (openclaw#117536) fix(ui): reclaim reentrant Talk audio meters ...
…claw#108324) Reply routing can hand sendGoogleChatMessage a `thread` that is not a valid `spaces/{space}/threads/{thread}` resource name — a bare id, a `spaces/{space}/messages/{message}` name, or a thread from a different (or wrongly-cased) space. The Chat API rejects the whole request with `400 INVALID_ARGUMENT`, so the reply is never delivered even though the agent already produced it (and did any side effects). Guard the send so the `thread` field and the messageReplyOption fallback are applied only when the thread is a well-formed name belonging to the target space; otherwise post to the space as a new thread. Revives the approach of openclaw#28153 (auto-closed as stale) and addresses the failure mode behind openclaw#64313.
…reentrant-stop-20260801 * origin/main: fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) fix(skills): preserve profile in ClawHub command hints (openclaw#117555) fix(cli): explain filtered plugin policy without unsafe recovery (openclaw#117556) fix(irc): strip markdown from outbound text (openclaw#112961)
* origin/main: refactor(policy): centralize doctor health-check descriptors (openclaw#117578) perf(gateway): mark recovery before model preparation (openclaw#117544) fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) fix(skills): preserve profile in ClawHub command hints (openclaw#117555) fix(cli): explain filtered plugin policy without unsafe recovery (openclaw#117556) fix(irc): strip markdown from outbound text (openclaw#112961)
* origin/main: (22 commits) refactor(ui): consolidate cron form control rendering (openclaw#117576) fix(memory): recover restored session freshness (openclaw#117548) fix(whatsapp): normalize future-proof QA poll and video note ingress (openclaw#117579) fix(perf): separate warm and first-device health probes (openclaw#117525) fix(ci): repair plugin prerelease validation (openclaw#117562) fix(tasks): sanitize every human task and flow detail (openclaw#117568) fix(feishu): cancel unread streaming-card error bodies before release (openclaw#117312) fix(status): honor explicit local RPC fallback timeouts (openclaw#117519) fix(ui): preserve Talk transcript surrogate bounds fix(tasks): validate notification policy before persistence (openclaw#117554) refactor: consolidate full release child workflows (openclaw#117385) refactor(policy): centralize doctor health-check descriptors (openclaw#117578) perf(gateway): mark recovery before model preparation (openclaw#117544) fix(ui): harden Talk transcript marker bounds test(openai): parse realtime websocket frames safely fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) test(ui): cover bounded realtime Talk entries fix(ui): bound realtime Talk conversation text test(ui): cover reentrant Talk meter cleanup ...
* origin/main: perf(gateway): mark recovery before model preparation (openclaw#117544) fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) fix(skills): preserve profile in ClawHub command hints (openclaw#117555) fix(cli): explain filtered plugin policy without unsafe recovery (openclaw#117556) fix(irc): strip markdown from outbound text (openclaw#112961) refactor(plugins): consolidate registry snapshots (openclaw#117561) fix(plugins): fail blocked enable commands (openclaw#117536) test(secrets): dedupe runtime state fixtures (openclaw#117563)
* origin/main: (28 commits) refactor(ui): consolidate cron form control rendering (openclaw#117576) fix(memory): recover restored session freshness (openclaw#117548) fix(whatsapp): normalize future-proof QA poll and video note ingress (openclaw#117579) fix(perf): separate warm and first-device health probes (openclaw#117525) fix(ci): repair plugin prerelease validation (openclaw#117562) fix(tasks): sanitize every human task and flow detail (openclaw#117568) fix(feishu): cancel unread streaming-card error bodies before release (openclaw#117312) fix(status): honor explicit local RPC fallback timeouts (openclaw#117519) fix(ui): preserve Talk transcript surrogate bounds fix(tasks): validate notification policy before persistence (openclaw#117554) refactor: consolidate full release child workflows (openclaw#117385) refactor(policy): centralize doctor health-check descriptors (openclaw#117578) perf(gateway): mark recovery before model preparation (openclaw#117544) fix(ui): harden Talk transcript marker bounds test(openai): parse realtime websocket frames safely fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) fix(skills): preserve profile in ClawHub command hints (openclaw#117555) fix(cli): explain filtered plugin policy without unsafe recovery (openclaw#117556) fix(irc): strip markdown from outbound text (openclaw#112961) ...
* origin/main: (53 commits) fix(whatsapp): normalize future-proof QA poll and video note ingress (openclaw#117579) fix(perf): separate warm and first-device health probes (openclaw#117525) fix(ci): repair plugin prerelease validation (openclaw#117562) fix(tasks): sanitize every human task and flow detail (openclaw#117568) fix(feishu): cancel unread streaming-card error bodies before release (openclaw#117312) fix(status): honor explicit local RPC fallback timeouts (openclaw#117519) fix(tasks): validate notification policy before persistence (openclaw#117554) refactor: consolidate full release child workflows (openclaw#117385) refactor(policy): centralize doctor health-check descriptors (openclaw#117578) perf(gateway): mark recovery before model preparation (openclaw#117544) test(openai): parse realtime websocket frames safely fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) fix(skills): preserve profile in ClawHub command hints (openclaw#117555) fix(cli): explain filtered plugin policy without unsafe recovery (openclaw#117556) fix(irc): strip markdown from outbound text (openclaw#112961) refactor(plugins): consolidate registry snapshots (openclaw#117561) test(ui): cover reentrant Talk meter cleanup fix(plugins): fail blocked enable commands (openclaw#117536) fix(ui): reclaim reentrant Talk audio meters ...
Summary
sendGoogleChatMessageforwards the reply-routingthreadstraight into theChat API request. When routing yields something that is not a valid
spaces/{space}/threads/{thread}resource name — a bare id, aspaces/{space}/messages/{message}name, or a thread from a different (orwrongly-cased) space — the API rejects the whole send with
400 INVALID_ARGUMENTand the reply is silently dropped, even though the agentalready produced it and ran any side effects.
This guards the send so the
threadfield (and themessageReplyOptionfallback) is applied only when the thread is well-formed and belongs to the
target space. Otherwise the message is delivered to the space as a new thread
instead of failing outright.
Revives the approach of #28153 (auto-closed as stale) and addresses the failure
mode behind #64313. Complements the DM-only fix in #87054, which only stops
setting
replyToIdon the ingress side.Changes
extensions/googlechat/src/api.ts: addisUsableGoogleChatThreadName(thread, space)and gate thethread/messageReplyOptionusage on it.extensions/googlechat/src/targets.test.ts: cover the drop-invalid cases (bare id, thread key, message name, space name, foreign-space thread) and confirm a valid same-space thread is preserved.Test plan
node scripts/test-projects.mjs extensions/googlechat/src/targets.test.ts→ 39/39 pass.🤖 Generated with Claude Code
https://claude.ai/code/session_01W7pvAaMii7o42ZgVFmUdk5
What Problem This Solves
Google Chat DM replies can disappear after OpenClaw deletes the typing placeholder: an invalid reply thread is forwarded to Google Chat, which rejects the completed reply with
400 INVALID_ARGUMENT. This is the reproduced P1 customer failure in #115742.Why This Change Was Made
Validate thread resource names at the shared Google Chat outbound API owner. Keep a valid same-space
spaces/{space}/threads/{thread}target; omit malformed, message-resource, and foreign-space targets and the corresponding reply option so the reply is delivered as a new thread.User Impact
Completed Google Chat replies are delivered instead of silently disappearing. Valid same-space threaded replies keep their existing behavior. No new configuration or operator action is required.
Evidence
Maintainer independently exercised the actual production
deliverGoogleChatReply -> sendGoogleChatMessage -> google-auth-library RSA/JWT OAuth -> SSRF-guarded HTTPpath against a local real HTTP server. One real OAuth token exchange authenticated every Chat request:Independent live customer verification applied this exact guard to a real staging Google Chat bot: 4 DM exchanges over approximately 10 minutes, including a 156-second multi-tool turn; all 4 replies arrived, with zero invalid-thread errors, dropped replies, or duplicate replies: #108324 (comment) and #108324 (comment).
Focused contributor coverage:
node scripts/test-projects.mjs extensions/googlechat/src/targets.test.ts(39 passing). Exact-head full hosted CI: https://github.com/openclaw/openclaw/actions/runs/30709830635.Google Chat thread contract: https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages#Thread and https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages/create#messagereplyoption.
Fixes #115742