Skip to content

fix(googlechat): fix googlechat grant_type#78554

Open
donbowman wants to merge 2 commits into
openclaw:mainfrom
donbowman:fix-googlechat-grant
Open

fix(googlechat): fix googlechat grant_type#78554
donbowman wants to merge 2 commits into
openclaw:mainfrom
donbowman:fix-googlechat-grant

Conversation

@donbowman

@donbowman donbowman commented May 6, 2026

Copy link
Copy Markdown

Summary

in recent refactor of gaxios, Google chat was broken. #77307 has more details.

  • Resolves the unsupported_grant_type error by ensuring we instantiate the exact same version of Gaxios that google-auth-library uses internally.

  • Previously, the dynamic import('gaxios') resolved to a hoisted version (6.7.1) in the workspace instead of the version (7.1.4) required by [email protected]. The older version did not natively handle URLSearchParams, leading to the body being stringified as JSON ("{}") and the token exchange failing due to missing grant type fields.

  • Recent refactoring introduced a native Headers conversion that broke
    gaxios 7.x, as it uses direct property assignment (e.g. headers['Content-Type'])
    to prepare form-data bodies. Native Headers objects ignore these
    assignments, causing requests to be sent without the required
    application/x-www-form-urlencoded header.

    Changes:

    • Replace native Headers conversion in normalizeGoogleAuthPreparedRequestHeaders
      with a compatibility layer that adds get/set/has/delete to the
      plain headers object.
    • Update createGoogleAuthFetch to correctly extract method, headers,
      and body when called with a native Request object.
    • Add regression test for Request property preservation.
  • Problem: resolves [Bug]: googlechat broken in 2026-05-01 (working in 2026-04-29): Google Chat message send failed: Error: unsupported_grant_type: Invalid grant_type: , 76742 and 76880 not resolved, reopen #77307 Google chat was broken in recent refactoring

  • Why it matters:

  • What changed: Google chat, headers,

  • What did NOT change (scope boundary): no change in functionality or other modules

Change Type (select all)

  • [x ] Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • [ x] Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

Real behavior proof (required for external PRs)

External contributors must show after-fix evidence from a real OpenClaw setup. Unit tests, mocks, lint, typechecks, snapshots, and CI are supplemental only. Screenshots are encouraged even for CLI, console, text, or log changes; terminal screenshots and copied live output count. Be mindful of private information like IP addresses, API keys, phone numbers, non-public endpoints, or other private details when providing evidence.

Behavior or issue addressed: Corrects #77307 breakage of googlechat
Real environment tested: Ubuntu 26.04 with OpenClaw from pnpm and git
Exact steps or command run after this patch: enable googlechat, send a message to opencaw
Evidence after fix (screenshot, recording, terminal capture, console output, redacted runtime log, linked artifact, or copied live output): screenshot

Observed result after fix:

image

What was not tested: I ran the standard unit tests. I tested googlechat. I didn't test beyond that, the patch is self contained and small
Before evidence (optional but encouraged):

  1. behaviour. See [Bug]: googlechat broken in 2026-05-01 (working in 2026-04-29): Google Chat message send failed: Error: unsupported_grant_type: Invalid grant_type: , 76742 and 76880 not resolved, reopen #77307, but, without this fix, Googlechat doesn't work at all, gives unknown grant_type log
  2. environment. I tested this in Ubuntu 26.04
  3. steps. 1. use it. 2. observe it doesn't work
  4. evidence. see below screen shot of before and after
  5. observed result: see below screenshot

after-fix evidence is below, its a screen shot of it working. this is a real OpenClaw setup.

its a bit hard to show the missing log for the error :)
Google chat now works for me, no longer exiting early with logs.

Ubuntu 26.04 was env tested. I tested manually with googlechat service account.

here is a screenshot
image

Root Cause (if applicable)

For bug fixes or regressions, explain why this happened, not just what changed. Otherwise write N/A. If the cause is unclear, write Unknown.

  • Root cause: refactor of gaxios broke this module which relied on it
  • Missing detection / guardrail:
  • Contributing context (if known):

Regression Test Plan (if applicable)

For bug fixes or regressions, name the smallest reliable test coverage that should catch this. Otherwise write N/A.

  • Coverage level that should have caught this:
    • [ x] Unit test -- we need googlechat unit tests
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file:
  • Scenario the test should lock in:
  • Why this is the smallest reliable guardrail:
  • Existing test that already covers this (if any):
  • If no new test is added, why not:

User-visible / Behavior Changes

List user-visible changes (including defaults/config).
If none, write None.
none

Diagram (if applicable)

For UI changes or non-trivial logic flows, include a small ASCII diagram reviewers can scan quickly. Otherwise write N/A.
N/A

Security Impact (required)

  • New permissions/capabilities? (Yes/No) No
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) No
  • Data access scope changed? (Yes/No) No
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: ubuntu 26.04
  • Runtime/container: pnpm
  • Model/provider: N/A
  • Integration/channel (if any):
  • Relevant config (redacted):

Steps

  1. install openclaw
  2. add a Google service account
  3. enable Google chat
  4. try it. observed it doesn't work

Expected

  • Google chat works

Actual

  • gives unknown grant_type log

Evidence

Attach at least one:

image

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: used googlechat, said 'hi', it responded
  • Edge cases checked:
  • What you did not verify:

see screenshot
image

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? (Yes/No)
  • Config/env changes? (Yes/No)
  • Migration needed? (Yes/No)
  • If yes, exact upgrade steps:

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk:
    • Mitigation:

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

clawsweeper Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed July 3, 2026, 5:07 PM ET / 21:07 UTC.

Summary
The PR changes Google Chat auth transport/header handling, switches toward google-auth-library's bundled gaxios, removes direct gaxios from package/lock/contract surfaces, updates tests, and edits CHANGELOG.md.

PR surface: Source +80, Tests -1, Docs +1, Config -1, Other -3. Total +76 across 7 files.

Reproducibility: yes. at source/proof level, but not from a fresh live current-main run: the reporter provided Google Chat setup steps, logs, and before/after screenshots, and the implicated auth transport path is clear in source.

Review metrics: 1 noteworthy metric.

  • Plugin Dependency Contract: 1 runtime dependency removed; 0 plugin shrinkwrap updates. The PR removes direct gaxios from the Google Chat package path while the published plugin shrinkwrap still declares and pins it.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #77307
Summary: This PR is the candidate fix for the open Google Chat unsupported_grant_type regression; earlier reports cover predecessor auth-header failures and another open PR covers distinct thread delivery behavior.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🦞 diamond lobster ✨ media proof bonus
Patch quality: 🦐 gold shrimp
Result: needs maintainer review before merge.

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

Rank-up moves:

  • Rebase or replace the branch on current main so the exact merge result can be reviewed.
  • Align extensions/googlechat/package.json, extensions/googlechat/npm-shrinkwrap.json, pnpm-lock.yaml, and the package-manifest contract if direct gaxios removal remains intended.
  • Remove the release-owned changelog edit.

Risk before merge

  • [P1] The PR is currently CONFLICTING/DIRTY, so the exact merge result needs a rebase or replacement before maintainers can trust it.
  • [P1] Removing Google Chat's direct gaxios dependency changes the plugin package contract while extensions/googlechat/npm-shrinkwrap.json still pins top-level gaxios.
  • [P1] The diff changes service-account token exchange transport and auth header handling, so maintainers need fresh-install and upgrade confidence after the branch is refreshed.
  • [P1] A later user comment reports Google Chat working on a current release, but this review could not tie that to a specific shipped fix that fully supersedes this PR.

Maintainer options:

  1. Refresh With Package Contract Proof (recommended)
    Rebase or replace the branch, update package, root lock, plugin shrinkwrap, and contract expectations together, then refresh Google Chat auth proof on the new head.
  2. Close After Shipped Proof
    If maintainers confirm current v2026.6.11 or current main restores Google Chat without this dependency path, close this PR after linking the release/commit proof and resolving the linked report.
  3. Accept Dependency Direction Deliberately
    Maintainers may choose to rely on google-auth-library's exported gaxios, but that should be an explicit package-resolution decision with upgrade proof.

Next step before merge

  • [P2] Human maintainer review is needed because the branch is conflicting and the remaining dependency/upgrade direction is not a narrow automatic repair.

Security
Cleared: No concrete security or supply-chain regression was found beyond the auth/dependency compatibility risks that need maintainer review.

Review findings

  • [P2] Align the plugin shrinkwrap with the dependency change — extensions/googlechat/package.json:11
  • [P3] Remove the release-owned changelog entry — CHANGELOG.md:13
Review details

Best possible solution:

Rebase or replace the branch, remove the release-owned changelog edit, align package/lock/shrinkwrap contracts, and refresh Google Chat token-exchange proof; if current releases already fix the bug, close this PR and the linked report with shipped proof.

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

Yes at source/proof level, but not from a fresh live current-main run: the reporter provided Google Chat setup steps, logs, and before/after screenshots, and the implicated auth transport path is clear in source.

Is this the best way to solve the issue?

Unclear as-is: the PR is a plausible dependency-backed fix, but the branch is conflicting, the plugin package graph is unaligned, and later user evidence suggests current releases may already work.

Full review comments:

  • [P2] Align the plugin shrinkwrap with the dependency change — extensions/googlechat/package.json:11
    The PR removes Google Chat's direct gaxios dependency from the package and contract surfaces, but the plugin shrinkwrap still declares and pins top-level gaxios. If this dependency removal is intentional, update the package manifest, root lock, plugin shrinkwrap, and contract expectation together so the published install graph matches the reviewed manifest.
    Confidence: 0.87
  • [P3] Remove the release-owned changelog entry — CHANGELOG.md:13
    CHANGELOG.md is release-generated in this repository; normal PRs should carry release-note context in the PR body or commit message instead. Please drop this entry from the branch.
    Confidence: 0.95

Overall correctness: patch is incorrect
Overall confidence: 0.84

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 010b61746379.

Label changes

Label justifications:

  • P2: This is a bounded Google Chat auth regression fix with real user impact, but current-release evidence suggests the channel may already work for at least one affected user.
  • merge-risk: 🚨 compatibility: The PR removes Google Chat's direct gaxios runtime dependency and changes the plugin package contract expected by current main.
  • merge-risk: 🚨 auth-provider: The diff changes service-account token exchange transport and Google auth header handling for the Google Chat channel.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (screenshot): Before/after Google Chat screenshots from a stated Ubuntu service-account setup were inspectable and directly show no response before and an OpenClaw app reply after the fix.
  • proof: sufficient: Contributor real behavior proof is sufficient. Before/after Google Chat screenshots from a stated Ubuntu service-account setup were inspectable and directly show no response before and an OpenClaw app reply after the fix.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Before/after Google Chat screenshots from a stated Ubuntu service-account setup were inspectable and directly show no response before and an OpenClaw app reply after the fix.
Evidence reviewed

PR surface:

Source +80, Tests -1, Docs +1, Config -1, Other -3. Total +76 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 1 94 14 +80
Tests 3 66 67 -1
Docs 1 1 0 +1
Config 1 0 1 -1
Generated 0 0 0 0
Other 1 0 3 -3
Total 7 161 85 +76

What I checked:

Likely related people:

  • vincentkoc: Auth hardening, header normalization, and isolated transport work in the current Google Chat auth runtime path are tied to this history. (role: recent Google Chat auth transport contributor; confidence: high; commits: 6d6845ea9d23, 01e2755dc3c7, b31c001a2b51; files: extensions/googlechat/src/google-auth.runtime.ts, extensions/googlechat/package.json, src/plugins/contracts/package-manifest.contract.test.ts)
  • steipete: Recent commits touched the same Google Chat auth runtime, tests, package surfaces, and response-header repair path. (role: recent adjacent contributor; confidence: medium; commits: e5248789986c, 827b0de0ce74, 58e82d91bafd; files: extensions/googlechat/src/google-auth.runtime.ts, extensions/googlechat/src/google-auth.runtime.test.ts, extensions/googlechat/package.json)
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.

@donbowman

Copy link
Copy Markdown
Author

i'm not sure how to show proof a log does not exist, but, you ask for it, so...

Here is me running googlechat and not getting error logs:

and here is a screenshot of it working again in chat:

image

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 6, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 6, 2026
@donbowman

Copy link
Copy Markdown
Author

the label 'needs proof'. I don't know what more I can say.
i'm using this, with a live Google service account.
I was not able to use this prior to my fix, it would log the error about grant_type: "".
Now it does not log any errors.

When I type in Googlechat, it is received by openclaw.

I provided a screen shot, what more can I provide?

here is the before screenshot:

image

here is the after screenshot:

image

this is convincing proof that the fix works, in a real environment.

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 6, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 6, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 6, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 6, 2026
@donbowman

Copy link
Copy Markdown
Author

why does @clawsweeper bot add the proof:sufficient label only to be immediately removed by the @openclaw-barnacle bot?

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 7, 2026
@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 7, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 7, 2026
@openclaw-barnacle openclaw-barnacle Bot added security Security documentation size: M and removed size: S proof: sufficient ClawSweeper judged the real behavior proof convincing. labels May 7, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 7, 2026
@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts docker Docker and sandbox tooling size: L size: M and removed size: M size: L labels May 7, 2026
@donbowman
donbowman force-pushed the fix-googlechat-grant branch from 0513ea7 to 2d2b840 Compare May 8, 2026 22:50
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 8, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 8, 2026
@donbowman
donbowman force-pushed the fix-googlechat-grant branch from 2d2b840 to cca1242 Compare May 9, 2026 00:23
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 9, 2026
@donbowman
donbowman force-pushed the fix-googlechat-grant branch 2 times, most recently from ac15c5b to 1bcd48f Compare May 9, 2026 00:44
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 9, 2026
@donbowman
donbowman force-pushed the fix-googlechat-grant branch from 1bcd48f to 691fe51 Compare May 9, 2026 02:53
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 9, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 9, 2026
@donbowman
donbowman force-pushed the fix-googlechat-grant branch from 691fe51 to 60899c2 Compare May 9, 2026 17:29
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 9, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 9, 2026
donbowman added 2 commits May 9, 2026 17:00
…ctor

in recent refactor of gaxios, Google chat was broken. openclaw#77307 has more details.

Resolves the unsupported_grant_type error by ensuring we instantiate the exact same version of Gaxios that google-auth-library uses internally.

Previously, the dynamic import('gaxios') resolved to a hoisted version (6.7.1) in the workspace instead of the version (7.1.4) required by [email protected]. The older version did not natively handle URLSearchParams, leading to the body being stringified as JSON ("{}") and the token exchange failing due to missing grant type fields.

Recent refactoring introduced a native Headers conversion that broke
gaxios 7.x, as it uses direct property assignment (e.g. headers['Content-Type'])
to prepare form-data bodies. Native Headers objects ignore these
assignments, causing requests to be sent without the required
application/x-www-form-urlencoded header.

Changes:

Replace native Headers conversion in normalizeGoogleAuthPreparedRequestHeaders
with a compatibility layer that adds get/set/has/delete to the
plain headers object.
Update createGoogleAuthFetch to correctly extract method, headers,
and body when called with a native Request object.
Add regression test for Request property preservation.
@jdlayes

jdlayes commented May 14, 2026

Copy link
Copy Markdown

I'm seeing the same errors for googlechat as @donbowman on versions > 2025.5.6, and reverting to 2025.4.29 brought me back to a good state. We're working through a separate gaxios-related issue but if this PR isn't merged in the next few days, we'll try applying it manually on a more recent version.

@donbowman

Copy link
Copy Markdown
Author

i gave up rebasing this, i will if there's interest, but w/o a reviewer and no prospect of merging it, it seemed like a waste of time to me.

@barnacle-openclaw

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@barnacle-openclaw barnacle-openclaw Bot added the stale Marked as stale due to inactivity label May 31, 2026
@clawsweeper clawsweeper Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 31, 2026
@jdlayes

jdlayes commented Jun 1, 2026

Copy link
Copy Markdown

It has taken me longer to get back to this than I hoped but we will need G Chat integration in a current version in the next 1-2 weeks, and I'm still pinned to 2025.4.29 because of the bug. If this hasn't been superseded by other work, I'd be happy to help with pushing this through, but likely won't have a chance until early next week.

@donbowman

Copy link
Copy Markdown
Author

It has taken me longer to get back to this than I hoped but we will need G Chat integration in a current version in the next 1-2 weeks, and I'm still pinned to 2025.4.29 because of the bug. If this hasn't been superseded by other work, I'd be happy to help with pushing this through, but likely won't have a chance until early next week.

afaik its still needed. feel free to push this, i've pretty much given up, its a lot of work rebasing all the time for no progress.

i've given up on openclaw and switched to hermes.

@jdlayes

jdlayes commented Jun 18, 2026

Copy link
Copy Markdown

@donbowman I know you've moved on from trying to rebase this but commenting here for completeness that googlechat now works end-to-end for us on 2026.6.6, whereas it hadn't through most 2026.5.x releases. Presumably recent work on googlechat has superseded this.

I will have a googlechat PR of my own for supporting ADC shortly; hopefully I won't run into the same issues you did.

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: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

2 participants