Repository navigation
fix(test): synchronize googlechat/feishu close assertions on events - #136768
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Check-in: fresh focused test-only fix for #126905 on current main (does not reopen #126911). Replaced wall-clock close waits with awaiting the existing close/cancel event promises in Local vitest: feishu media-chunk-idle 2/2, googlechat targets 42/42 via |
|
Codex review: needs real behavior proof before merge. Reviewed September 26, 2026, 9:45 PM ET / September 27, 2026, 01:45 UTC (Revision 5). ClawSweeper reviewWhat this changesChanges two Google Chat media-download tests to await connection-close and stream-cancellation events before checking cleanup. Merge readiness⛔ Blocked before merge - 2 items remain Current main still has both timing-dependent Google Chat assertions, and this focused patch addresses them. Feishu’s corresponding wait was merged separately. The remaining merge blocker is proof that this head succeeds when close delivery is delayed; its reported run covers ordinary timing. Priority: P3 Review scores
Verification
How this fits togetherThe Google Chat plugin downloads inbound media through a guarded request and enforces a byte limit before saving the attachment. These tests check that an oversized response stops the transfer and closes its transport. flowchart LR
A[Inbound media request] --> B[Google Chat downloader]
B --> C[Byte limit decision]
C --> D[Cancel response stream]
D --> E[Connection close event]
E --> F[Cleanup assertions]
Before merge
Agent review detailsSecurityNone. PR surfaceTests -2. Total -2 across 1 file. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep the event-based assertions and establish their delayed-close red/green behavior through the downloader and loopback transport before landing. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main can finish the 100 ms race before observing connection close. The linked earlier PR reports a delayed-close red/green run, but this review did not execute one. Is this the best way to solve the issue? Yes. Awaiting the events already observed by these tests is a narrow repair that preserves their cleanup assertions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 53af3ce10c37. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
Hi — just a friendly ping on this PR whenever you have a moment. Could someone with merge rights take a look when convenient? Happy to address any feedback. Thanks! |
Rebase onto current main: drop the Feishu hunk (main already has the socket-close wait from openclaw#153277) and keep the Google Chat timing fixes. - await responseClosedPromise instead of racing a 100ms timer - await stream cancel via canceledPromise instead of setTimeout(0)
efc08bf to
172d054
Compare
|
Rebased onto current main and dropped the Feishu file — that wait is already on main via #153277. This tip only touches Head: |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…nclaw#136768) Rebase onto current main: drop the Feishu hunk (main already has the socket-close wait from openclaw#153277) and keep the Google Chat timing fixes. - await responseClosedPromise instead of racing a 100ms timer - await stream cancel via canceledPromise instead of setTimeout(0)
Fixes #126905
What Problem This Solves
Google Chat media-download tests used fixed wall-clock waits (
Promise.racewith100ms, andsetTimeout(0)) to observe HTTP connection close and stream cancellation. Under a busy event loop the assertion can run before the close/cancel event is delivered even though cleanup still happens.Feishu had the same class of flake; that path is already event-driven on
mainvia #153277, so this PR no longer touches Feishu after rebase.Why This Change Was Made
Rebased onto current
main(172d054f5). Single-file, test-only change inextensions/googlechat/src/targets.test.ts:responseClosedPromise(loopback serverres.on("close")) instead of racing a 100ms timer after the size-limit rejection.canceledPromise(ReadableStreamcancel) instead ofsetTimeout(0)before asserting explicit byte-limit cancellation.If close/cancel never arrives, vitest still times out — same failure mode, without timing races.
User Impact
No user-facing runtime change. CI gets more deterministic Google Chat media cleanup assertions.
Evidence
Box vitest (Node 24,
node scripts/run-vitest.mjs):Delayed-close / cancel synchronization (what the two cases exercise):
Chunked loopback download — local
createServerregistersres.on("close")→responseClosedPromise. AfterdownloadGoogleChatMediarejects on the 20 MiB cap, the testawait responseClosedPromise(nosetTimeout). The passing run above shows the close event was observed before assertions (responseClosed === true,bytesSent < totalBytes).Explicit maxBytes stream —
ReadableStreamcancel()resolvescanceledPromise. After the expected rejection,await canceledPromisereplacessetTimeout(0); the run above completes withcanceled === truewithout an arbitrary delay.No live Google Chat or Feishu credentials; loopback HTTP only. No fabricated live-channel runs.