Repository navigation
Conversation
…cache
`extensions/googlechat/src/setup.test.ts` waits up to 1s (vi.waitFor default)
for the mocked monitor to start. `startAccount` loads `./channel.runtime.js`
lazily, and that mock imports the real monitor module. On a cold transform
cache (every fresh CI shard) that import alone takes longer than 1s, so
"keeps startAccount pending until abort" sees 0 calls and the late call
leaks into the next test ("called once, but got 2 times").
Load the mocked channel runtime in beforeAll so the timed waits only cover
the lifecycle behavior under test.
|
🦞👀 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 26, 2026, 5:33 PM ET / 21:33 UTC. ClawSweeper reviewWhat this changesPreloads Google Chat’s mocked runtime before setup tests begin so cold module transformation does not consume the lifecycle assertion timeout. Merge readiness✅ Ready for maintainer review The fix remains useful: current main still has the timed lifecycle tests without a cold-import preload, and the PR reports passing cold runs after the change. The linked bug should remain open while this PR is reviewed. Priority: P2 Review scores
Verification
How this fits togetherGoogle Chat’s Gateway account startup loads its channel runtime on demand, then starts a webhook monitor and publishes lifecycle status. The setup tests mock that runtime and check the resulting monitor calls and status. flowchart LR
A[Setup test] --> B[Preload mocked runtime]
B --> C[Cold module transform]
C --> D[Start Gateway account]
D --> E[Monitor call]
E --> F[Lifecycle assertions]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +6. Total +6 across 1 file. View PR surface stats
Review metrics
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 runtime preload in the test fixture so cold CI transforms finish before lifecycle timing begins, while preserving the existing assertions. Do we have a high-confidence way to reproduce the issue? Yes. The linked report gives a cold-cache Vitest command and records repeat failures on the pre-fix main revision; this read-only review did not rerun it. Is this the best way to solve the issue? Yes. Preloading the exact lazily imported mock removes transform time from the existing wait without widening the timeout or weakening the assertions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 841f6f78e5f6. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
The setup mock imports the real monitor lazily. Cold transforms exceed the one-second lifecycle assertion wait, then the late monitor call contaminates the next test. Load the mock in beforeAll; retain the real webhook resolver, all lifecycle assertions, and existing deadlines. No runtime behavior changes. Adapts the fix proposed in #159189. Main reproduced two failures both alone and in the original 109-file messaging CI shard. Validation: 20 cold-cache standalone runs (30 tests each), three original-shard runs (1,179 tests each), check:changed with extension test types and lint, and Codex review through P2. Standalone cold runs took 19-72 seconds including compiler preparation. Co-authored-by: Gabriel Bogdanovsky <[email protected]>
|
Thanks @TeaCup404! Your fix landed on Closing this one as superseded by that commit. Much appreciated. |
The setup mock imports the real monitor lazily. Cold transforms exceed the one-second lifecycle assertion wait, then the late monitor call contaminates the next test. Load the mock in beforeAll; retain the real webhook resolver, all lifecycle assertions, and existing deadlines. No runtime behavior changes. Adapts the fix proposed in openclaw#159189. Main reproduced two failures both alone and in the original 109-file messaging CI shard. Validation: 20 cold-cache standalone runs (30 tests each), three original-shard runs (1,179 tests each), check:changed with extension test types and lint, and Codex review through P2. Standalone cold runs took 19-72 seconds including compiler preparation. Co-authored-by: Gabriel Bogdanovsky <[email protected]>
Closes #159188
What Problem This Solves
Fixes:
extensions/googlechat/src/setup.test.tsfails whenever it runs with a cold Vitest transform cache, which turns thechanged-extensionsmessaging CI shard red for unrelated PRs (for example #158895).User Impact
User impact: no product change. Contributors whose PRs pull in that shard no longer get false
openclaw/ci-gatefailures from this test.Why This Change Was Made
startAccountloads./channel.runtime.jslazily, and the test's mock of that module imports the real monitor module. On a cold cache, that import takes more than the 1svi.waitForbudget, so the first lifecycle test sees 0 calls and the late call leaks into the next test. The test now imports the mocked runtime inbeforeAll, so the timed waits cover only the lifecycle behavior. Assertions and timeouts are unchanged.Evidence
Local, Node 24.21.0,
OPENCLAW_VITEST_MAX_WORKERS=3, with all Vitest/Vite caches (.cache/vitest,.artifacts/vitest-worker-cache,node_modules/.vite*) deleted before every run:main@a1019cb2 failed | 28 passed (30)both times, the same two tests as CI30 passed (30)every time (~15 s)The full messaging shard folders run cold with this change (
extensions/googlechat/src extensions/nextcloud-talk/src extensions/tlon/src, 3 workers) giveTest Files 90 passed (90)andTests 766 passed (766).oxfmt --checkis clean.CI failures this addresses: https://github.com/openclaw/openclaw/actions/runs/36269525064/job/108481449405 and https://github.com/openclaw/openclaw/actions/runs/36271785340/job/108487654326.
Test cost: one extra
import()of an already-mocked module inbeforeAll, which the first lifecycle test paid anyway.Prepared with an AI coding agent.