Skip to content

fix(googlechat): replace unbounded response.json() with readProviderJsonResponse#96772

Merged
vincentkoc merged 4 commits into
openclaw:mainfrom
wangmiao0668000666:fix/googlechat-bounded-read
Jun 27, 2026
Merged

fix(googlechat): replace unbounded response.json() with readProviderJsonResponse#96772
vincentkoc merged 4 commits into
openclaw:mainfrom
wangmiao0668000666:fix/googlechat-bounded-read

Conversation

@wangmiao0668000666

@wangmiao0668000666 wangmiao0668000666 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

extensions/googlechat/src/api.ts (readGoogleChatJsonResponse) and extensions/googlechat/src/auth.ts (readGoogleChatCertsResponse) both call await response.json() with no byte-level cap. A hostile or malfunctioning Google Chat API endpoint (or an intermediary) can return an oversized JSON body that exhausts process memory during JSON parsing.

This is the same bounded-read pattern Alix-007 applied to 15+ other extensions (readProviderJsonResponse, 16 MiB cap). Google Chat was one of the remaining unbounded .json() call sites.

Changes

  • extensions/googlechat/src/api.ts:15-19readGoogleChatJsonResponse now delegates to readProviderJsonResponse<T>(response, label). The local try { return await response.json() } catch (cause) { throw new Error(..., { cause }) } wrapper is replaced by the SDK helper which provides the same error shape (${label}: malformed JSON response) plus a 16 MiB byte cap.
  • extensions/googlechat/src/auth.ts:19-25readGoogleChatCertsResponse now delegates to readProviderJsonResponse<Record<string, string>>(response, "Google Chat cert fetch failed"). Error message preserved identically.

Real behavior proof

  • Behavior addressed: unbounded response.json() on Google Chat API and cert HTTP responses; after the fix reads are capped at 16 MiB.
  • Real environment tested: real node:http server (127.0.0.1, chunked transfer, no Content-Length) driving production readProviderJsonResponse. Node v22.22.0, Linux x86_64.
  • Exact steps or command run after this patch:
    node --import tsx _proof_googlechat_bounded.mts
  • Evidence after fix:
    === Google Chat JSON bounded-read assertions ===
    
      PASS  hostile body: overflow error thrown — Google Chat JSON: JSON response exceeds 16777216 bytes
      PASS  hostile body: cap value in error — cap=16777216
      PASS  hostile body: bytes read ≈ cap — server sent ~16.0 MiB (cap=16 MiB)
      PASS  hostile body: not full body — server sent 16 MiB, would have been 32 MiB without cap
      PASS  hostile body: connection handled — reader stopped before full body
      PASS  negative control: small body parses — status=ok
      PASS  negative control: bytes < cap — 0 KiB
      PASS  happy path: valid JSON parses — text="hello"
      PASS  happy path: bytes < cap — 0 KiB
    
    Results: 9/9 passed
    
  • Observed result after fix: readProviderJsonResponse threw canonical overflow at 16 MiB (JSON response exceeds 16777216 bytes). Server sent ~16.0 MiB of a 32 MiB hostile payload — capped before full body. Negative control (small JSON, status=ok) and happy path (valid JSON, text="hello") parsed correctly. Server-side bytes-sent confirmed cap activation at 16.0 MiB, not the full 32 MiB.
  • What was not tested: live Google Chat API call (the proof exercises the same production SDK helper against the same attack shape the live endpoint could carry); cross-platform Node differences (Node 22 only, matches CI).

Out of scope

  • extensions/googlechat/src/api.ts:117 (fetchBuffer) already uses readResponseWithLimit for media downloads — not affected.
  • Other extensions (image-generation, etc.) — separate per-surface PRs.

Risk

  • Very low: swap from a local (await response.json()) as T to readProviderJsonResponse<T>(response, label). Error messages are preserved (${label}: malformed JSON response). The helper is already used by 15+ extensions. The byte cap (16 MiB, default) is invisible to normal-sized responses.
  • No SDK promotion: readProviderJsonResponse has been in openclaw/plugin-sdk/provider-http since the Alix-007 bounded-read sweep.

AI-assisted; reviewed before submission.

@openclaw-barnacle openclaw-barnacle Bot added channel: googlechat Channel integration: googlechat size: XS labels Jun 25, 2026
@clawsweeper

clawsweeper Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 26, 2026, 8:05 PM ET / 00:05 UTC.

Summary
The PR bounds Google Chat success JSON, cert JSON, and non-OK API error body reads and adds oversized-stream regression tests.

PR surface: Source 0, Tests +133. Total +133 across 3 files.

Reproducibility: Do we have a high-confidence way to reproduce the issue? Yes from source inspection and the supplied proof: current main uses native response.json()/text on the targeted paths, and the PR proof exercises oversized streamed bodies against the bounded helper path.

Review metrics: 1 noteworthy metric.

  • Bounded Google Chat Response Reads: 2 success JSON readers and 1 non-OK text reader changed. These are the paths whose upgrade behavior changes from native full-body buffering to bounded failure or bounded diagnostics.

Root-cause cluster
Relationship: canonical
Canonical: #96772
Summary: This PR is the focused active candidate for the Google Chat bounded JSON and error-body gap; nearby items are closed predecessors, broader overlapping attempts, or adjacent bounded-reader fixes for other surfaces.

Members:

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

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

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

Risk before merge

  • [P1] Legitimate Google Chat success or cert JSON responses over the shared 16 MiB cap will now fail instead of fully buffering.
  • [P1] Non-OK Google Chat API diagnostics are now limited to the shared readResponseTextLimited budget, so very large provider error bodies will be truncated.
  • [P1] The latest live head b353dc0 was still running exact-head checks during this review.

Maintainer options:

  1. Accept Shared Google Chat Bounds (recommended)
    Merge after current-head checks are green, explicitly owning the 16 MiB JSON cap and bounded diagnostic text behavior for Google Chat.
  2. Adjust Caps Before Merge
    If maintainers expect valid Google Chat JSON or diagnostic bodies above these shared budgets, set an explicit Google Chat cap and update the regression tests before landing.

Next step before merge

  • No automated repair is needed; a maintainer should accept or adjust the compatibility boundary and wait for the latest exact-head checks before merging.

Security
Cleared: No concrete supply-chain or new security regression was found; the diff adds no dependencies, workflows, permissions, package metadata, or secret handling and reduces unbounded external-response buffering.

Review details

Best possible solution:

Land this focused helper-based fix once maintainers accept the shared response-size caps as the Google Chat compatibility policy and the latest head checks finish green.

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

Do we have a high-confidence way to reproduce the issue? Yes from source inspection and the supplied proof: current main uses native response.json()/text on the targeted paths, and the PR proof exercises oversized streamed bodies against the bounded helper path.

Is this the best way to solve the issue?

Is this the best way to solve the issue? Yes; reusing readProviderJsonResponse and readResponseTextLimited keeps the byte-limit policy in the existing provider SDK helper layer instead of adding Google Chat-specific stream code or landing the broader overlapping batch.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: This is a normal-priority defensive hardening fix for one bundled channel with limited blast radius and no confirmed active outage.
  • merge-risk: 🚨 compatibility: The PR intentionally changes oversized Google Chat success responses and long API diagnostics from full buffering to bounded failure or truncation.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes after-fix terminal proof from a real local streamed HTTP response exercising the production bounded JSON helper; current exact-head checks are a separate merge gate.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix terminal proof from a real local streamed HTTP response exercising the production bounded JSON helper; current exact-head checks are a separate merge gate.
Evidence reviewed

PR surface:

Source 0, Tests +133. Total +133 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 11 11 0
Tests 1 133 0 +133
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 144 11 +133

What I checked:

Likely related people:

  • vincentkoc: Authored the Google Chat malformed JSON wrapper commit, added the PR follow-up that bounds non-OK API error bodies, and is the current assignee with maintainer proof comments. (role: recent area contributor and reviewer; confidence: high; commits: 60a6945a6e87, b353dc08978f; files: extensions/googlechat/src/api.ts, extensions/googlechat/src/targets.test.ts)
  • Alix-007: Authored the merged provider JSON bounded-reader helper and tests that this PR reuses as the canonical implementation pattern. (role: shared helper contributor; confidence: high; commits: 2592f8a51a4e; files: src/agents/provider-http-errors.ts, src/agents/provider-http-errors.test.ts, src/plugin-sdk/provider-http.ts)
  • steipete: Recent history shows Google Chat API fetch handling and related helper refactors in the same code path. (role: recent Google Chat area contributor; confidence: medium; commits: 6ecc18463753, 325ff24bae6b, f09cee84f271; files: extensions/googlechat/src/api.ts, extensions/googlechat/src/auth.ts, extensions/googlechat/src/targets.test.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 proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jun 25, 2026
@wangmiao0668000666

Copy link
Copy Markdown
Contributor Author

Upgraded proof: 9 assertions with quantified bytes-sent metrics (hostile body capped at ~16.0 MiB of 32 MiB payload, server stopped before full body). Added AI disclosure.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@wangmiao0668000666

Copy link
Copy Markdown
Contributor Author

Added inline bounded-read regression tests (2 tests: oversized cert JSON + oversized sendMessage JSON, both verify stream cancelled early with bytes-pulled < cap). Removed unused var.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jun 26, 2026
wangmiao0668000666 added a commit to wangmiao0668000666/openclaw that referenced this pull request Jun 26, 2026
Follow openclaw#96772 pattern: export readJsonResponseForTest and add 5 inline tests
(overflow + error prefix + negative control + happy path + HTTP error)
that exercise readProviderJsonResponse through the production wrapper
with a real oversized Response+ReadableStream.

Upgrades from 🐚 to 🦞 per bounded-read-inline-test-requirement.

Test results: 5/5 new tests pass, 26/26 total comfy tests pass.
@vincentkoc vincentkoc self-assigned this Jun 26, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Maintainer proof for debeff084317ea847ae8b848d470428f8223b7e1:

No blocking findings. Proceeding to merge if the wrapper's final drift check stays clean.

@vincentkoc
vincentkoc force-pushed the fix/googlechat-bounded-read branch from debeff0 to deaae33 Compare June 26, 2026 23:41
@vincentkoc
vincentkoc force-pushed the fix/googlechat-bounded-read branch from deaae33 to 389c462 Compare June 26, 2026 23:52
@vincentkoc

Copy link
Copy Markdown
Member

Maintainer proof refresh for the latest synced head 389c462cbeed67f29955778b7e0e44cf5e06835d:

  • Re-reviewed the Google Chat response body paths after the maintainer fix: success JSON reads now go through readProviderJsonResponse, cert fetch JSON uses the same bounded helper, and non-OK API error text now goes through readResponseTextLimited instead of unbounded response.text().
  • Focused regression coverage includes oversized JSON bodies and oversized non-OK error bodies with cancellation/release assertions.
  • Autoreview: .agents/skills/autoreview/scripts/autoreview --mode local returned clean after the maintainer fix.
  • Local focused Vitest was attempted with node scripts/run-vitest.mjs extensions/googlechat/src/targets.test.ts, but local heavy-check serialization was held by another worktree, so I did not bypass or kill that lock.
  • Hosted exact-head CI passed: https://github.com/openclaw/openclaw/actions/runs/28271769032 (43 success, 9 skipped, no failures).
  • Wrapper gate passed: OPENCLAW_TESTBOX=1 scripts/pr prepare-run 96772.

I’m merging this now unless the merge guard catches fresh main drift.

wangmiao0668000666 and others added 4 commits June 26, 2026 17:02
…sonResponse

Replace the local readGoogleChatJsonResponse and
readGoogleChatCertsResponse wrappers with the existing SDK helper
readProviderJsonResponse (from openclaw/plugin-sdk/provider-http) so the
Google Chat API JSON responses are bounded at 16 MiB, matching the
non-streaming cap already used by 15+ other extensions.

What changed:
- extensions/googlechat/src/api.ts: readGoogleChatJsonResponse now
  delegates to readProviderJsonResponse. Removed the local try/catch
  wrapper.
- extensions/googlechat/src/auth.ts: readGoogleChatCertsResponse now
  delegates to readProviderJsonResponse. Error message preserved.
  Removed the local try/catch wrapper.

This PR applies the same pattern as Alix-007's openclaw#96042, openclaw#96038 (lmstudio,
provider JSON reads). No SDK promotion needed — readProviderJsonResponse
is already available in openclaw/plugin-sdk/provider-http.
@vincentkoc
vincentkoc force-pushed the fix/googlechat-bounded-read branch from 389c462 to b353dc0 Compare June 27, 2026 00:02
@vincentkoc

Copy link
Copy Markdown
Member

Maintainer proof refresh after latest main sync:

Proceeding with the repo merge wrapper now.

@vincentkoc

Copy link
Copy Markdown
Member

Maintainer proof after refresh to current main:

Best-fix verdict: good to land. This keeps response-size policy in the shared provider HTTP contract and removes the remaining unbounded Google Chat response-body read on the same hot I/O boundary.

@vincentkoc
vincentkoc merged commit 4f3d81b into openclaw:main Jun 27, 2026
87 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

@wangmiao0668000666

Copy link
Copy Markdown
Contributor Author

Thanks @vincentkoc for merging! 🎉

This brings the googlechat success-body read in line with the rest of the bounded-read campaign. The #96989 SSE buffer-cap fix for OpenAI providers is the next piece landing shortly.

wangmiao0668000666 added a commit to wangmiao0668000666/openclaw that referenced this pull request Jun 27, 2026
…sonResponse (openclaw#96772)

* fix(googlechat): replace unbounded response.json() with readProviderJsonResponse

Replace the local readGoogleChatJsonResponse and
readGoogleChatCertsResponse wrappers with the existing SDK helper
readProviderJsonResponse (from openclaw/plugin-sdk/provider-http) so the
Google Chat API JSON responses are bounded at 16 MiB, matching the
non-streaming cap already used by 15+ other extensions.

What changed:
- extensions/googlechat/src/api.ts: readGoogleChatJsonResponse now
  delegates to readProviderJsonResponse. Removed the local try/catch
  wrapper.
- extensions/googlechat/src/auth.ts: readGoogleChatCertsResponse now
  delegates to readProviderJsonResponse. Error message preserved.
  Removed the local try/catch wrapper.

This PR applies the same pattern as Alix-007's openclaw#96042, openclaw#96038 (lmstudio,
provider JSON reads). No SDK promotion needed — readProviderJsonResponse
is already available in openclaw/plugin-sdk/provider-http.

* fix(googlechat): add inline bounded-read regression tests

Co-Authored-By: Claude <[email protected]>

* fix(googlechat): remove unused variable flagged by oxlint

Co-Authored-By: Claude <[email protected]>

* fix(googlechat): bound api error body reads

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 27, 2026
…sonResponse (openclaw#96772)

* fix(googlechat): replace unbounded response.json() with readProviderJsonResponse

Replace the local readGoogleChatJsonResponse and
readGoogleChatCertsResponse wrappers with the existing SDK helper
readProviderJsonResponse (from openclaw/plugin-sdk/provider-http) so the
Google Chat API JSON responses are bounded at 16 MiB, matching the
non-streaming cap already used by 15+ other extensions.

What changed:
- extensions/googlechat/src/api.ts: readGoogleChatJsonResponse now
  delegates to readProviderJsonResponse. Removed the local try/catch
  wrapper.
- extensions/googlechat/src/auth.ts: readGoogleChatCertsResponse now
  delegates to readProviderJsonResponse. Error message preserved.
  Removed the local try/catch wrapper.

This PR applies the same pattern as Alix-007's openclaw#96042, openclaw#96038 (lmstudio,
provider JSON reads). No SDK promotion needed — readProviderJsonResponse
is already available in openclaw/plugin-sdk/provider-http.

* fix(googlechat): add inline bounded-read regression tests

Co-Authored-By: Claude <[email protected]>

* fix(googlechat): remove unused variable flagged by oxlint

Co-Authored-By: Claude <[email protected]>

* fix(googlechat): bound api error body reads

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
xydigit-zt pushed a commit to xydigit-zt/xydigit-zt-openclaw that referenced this pull request Jun 28, 2026
…sonResponse (openclaw#96772)

* fix(googlechat): replace unbounded response.json() with readProviderJsonResponse

Replace the local readGoogleChatJsonResponse and
readGoogleChatCertsResponse wrappers with the existing SDK helper
readProviderJsonResponse (from openclaw/plugin-sdk/provider-http) so the
Google Chat API JSON responses are bounded at 16 MiB, matching the
non-streaming cap already used by 15+ other extensions.

What changed:
- extensions/googlechat/src/api.ts: readGoogleChatJsonResponse now
  delegates to readProviderJsonResponse. Removed the local try/catch
  wrapper.
- extensions/googlechat/src/auth.ts: readGoogleChatCertsResponse now
  delegates to readProviderJsonResponse. Error message preserved.
  Removed the local try/catch wrapper.

This PR applies the same pattern as Alix-007's openclaw#96042, openclaw#96038 (lmstudio,
provider JSON reads). No SDK promotion needed — readProviderJsonResponse
is already available in openclaw/plugin-sdk/provider-http.

* fix(googlechat): add inline bounded-read regression tests

Co-Authored-By: Claude <[email protected]>

* fix(googlechat): remove unused variable flagged by oxlint

Co-Authored-By: Claude <[email protected]>

* fix(googlechat): bound api error body reads

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
QiuYuang pushed a commit to QiuYuang/openclaw that referenced this pull request Jul 1, 2026
…sonResponse (openclaw#96772)

* fix(googlechat): replace unbounded response.json() with readProviderJsonResponse

Replace the local readGoogleChatJsonResponse and
readGoogleChatCertsResponse wrappers with the existing SDK helper
readProviderJsonResponse (from openclaw/plugin-sdk/provider-http) so the
Google Chat API JSON responses are bounded at 16 MiB, matching the
non-streaming cap already used by 15+ other extensions.

What changed:
- extensions/googlechat/src/api.ts: readGoogleChatJsonResponse now
  delegates to readProviderJsonResponse. Removed the local try/catch
  wrapper.
- extensions/googlechat/src/auth.ts: readGoogleChatCertsResponse now
  delegates to readProviderJsonResponse. Error message preserved.
  Removed the local try/catch wrapper.

This PR applies the same pattern as Alix-007's openclaw#96042, openclaw#96038 (lmstudio,
provider JSON reads). No SDK promotion needed — readProviderJsonResponse
is already available in openclaw/plugin-sdk/provider-http.

* fix(googlechat): add inline bounded-read regression tests

Co-Authored-By: Claude <[email protected]>

* fix(googlechat): remove unused variable flagged by oxlint

Co-Authored-By: Claude <[email protected]>

* fix(googlechat): bound api error body reads

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
chenyangjun-xy pushed a commit to chenyangjun-xy/openclaw that referenced this pull request Jul 1, 2026
…sonResponse (openclaw#96772)

* fix(googlechat): replace unbounded response.json() with readProviderJsonResponse

Replace the local readGoogleChatJsonResponse and
readGoogleChatCertsResponse wrappers with the existing SDK helper
readProviderJsonResponse (from openclaw/plugin-sdk/provider-http) so the
Google Chat API JSON responses are bounded at 16 MiB, matching the
non-streaming cap already used by 15+ other extensions.

What changed:
- extensions/googlechat/src/api.ts: readGoogleChatJsonResponse now
  delegates to readProviderJsonResponse. Removed the local try/catch
  wrapper.
- extensions/googlechat/src/auth.ts: readGoogleChatCertsResponse now
  delegates to readProviderJsonResponse. Error message preserved.
  Removed the local try/catch wrapper.

This PR applies the same pattern as Alix-007's openclaw#96042, openclaw#96038 (lmstudio,
provider JSON reads). No SDK promotion needed — readProviderJsonResponse
is already available in openclaw/plugin-sdk/provider-http.

* fix(googlechat): add inline bounded-read regression tests

Co-Authored-By: Claude <[email protected]>

* fix(googlechat): remove unused variable flagged by oxlint

Co-Authored-By: Claude <[email protected]>

* fix(googlechat): bound api error body reads

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
chenyangjun-xy pushed a commit to chenyangjun-xy/openclaw that referenced this pull request Jul 3, 2026
…sonResponse (openclaw#96772)

* fix(googlechat): replace unbounded response.json() with readProviderJsonResponse

Replace the local readGoogleChatJsonResponse and
readGoogleChatCertsResponse wrappers with the existing SDK helper
readProviderJsonResponse (from openclaw/plugin-sdk/provider-http) so the
Google Chat API JSON responses are bounded at 16 MiB, matching the
non-streaming cap already used by 15+ other extensions.

What changed:
- extensions/googlechat/src/api.ts: readGoogleChatJsonResponse now
  delegates to readProviderJsonResponse. Removed the local try/catch
  wrapper.
- extensions/googlechat/src/auth.ts: readGoogleChatCertsResponse now
  delegates to readProviderJsonResponse. Error message preserved.
  Removed the local try/catch wrapper.

This PR applies the same pattern as Alix-007's openclaw#96042, openclaw#96038 (lmstudio,
provider JSON reads). No SDK promotion needed — readProviderJsonResponse
is already available in openclaw/plugin-sdk/provider-http.

* fix(googlechat): add inline bounded-read regression tests

Co-Authored-By: Claude <[email protected]>

* fix(googlechat): remove unused variable flagged by oxlint

Co-Authored-By: Claude <[email protected]>

* fix(googlechat): bound api error body reads

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
wheakerd pushed a commit to wheakerd/clawdbot that referenced this pull request Jul 15, 2026
…sonResponse (openclaw#96772)

* fix(googlechat): replace unbounded response.json() with readProviderJsonResponse

Replace the local readGoogleChatJsonResponse and
readGoogleChatCertsResponse wrappers with the existing SDK helper
readProviderJsonResponse (from openclaw/plugin-sdk/provider-http) so the
Google Chat API JSON responses are bounded at 16 MiB, matching the
non-streaming cap already used by 15+ other extensions.

What changed:
- extensions/googlechat/src/api.ts: readGoogleChatJsonResponse now
  delegates to readProviderJsonResponse. Removed the local try/catch
  wrapper.
- extensions/googlechat/src/auth.ts: readGoogleChatCertsResponse now
  delegates to readProviderJsonResponse. Error message preserved.
  Removed the local try/catch wrapper.

This PR applies the same pattern as Alix-007's openclaw#96042, openclaw#96038 (lmstudio,
provider JSON reads). No SDK promotion needed — readProviderJsonResponse
is already available in openclaw/plugin-sdk/provider-http.

* fix(googlechat): add inline bounded-read regression tests

Co-Authored-By: Claude <[email protected]>

* fix(googlechat): remove unused variable flagged by oxlint

Co-Authored-By: Claude <[email protected]>

* fix(googlechat): bound api error body reads

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
(cherry picked from commit 4f3d81b)
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: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants