Skip to content

fix(googlechat): cancel non-OK cert fetch response body before throwing - #109519

Merged
steipete merged 4 commits into
openclaw:mainfrom
Monkey-wusky:fix/googlechat-cancel-error-response-body
Jul 17, 2026
Merged

steipete merged 4 commits into
openclaw:mainfrom
Monkey-wusky:fix/googlechat-cancel-error-response-body

Conversation

@Monkey-wusky

Copy link
Copy Markdown
Contributor

What Problem This Solves

When fetchChatCerts in the Google Chat extension receives a non-OK response from the cert endpoint (https://chat.googleapis.com/service_accounts/v1/metadata/x509/[email protected]), it throws immediately without cancelling the response body. This leaves the underlying HTTP connection open until the response body is garbage-collected.

Why This Change Was Made

Other parts of the codebase already cancel non-OK response bodies before throwing — see fetchOpenRouterModels in model-scan.ts (finally block with res.body?.cancel()) and guard-adapters.ts (#109196, response.body?.cancel().catch(() => undefined)). This change applies the same pattern to fetchChatCerts.

The release() call in finally cleans up the dispatcher but does not cancel the unconsumed response body.

User Impact

No visible user impact. The fix ensures HTTP connections are released promptly when the Google Chat cert endpoint returns an error, which can improve responsiveness during API degradation.

Evidence

All existing Google Chat tests continue to pass (205/206, the one failure in setup.test.ts is a pre-existing environment issue unrelated to this change):

 Test Files  21 passed | 1 failed (22)
      Tests  205 passed | 1 failed (206)

The auth-specific test passes:

 ✓ |extension-messaging| auth.proof.test.ts (1 test)

Risk checklist

Did user-visible behavior change? (No)
Did config, environment, or migration behavior change? (No)
Did security, auth, secrets, network, or tool execution behavior change? (No)
What is the highest-risk area? - Minimal: one-line addition of body cancel before throw, pattern already used in 30+ locations across the codebase.
How is that risk mitigated? - Existing test suite verifies the function still works correctly.

When fetchChatCerts receives a non-OK response from the Google Chat
cert endpoint, it throws without cancelling the response body.
Cancel the body before throwing, matching the pattern established
in reef guard adapters (openclaw#109196) and fetchOpenRouterModels.
@openclaw-barnacle openclaw-barnacle Bot added channel: googlechat Channel integration: googlechat size: XS labels Jul 17, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 17, 2026
@clawsweeper

clawsweeper Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 16, 2026, 10:01 PM ET / July 17, 2026, 02:01 UTC.

Summary
The PR cancels the Google Chat certificate endpoint response body before throwing on a non-OK HTTP response.

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

Reproducibility: yes. at source level: a partial or stalled non-OK certificate response reaches the throw without consuming or cancelling its body. A real loopback reproduction was not supplied in the PR.

Review metrics: none identified.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup is added.

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

Rank-up moves:

  • [P1] Add redacted loopback HTTP evidence showing a partial or stalled non-OK response closes promptly after the production cancellation path runs.
  • Update the PR body with that evidence; if a fresh review does not start automatically, ask a maintainer to comment @clawsweeper re-review.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body shows tests only; add a redacted loopback or live transcript showing a partial non-OK response and observed peer closure, then update the PR body to trigger re-review.

Risk before merge

  • [P1] The claimed resource-release improvement has not been demonstrated against a real partial or stalled non-OK HTTP response, so the exact peer-close behavior remains unverified before merge.

Maintainer options:

  1. Decide the mitigation before merge
    Keep cancellation in the Google Chat caller, add focused coverage for the non-OK body path, and merge after a redacted loopback run shows the server observes prompt peer closure.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] No automated repair is needed because there is no actionable patch defect; the remaining merge gate is contributor-supplied real behavior proof.

Security
Cleared: The patch does not alter authentication acceptance, credentials, request targets, permissions, dependencies, or supply-chain behavior; it only releases an error response body.

Review details

Best possible solution:

Keep cancellation in the Google Chat caller, add focused coverage for the non-OK body path, and merge after a redacted loopback run shows the server observes prompt peer closure.

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

Yes at source level: a partial or stalled non-OK certificate response reaches the throw without consuming or cancelling its body. A real loopback reproduction was not supplied in the PR.

Is this the best way to solve the issue?

Yes. The caller owns consuming or cancelling the response body, while the guarded-fetch release callback separately owns dispatcher cleanup, so cancelling before preserving the existing HTTP error is the narrowest fix.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add P2: This is a bounded resource-leak fix affecting Google Chat authentication only when the remote certificate endpoint returns an error.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add 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 shows tests only; add a redacted loopback or live transcript showing a partial non-OK response and observed peer closure, then update the PR body to trigger re-review.

Label justifications:

  • P2: This is a bounded resource-leak fix affecting Google Chat authentication only when the remote certificate endpoint returns an error.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • 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 shows tests only; add a redacted loopback or live transcript showing a partial non-OK response and observed peer closure, then update the PR body to trigger re-review.
Evidence reviewed

PR surface:

Source +1. Total +1 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 1 0 +1
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 1 0 +1

What I checked:

Likely related people:

  • vincentkoc: Authored and merged the major Google Chat inbound authentication hardening that changed both auth.ts and its focused tests. (role: feature owner; confidence: high; commits: a47722de7e3c; files: extensions/googlechat/src/auth.ts, extensions/googlechat/src/auth.test.ts, extensions/googlechat/src/monitor-webhook.ts)
  • zhangguiping-xydt: Recently contributed the merged Reef fix establishing the same non-success response-body cancellation pattern with focused regression and loopback proof. (role: adjacent recent contributor; confidence: medium; commits: 05fd7b4d2db9, 2cd236385b30; files: extensions/reef/protocol/guard-adapters.ts, extensions/reef/protocol/guard.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.

@steipete
steipete merged commit b98b8e7 into openclaw:main Jul 17, 2026
84 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

@Monkey-wusky
Monkey-wusky deleted the fix/googlechat-cancel-error-response-body branch July 17, 2026 05:34
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 17, 2026
…ng (openclaw#109519)

* fix(googlechat): cancel non-OK cert fetch response body before throwing

When fetchChatCerts receives a non-OK response from the Google Chat
cert endpoint, it throws without cancelling the response body.
Cancel the body before throwing, matching the pattern established
in reef guard adapters (openclaw#109196) and fetchOpenRouterModels.

* test(googlechat): cover cert response cancellation

Co-authored-by: 毛宇豪0668001457 <[email protected]>

* test(googlechat): satisfy strict call-order types

Co-authored-by: 毛宇豪0668001457 <[email protected]>

---------

Co-authored-by: Peter Steinberger <[email protected]>
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…ng (openclaw#109519)

* fix(googlechat): cancel non-OK cert fetch response body before throwing

When fetchChatCerts receives a non-OK response from the Google Chat
cert endpoint, it throws without cancelling the response body.
Cancel the body before throwing, matching the pattern established
in reef guard adapters (openclaw#109196) and fetchOpenRouterModels.

* test(googlechat): cover cert response cancellation

Co-authored-by: 毛宇豪0668001457 <[email protected]>

* test(googlechat): satisfy strict call-order types

Co-authored-by: 毛宇豪0668001457 <[email protected]>

---------

Co-authored-by: Peter Steinberger <[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 P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XS 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