Repository navigation
fix(googlechat): surface reply send failures instead of silently dropping chunks - #110147
wangmiao0668000666 wants to merge 3 commits into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 17, 2026, 6:17 PM ET / 22:17 UTC. Summary PR surface: Source -4, Tests +286. Total +282 across 3 files. Reproducibility: yes. in source: the supplied loopback HTTP scenario deterministically makes a later Google Chat create request return 500 and traces the resulting dispatcher outcome. This review did not independently execute that scenario. Review metrics: none identified. Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the plugin-local propagation fix after the exact rebased merge result passes required checks, preserving the recoverable typing-placeholder resend path and its focused regression coverage. Do we have a high-confidence way to reproduce the issue? Yes in source: the supplied loopback HTTP scenario deterministically makes a later Google Chat create request return 500 and traces the resulting dispatcher outcome. This review did not independently execute that scenario. Is this the best way to solve the issue? Yes. Restricting recovery to the stale typing-placeholder update while allowing the final new-message send to reject is the narrowest way to honor the existing dispatcher delivery contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5e4107400963. Label changesLabel justifications:
Evidence reviewedPR surface: Source -4, Tests +286. Total +282 across 3 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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
Review history (3 earlier review cycles)
|
40303f5 to
a1cb28d
Compare
|
@clawsweeper re-review Addressing the [P1] "needs real behavior proof" finding on commit Integration-backed failure-path proof, committed as
Observed dispatcher outcomes (transcripts in the updated PR body Evidence section):
Second covered scenario: typing-placeholder Verification on
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Fixed the Validation on the new head (Node 24.15.0): |
Drive the production inbound stack end to end: real webhook handler, real verifyGoogleChatRequest, real cert fetch through fetchWithSsrFGuard, and google-auth-library RS256 verification of an in-process signed JWT, with only the Google cert host rerouted to a loopback impersonator. Asserts durable admission after real verification, exactly-once replay across a simulated restart, and 401 + no journal for a forged signature. Same proof standard as the accepted openclaw#110147 reply-delivery proof.
|
@clawsweeper re-review |
c23d3a4 to
489f39a
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
1 similar comment
|
@clawsweeper re-review |
|
Thank you, @wangmiao0668000666! Your Google Chat delivery fix has been merged via #115638, which preserves both of your original author-attributed commits and lands the same three Google Chat files on current main. We also added an independently verified regression fix so a failing outbound-status callback cannot resend an already delivered message. The real OAuth and Google Chat HTTP failure-and-recovery integration suite passed all 28 tests, and the canonical PR passed all hosted merge gates. Closing this original now that your credited fix is safely merged in 26aa0f5. Thank you for the contribution! |
|
Thank you for taking care of the merge, @steipete! Glad to see the fix landed with the additional regression guard. Appreciate you preserving the original commits. |
What Problem This Solves
deliverGoogleChatReply(extensions/googlechat/src/monitor-reply-delivery.ts:79-109 onmain) wrapped every chunk send in a try/catch that only logged the error and kept looping. Two silent-loss paths resulted:sendGoogleChatMessagefor any non-first chunk was logged and the chunk was dropped; the loop continued and the function resolved normally.The core reply dispatcher contract treats a rejected
deliveras a failed delivery and a resolved one as visible delivery:src/auto-reply/reply/reply-dispatcher.ts:476-483awaitsoptions.deliver(...)and only routes toonError/failed-deliverin.catch. Resolving after a swallowed send error therefore reported the turn as delivered while the user saw nothing (or only part of the reply).Why This Change Was Made
Restructure the chunk loop so the typing-update fallback stays, but any final send failure rejects out of
deliverGoogleChatReply, matching the dispatcher contract. The typing-update catch is kept because a stale typing placeholder is recoverable — the same chunk is immediately resent as a new message, and only that resend failing is a real delivery failure. This mirrors the LINE sibling, which documents that a lost bubble "must surface as a partial delivery, not silent success" (extensions/line/src/auto-reply-delivery.ts:217-219), and the same-channel precedent #96646 ("throw on non-ok instead of parsing error body as success").Fix classification: channel delivery error-propagation fix, additive behavior change only on the failure path; no config, SDK, or core changes.
User Impact
onErrorpath instead of being counted as visible deliveries, so dropped or partially delivered replies are no longer reported as successfully sent.Evidence
Integration-backed failure-path proof (real HTTP stack, loopback stub)
New committed regression test
extensions/googlechat/src/monitor.reply-delivery-failure.test.tsdrives the production stack end to end against a local HTTP impersonator of the Google Chat API:deliverGoogleChatReply→sendGoogleChatMessage→withGoogleChatResponse→fetchWithSsrFGuard→ realgoogle-auth-libraryJWT signing and token exchange. Only globalfetchis stubbed (reroutingchat.googleapis.com/oauth2.googleapis.comto127.0.0.1); the service-account key is a throwaway RSA key generated in-process, the stub issues the token, and the stub answers the secondspaces.messagescreate with a real HTTP 500 error envelope. The deliver/onError wiring mirrorsextensions/googlechat/src/monitor.ts:408-429, and the outcome labels follow the dispatcher contract insrc/auto-reply/reply/reply-dispatcher.ts:476-483. No real credentials, endpoints, or user data anywhere.Standalone transcript of the same flow (three-chunk reply, second create → 500), after the fix:
Same stub, same input, pre-fix
monitor-reply-delivery.tsfromorigin/main(reverse control): the 500 is logged and swallowed, the third chunk is still sent, and the dispatcher records the reply as delivered withonErrornever firing:Second after-fix scenario (typing placeholder already deleted upstream:
PATCH .../messages/typing→ 404, resend create → 500): the recoverable placeholder failure is logged, the resend failure rejects and reachesonError:origin/mainsource)POST .../messages([200,500,200])POST .../messages([200,500]), third chunk never attempteddeliverresultGoogle Chat API 500: {...}delivered,onErrornever firesfailed-deliver,onErrorfires once with the API errorBefore vs after (same regression tests, same mocks)
origin/mainContract chain (source verified on
main)extensions/googlechat/src/monitor.tsdeliver: async (payload) => { await deliverGoogleChatReply(...) }extensions/googlechat/src/monitor.ts[accountId] Google Chat <kind> reply failed: <err>extensions/googlechat/src/monitor-reply-delivery.tssrc/auto-reply/reply/reply-dispatcher.tsawait options.deliver(...); only.catchroutes toonError/failed-deliverextensions/line/src/auto-reply-delivery.tsControl-red (reverse verification)
Reverting only
monitor-reply-delivery.tstoorigin/mainwhile keeping the new tests:The mock-level suite shows the same inversion (
2 failed | 4 passedon pre-fix source). With the fix restored, both suites are green.Test suite
Full extension suite:
node scripts/run-vitest.mjs extensions/googlechat→ 211 passed / 1 failed (212 total); the single failure (setup.test.ts:236, service-account setup-wizard flow) also fails on a cleanorigin/maincheckout without this change (pre-existing, unrelated — same failure observed in the previous proof round before this PR touched anything).What was not tested
Google Chat API 500: ...message.tsgolanes left to CI.Impact-surface review
extensions/googlechat/src/monitor-reply-delivery.tsextensions/googlechat/src/monitor.reply-delivery.test.tsextensions/googlechat/src/monitor.reply-delivery-failure.test.tsLint / typecheck / format
Base: 76e97dd (
origin/main). Head: a1cb28d8b3253761dd48e36bc51f426cd204787c.Maintainer edits
Allow edits from maintainers is enabled on this PR.
Maintainer options
origin/main(76e97dd) during this proof round.monitor-reply-delivery.tsplus its colocated tests; the typing-fallback success path is byte-for-byte behavior-preserved.