Skip to content

fix: isolate async model resolution mock from sync mock in flaky test#93714

Merged
vincentkoc merged 1 commit into
openclaw:mainfrom
lsr911:fix/issue-92117-Flaky-failing-simple-comple
Jun 16, 2026
Merged

fix: isolate async model resolution mock from sync mock in flaky test#93714
vincentkoc merged 1 commit into
openclaw:mainfrom
lsr911:fix/issue-92117-Flaky-failing-simple-comple

Conversation

@lsr911

@lsr911 lsr911 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

The can preserve asynchronous provider model discovery test was flaky/failing on CI because resolveModelAsyncMock in beforeEach delegated to resolveModelMock. When useAsyncModelResolution=true, the test asserted resolveModelMock was not called, but the delegation in the mock implementation caused it to be called.

Fix

Use a standalone vi.fn() for the async resolver in this test instead of the hoisted mock that delegates to the sync mock. Also explicitly reset resolveModelMock before the assertion to guard against mock state leakage from prior tests.

Fixes #92117

The 'can preserve asynchronous provider model discovery' test was
flaky because resolveModelAsyncMock in beforeEach delegates to
resolveModelMock. When useAsyncModelResolution=true, the test
asserted resolveModelMock was not called, but the delegation
caused it to be called, failing CI on two lanes.

Fix: use a standalone vi.fn() for the async resolver in this
test, and explicitly reset resolveModelMock before the assertion
to guard against mock state leakage from prior tests.

Fixes openclaw#92117
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 16, 2026
@vincentkoc vincentkoc self-assigned this Jun 16, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Maintainer verification complete.

  • Focused proof: node scripts/run-vitest.mjs src/agents/simple-completion-runtime.test.ts (17 tests passed)
  • Fresh autoreview: clean; the test-only change correctly isolates the injected async resolver from the sync mock
  • Required CI checks are green; the contributor-only Real behavior proof gate is not applicable to this deterministic test-isolation fix

Landing via squash merge.

@vincentkoc
vincentkoc merged commit 617c9d4 into openclaw:main Jun 16, 2026
185 of 191 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 17, 2026
…claw#93714)

The 'can preserve asynchronous provider model discovery' test was
flaky because resolveModelAsyncMock in beforeEach delegates to
resolveModelMock. When useAsyncModelResolution=true, the test
asserted resolveModelMock was not called, but the delegation
caused it to be called, failing CI on two lanes.

Fix: use a standalone vi.fn() for the async resolver in this
test, and explicitly reset resolveModelMock before the assertion
to guard against mock state leakage from prior tests.

Fixes openclaw#92117

Co-authored-by: lsr911 <[email protected]>
crh-code pushed a commit to crh-code/openclaw that referenced this pull request Jun 18, 2026
…claw#93714)

The 'can preserve asynchronous provider model discovery' test was
flaky because resolveModelAsyncMock in beforeEach delegates to
resolveModelMock. When useAsyncModelResolution=true, the test
asserted resolveModelMock was not called, but the delegation
caused it to be called, failing CI on two lanes.

Fix: use a standalone vi.fn() for the async resolver in this
test, and explicitly reset resolveModelMock before the assertion
to guard against mock state leakage from prior tests.

Fixes openclaw#92117

Co-authored-by: lsr911 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky / failing: simple-completion-runtime > can preserve asynchronous provider model discovery (introduced 25ca39e876)

2 participants