Repository navigation
test(google): make first-response deadline coverage deterministic - #150663
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. |
|
Codex review: needs maintainer review before merge. Reviewed September 17, 2026, 3:18 AM ET / 07:18 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR makes Google's pending-response recovery test deterministic by replacing its wall-clock safety abort with controlled advancement across the retry deadline. Merge readiness✅ Ready for maintainer review Keep open: this remains a useful, focused test repair that current main does not contain. No actionable correctness or security findings remain; the maintainer-authored PR is also protected from automated closure. Priority: P3 Review scores
Verification
How this fits togetherThe Google provider plugin converts agent requests into streaming Gemini calls and retries eligible requests that stall before their first response. This test exercises a stalled response callback through that transport and checks cancellation followed by successful recovery. flowchart TD
A[Agent request] --> B[Google streaming transport]
B --> C[First response callback]
C --> D{Deadline reached?}
D -->|No| E[Wait for response]
D -->|Yes| F[Cancel unread response]
F --> G[Retry and return recovered text]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests 0. Total 0 across 1 file. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep deadline recovery coverage in the existing transport test, with controlled time and independent caller-cancellation coverage. Do we have a high-confidence way to reproduce the issue? Yes, for the fixture race: source shows the parent safety timer starts before transport setup, and the captured body reports a controlled setup-delay reproduction. This read-only review did not execute tests or independently reproduce the spontaneous load-dependent failure. Is this the best way to solve the issue? Yes. Controlling time in the existing boundary test removes the competing safety abort while preserving recovery checks; the reported mutation failure supports its ability to detect a broken deadline path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 68b4251368c1. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
b12daa1 to
670ec18
Compare
|
Merged via squash.
|
…enclaw#150663) Fix flaky Google pending-response callback coverage when a loaded worker spends long enough in transport setup for the fixture's parent safety abort to fire first. Parent cancellation correctly suppresses deadline recovery, so that competing timer could make the test fail despite correct runtime behavior. Wait for callback entry and advance fake time across the existing first-response deadline. Preserve cancellation, retry, callback-count and recovered-content checks, and assert a successful stop. Production behavior, timeout settings and configuration are unchanged; the one existing test changes by +24/-24 lines. Related: openclaw#150523 Validation: exact-head CI run 35193375763 passed; the validated test bytes are unchanged. The PR records 20/20 Google deadline passes, a controlled setup-delay reproduction and a deadline mutation failure. Codex autoreview and the exact-head ClawSweeper review found no actionable issues.
Related: #150523
What Problem This Solves
Fixes a flaky Google transport regression test whose real-time safety abort could preempt Gemini first-response deadline recovery on a loaded worker.
User Impact
Developers get deterministic coverage of pending response-callback recovery. Runtime behavior, timeout settings, and configuration are unchanged.
Why This Change Was Made
The fixture started a real five-second parent abort before transport setup, while the Google-owned first-response deadline starts later, before fetch. If the safety abort fires, the transport correctly suppresses retry because the parent is canceled.
The test now waits until its first
onResponsecallback is pending, advances fake time to 9 ms and then the existing 10 ms deadline, and checks cancellation and recovery. It retains the recovered-content, two-fetch, two-callback, and single-cancellation assertions, adds a successful stop assertion, and uses the existing teardown to restore real timers. Production LOC: 0 changed. Test LOC: +24 / −24, in one existing test.Evidence
Pinned baseline:
90b421ae252ceaea5bf5a9f106eab51bf384431b. Validated head:b12daa16187c09b652a5b92e8f89b808595ec9e9(committed test bytes match all 20 stress runs).The reported spontaneous Google failure did not recur in these baseline runs. A controlled fake-clock probe advancing five seconds during
onPayloadsetup made the original fixture abort with zero response callbacks and fail with:The clock-driven replacement passed with the same setup-delay probe. Temporarily removing the attempt deadline signal from response notification made the revised test fail at the 10 ms boundary:
All probes were removed and production source was restored byte-for-byte. All 20 final stress runs used identical candidate bytes. Each full shard had 71 files / 1,296 tests, two workers, and file isolation. The 1,297-test count in the related Qwen validation includes the additional test from #150523. That PR has since merged; the pinned baseline here still contains its original timing assertion (
119995–119999versus120000).node scripts/check-changed.mjs: every step passed except extension lint's documented nested-checkout declaration-input guard. The campaign-prescribed substitute was verified on the changed file:Hosted extension lint remains the authoritative full boundary check.
git diff --checkpassed. Codex autoreview was scoped-clean at P1 before commit and for the committed branch (--mode branch --base origin/main --max-priority P1), with no accepted/actionable findings.