Skip to content

fix(googlechat): don't set replyToId in DM conversations - #87054

Merged
steipete merged 2 commits into
openclaw:mainfrom
jailbirt:fix/googlechat-dm-replyto-thread
May 27, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
jailbirt:fix/googlechat-dm-replyto-thread

Conversation

@jailbirt

Copy link
Copy Markdown
Contributor

Problem

In Google Chat DM (Direct Message) conversations, the monitor was setting:

replyToId: message.thread?.name,
replyToIdFull: message.thread?.name,

Google Chat's API rejects thread reply IDs in DMs with a 400 INVALID_ARGUMENT: The request contains an invalid thread resource name error. This caused agents to silently fail when delivering responses — the model had generated a reply successfully, but the user saw no response.

Fix

Guard replyToId and replyToIdFull with isGroup (which is already computed in the same scope):

replyToId: isGroup ? message.thread?.name : undefined,
replyToIdFull: isGroup ? message.thread?.name : undefined,

Thread reply IDs are only meaningful (and accepted by Google Chat) in group spaces. In DMs, replies go to the conversation root regardless.

Reproduction

  1. Connect a Google Chat agent to a DM space
  2. Have the agent generate a response that uses thread context
  3. Observe 400 INVALID_ARGUMENT: The request contains an invalid thread resource name in logs
  4. User sees no response despite the model completing successfully

@openclaw-barnacle openclaw-barnacle Bot added channel: googlechat Channel integration: googlechat triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. size: XS labels May 26, 2026
@clawsweeper

clawsweeper Bot commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed May 26, 2026, 6:41 PM ET / 22:41 UTC.

Summary
The PR changes the Google Chat monitor so DM turn context omits replyToId and replyToIdFull from message.thread?.name.

PR surface: Source 0. Total 0 across 1 file.

Reproducibility: yes. Source inspection shows Google Chat DM events can carry message.thread?.name, and current code passes thread values into sendGoogleChatMessage; live after-fix proof is still missing.

Review metrics: none identified.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🦐 gold shrimp
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Add redacted after-fix Google Chat DM proof showing the reply lands without the invalid thread-resource error.
  • Guard the typing-indicator direct-space path and add focused monitor coverage for a DM event carrying message.thread.

Proof guidance:
Needs real behavior proof before merge: The PR body has reproduction steps but no after-fix real Google Chat proof; add redacted logs, terminal output, screenshot, recording, or linked artifact, then update the PR body to trigger re-review or ask a maintainer to comment @clawsweeper re-review.

Mantis proof suggestion
A real Google Chat DM transcript with redacted diagnostics would materially prove the user-visible delivery behavior. A maintainer can ask Mantis to capture proof by posting a new PR comment that starts with the OpenClaw Mantis account mention, followed by:

visual task: verify in a real Google Chat DM that an agent reply lands without sending an invalid thread resource, with diagnostics redacted.

Risk before merge

  • No after-fix real Google Chat DM proof is attached, so the review cannot confirm that a real DM reply now lands without the invalid thread-resource error.
  • Merging as-is can still leave DM events attempting threaded Google Chat API requests through the typing-indicator send path.

Maintainer options:

  1. Guard and prove the full DM send path (recommended)
    Update the Google Chat monitor so both reply context and typing sends suppress thread values for direct spaces, then attach redacted real DM proof.
  2. Land as a partial final-reply fix
    Maintainers could intentionally accept the narrower context guard while tracking typing-indicator DM thread errors as follow-up work.

Next step before merge
Needs contributor or maintainer follow-up for code coverage and real Google Chat proof; do not queue repair automation while external real behavior proof is missing.

Security
Cleared: The diff only narrows Google Chat reply metadata and does not touch credentials, dependencies, CI, package resolution, or other supply-chain surfaces.

Review findings

  • [P2] Guard the full DM thread send path — extensions/googlechat/src/monitor.ts:311-312
Review details

Best possible solution:

Use one direct-space guard for Google Chat DM reply context and typing sends, add focused monitor coverage, and require redacted real DM proof before merge.

Do we have a high-confidence way to reproduce the issue?

Yes. Source inspection shows Google Chat DM events can carry message.thread?.name, and current code passes thread values into sendGoogleChatMessage; live after-fix proof is still missing.

Is this the best way to solve the issue?

No, not yet. Guarding the turn reply context is a good part of the fix, but the maintainable solution should guard all direct-space threaded sends and prove the real Google Chat DM path.

Full review comments:

  • [P2] Guard the full DM thread send path — extensions/googlechat/src/monitor.ts:311-312
    This guard only removes the thread from the turn reply context. The same DM event can still send the typing indicator with thread: message.thread?.name, and sendGoogleChatMessage converts any thread into a threaded Google Chat API request, so DMs can still hit the invalid-thread path this PR is trying to remove. Share the direct-space guard with that send and add focused monitor coverage.
    Confidence: 0.84

Overall correctness: patch is incorrect
Overall confidence: 0.82

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 7d6b7f434c2e.

Label changes

Label justifications:

  • P2: The PR targets a bounded Google Chat DM message-delivery bug with limited blast radius.
  • merge-risk: 🚨 message-delivery: The patch changes Google Chat reply threading and still leaves a DM threaded-send path plus no live delivery proof.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body has reproduction steps but no after-fix real Google Chat proof; add redacted logs, terminal output, screenshot, recording, or linked artifact, then update the PR body to trigger re-review or ask a maintainer to comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source 0. Total 0 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 2 2 0
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 2 2 0

What I checked:

  • PR diff: The branch only changes extensions/googlechat/src/monitor.ts to guard the turn-context replyToId and replyToIdFull fields with isGroup; no test or live-proof artifact is included. (extensions/googlechat/src/monitor.ts:311, 9e9c1f35a08e)
  • Current main reply context: Current main still sets Google Chat turn reply context from message.thread?.name, which is the path this PR is trying to narrow for DMs. (extensions/googlechat/src/monitor.ts:311, 7d6b7f434c2e)
  • Remaining threaded DM send path: The typing indicator send still passes message.thread?.name directly to sendGoogleChatMessage, so a DM event with a thread can still attempt a threaded Google Chat API request before the turn runs. (extensions/googlechat/src/monitor.ts:363, 7d6b7f434c2e)
  • Thread argument contract in local helper: sendGoogleChatMessage turns any provided thread into body.thread.name and adds messageReplyOption, so callers must avoid passing thread values for DM sends that Google rejects. (extensions/googlechat/src/api.ts:147, 7d6b7f434c2e)
  • Google Chat API contract: The official Google Chat create-message reference says messageReplyOption is only supported in named spaces, and the Space reference documents spaceType values including DIRECT_MESSAGE.
  • Existing review discussion: The prior ClawSweeper review already requested real Google Chat DM proof and called out the unguarded typing-indicator/direct-space path; no newer PR body or comment evidence resolves that blocker.

Likely related people:

  • @steipete: Peter Steinberger is the blame/committer for the current Google Chat monitor and send-helper lines, and earlier history shows Google Chat thread support landed through his commits. (role: recent area contributor and merger; confidence: high; commits: 5e8f4981a522, cdbed3c9b1c4, 5570e1a94614; files: extensions/googlechat/src/monitor.ts, extensions/googlechat/src/api.ts, extensions/googlechat/src/monitor-reply-delivery.ts)
  • @iHildy: Git history credits iHildy on the Google Chat typing-indicator behavior adjacent to the remaining unguarded send path. (role: feature contributor; confidence: medium; commits: c64184fcfaa5, 5570e1a94614; files: extensions/googlechat/src/monitor.ts, extensions/googlechat/src/api.ts)
  • @novan: The Google Chat thread reply option support was landed in a commit credited to @novan, which is directly adjacent to the threaded-send behavior under review. (role: prior thread-support contributor; confidence: medium; commits: cdbed3c9b1c4; files: extensions/googlechat/src/api.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels May 26, 2026
@clawsweeper

clawsweeper Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

@steipete steipete self-assigned this May 27, 2026
jailbirt and others added 2 commits May 27, 2026 07:13
In Google Chat, thread reply IDs are only valid in group spaces.
Setting replyToId to message.thread?.name in DM (Direct Message)
conversations causes a 400 'invalid thread resource name' error from
the Google Chat API, making the agent appear unresponsive even though
the model had successfully generated a reply.

Fix: guard replyToId and replyToIdFull with isGroup, so DM replies
are sent without a thread target (which is correct for DMs).
@steipete
steipete force-pushed the fix/googlechat-dm-replyto-thread branch from 9e9c1f3 to 46eae16 Compare May 27, 2026 06:22
@steipete steipete added the proof: override Maintainer override for the external PR real behavior proof gate. label May 27, 2026
@steipete

Copy link
Copy Markdown
Contributor

Maintainer verification for the DM thread fix:

Behavior addressed: Google Chat DM events that include message.thread.name no longer pass a thread target into reply context or typing-indicator sends.

Exact commands/proof run after the patch:

node scripts/run-vitest.mjs extensions/googlechat/src/monitor.test.ts
pnpm check:changed
/Users/steipete/Projects/agent-scripts/skills/autoreview/scripts/autoreview --mode local

Evidence after fix:

node scripts/run-vitest.mjs extensions/googlechat/src/monitor.test.ts
Test Files  1 passed (1)
Tests  5 passed (5)

pnpm check:changed
provider=blacksmith-testbox id=tbx_01ksm18yck1zy35k0adgf66hax
GitHub Actions run: https://github.com/openclaw/openclaw/actions/runs/26494371192
blacksmith run summary sync=delegated command=2m9.676s total=2m16.141s exit=0

autoreview --mode local
autoreview clean: no accepted/actionable findings reported
overall: patch is correct (0.83)

Observed result after fix: the regression test proves a DM carrying thread.name builds reply metadata with replyToId: undefined and sends the typing indicator with thread: undefined, while the turn still runs.

What was not tested: no live Google Chat DM was exercised in this maintainer session; this is a maintainer proof override based on targeted regression coverage, Testbox changed checks, and autoreview.

@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 27, 2026
@steipete
steipete merged commit da822dd into openclaw:main May 27, 2026
109 of 114 checks passed
jailbirt added a commit to jailbirt/openclaw that referenced this pull request Jul 10, 2026
Adds an optional dmThreadMode ("none" | "thread", default "none") to the Google Chat
account config. Default preserves current behavior (DM replies not threaded, per openclaw#87054);
"thread" makes DM replies use the message thread like group replies. Includes a unit test.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: googlechat Channel integration: googlechat merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. proof: override Maintainer override for the external PR real behavior proof gate. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants