Skip to content

fix(test): stop Google batch timeout test leaking requests - #116161

Merged
vincentkoc merged 1 commit into
mainfrom
fix/google-embedding-batch-test-isolation-20260730
Jul 30, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/google-embedding-batch-test-isolation-20260730

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

Resolves a problem where the Google embedding-batch timeout test failed after HTTP deadline timers were added, then left its batch promise running after mocks were restored. The orphaned request reached the real Google API with the test key and produced an unhandled rejection.

Why This Change Was Made

The Google-owned test now verifies the owner behavior at the absolute batch deadline instead of duplicating the shared poll-helper timer implementation. It observes the batch promise immediately and restores real timers after every test.

User Impact

No runtime behavior changes. The provider test suite no longer leaks a real network request or reports a false timeout failure.

Evidence

  • Reproduced on current main: 1 failed test plus an unhandled ProviderHttpError from the real Google API.
  • node scripts/run-vitest.mjs extensions/google/embedding-batch.test.ts passed: 1 file, 20 tests.
  • Repeated the focused file three times; all 60 test executions passed.
  • ./node_modules/.bin/oxfmt --check extensions/google/embedding-batch.test.ts passed.
  • git diff --check origin/main...HEAD passed.
  • Autoreview clean with no accepted/actionable findings (0.96 confidence).

AI-assisted: yes. I understand and verified the change.

@vincentkoc vincentkoc self-assigned this Jul 30, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Jul 30, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review July 30, 2026 01:33
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 30, 2026
@clawsweeper

clawsweeper Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 29, 2026, 10:09 PM ET / July 30, 2026, 02:09 UTC.

ClawSweeper review

What this changes

The PR changes the Google embedding-batch timeout test to capture its timeout rejection before cleanup, restore real timers after every test, and verify that no status-poll request starts after the absolute deadline.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

This is a narrow, test-only repair that appears to correctly prevent the Google batch timeout test from leaving a promise running after mock cleanup. It has no identified patch defect, but the maintainer label and MEMBER authorship require an explicit maintainer merge decision; the branch is also behind current main, so refresh review at the merge head.

Priority: P3
Reviewed head: 959bf7bba9258cb3bbbe770b68c808198387de80
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, internally coherent test repair with supplied repeat focused-test evidence and no actionable correctness or security finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored PR changes only a focused test, so the external-contributor real-behavior-proof gate does not apply; its body nevertheless supplies focused after-fix test evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored PR changes only a focused test, so the external-contributor real-behavior-proof gate does not apply; its body nevertheless supplies focused after-fix test evidence.
Evidence reviewed 4 items Changed cleanup boundary: The branch changes the shared test cleanup to restore real timers before restoring mocks, preventing fake-timer state from leaking into subsequent tests.
Changed deadline assertion: The revised test advances the clock to the 1,000 ms batch deadline, captures the batch promise rejection immediately, and asserts that no batch-status fetch was issued.
Focused validation supplied: The PR body reports a current-main reproduction of the orphaned request and three passing focused runs of the Google embedding-batch test file after the repair.
Findings None None.
Security None None.

How this fits together

The Google extension batches embedding requests and polls Google batch status until completion or a deadline. This test uses mocked network calls and fake time to verify that the batch owner terminates at its own deadline without allowing cleanup to expose a still-running request to the real network.

flowchart LR
  A[Embedding batch test] --> B[Fake clock and mocked Google API]
  B --> C[Google batch runner]
  C --> D{Batch deadline reached?}
  D -->|Yes| E[Observed timeout rejection]
  E --> F[No status poll request]
  F --> G[Restore timers and mocks]
Loading

Decision needed

Question Recommendation
Should a maintainer approve merging this clean, test-only Google extension repair after its current-main refresh? Approve after refresh: Rebase or refresh against current main, confirm the focused Google test still passes, and merge the narrow isolation repair.

Why: The PR is authored by a repository MEMBER and carries the protected maintainer label, so this workflow must not make an automated landing or close decision.

Before merge

  • Resolve merge risk (P1) - The branch is behind current main; although GitHub reports it cleanly mergeable, the final merge decision should review the rebased or merge-head version of this timing-sensitive test.
Agent review details

Security

None.

PR surface

Tests -6. Total -6 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 7 13 -6
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 7 13 -6

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the owner-level timeout assertion and explicit timer cleanup, then merge only after a maintainer confirms the refreshed branch still validates against current main.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the owner-level timeout assertion and explicit timer cleanup, then merge only after a maintainer confirms the refreshed branch still validates against current main.

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

Yes, at source level: the supplied current-main path uses fake timers and mocked fetches, then allows a pending batch promise to outlive mock cleanup; the PR body reports the resulting real-request rejection and focused after-fix runs.

Is this the best way to solve the issue?

Yes. Observing the owner promise before cleanup and restoring timers centrally is narrower and more maintainable than reproducing the shared polling helper’s timer internals in this Google-owned test.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is a small test-isolation repair with no runtime, configuration, storage, or user-facing behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This MEMBER-authored PR changes only a focused test, so the external-contributor real-behavior-proof gate does not apply; its body nevertheless supplies focused after-fix test evidence.

Evidence

What I checked:

  • Changed cleanup boundary: The branch changes the shared test cleanup to restore real timers before restoring mocks, preventing fake-timer state from leaking into subsequent tests. (extensions/google/embedding-batch.test.ts:27, 959bf7bba925)
  • Changed deadline assertion: The revised test advances the clock to the 1,000 ms batch deadline, captures the batch promise rejection immediately, and asserts that no batch-status fetch was issued. (extensions/google/embedding-batch.test.ts:209, 959bf7bba925)
  • Focused validation supplied: The PR body reports a current-main reproduction of the orphaned request and three passing focused runs of the Google embedding-batch test file after the repair. (extensions/google/embedding-batch.test.ts:209, 959bf7bba925)
  • Current PR state: GitHub reports the branch as cleanly mergeable but behind its base, with the focused real-behavior-proof check and repository checks successful or intentionally skipped for the XS test-only scope. (959bf7bba925)

Likely related people:

  • vincentkoc: Authored, self-assigned, and most recently updated the active Google embedding-batch test repair; no stronger current-main ownership trail was available in the supplied review context. (role: current Google test repair contributor; confidence: low; commits: 959bf7bba925; files: extensions/google/embedding-batch.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Refresh the branch against current main and retain the focused validation result for the maintainer merge decision.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-07-30T01:37:16.338Z sha 11ed36b3cb35b22046596b2c14b0629093e8694d :: needs maintainer review before merge. :: none
  • reviewed 2026-07-30T01:43:34.041Z sha 711313015b4f6edd0d98ea7f60ee74e086ecfe90 :: needs maintainer review before merge. :: none

@vincentkoc
vincentkoc force-pushed the fix/google-embedding-batch-test-isolation-20260730 branch from 11ed36b to 7113130 Compare July 30, 2026 01:39
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 30, 2026
@vincentkoc
vincentkoc force-pushed the fix/google-embedding-batch-test-isolation-20260730 branch from 7113130 to 959bf7b Compare July 30, 2026 02:04
@vincentkoc

Copy link
Copy Markdown
Member Author

Rank-up move reviewed: I am not rebasing again because current main drift is limited to the cron service and cron protocol files from #115779; it does not overlap this Google test-only patch or merge-critical infrastructure. The exact PR head has a green openclaw/ci-gate, and scripts/pr merge-run will re-verify drift before landing.

@vincentkoc
vincentkoc merged commit 0370fce into main Jul 30, 2026
86 checks passed
@vincentkoc
vincentkoc deleted the fix/google-embedding-batch-test-isolation-20260730 branch July 30, 2026 02:11
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit to zhangguiping-xydt/openclaw that referenced this pull request Jul 30, 2026
* origin/main:
  fix(macos): stop canceled voice wake timers (openclaw#116189)
  fix(macos): coalesce location permission requests (openclaw#116183)
  fix(macos): guard remote tunnel restart ownership (openclaw#116172)
  fix(agents): throw CompactionError when summarization fails (openclaw#115500)
  fix(test): isolate ACP startup output stream (openclaw#116076)
  fix(agents): deny all tools when scheduled authority names a removed account (openclaw#115932)
  fix(test): stop collecting Vydra test helpers (openclaw#116139)
  fix(discord): preserve webhook deadline errors (openclaw#116155)
  fix(test): isolate Google embedding batch timeout (openclaw#116161)
  fix(cron): stop replaying old schedule slots after a cron job is edited (openclaw#115779)
  fix(plugins): report request timeouts for stalled response bodies (openclaw#116166)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: google maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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.

1 participant