Skip to content

perf(test): reduce LM Studio stream suite setup - #124136

Merged
steipete merged 1 commit into
mainfrom
perf/lmstudio-stream-test-setup
Aug 15, 2026
Merged

steipete merged 1 commit into
mainfrom
perf/lmstudio-stream-test-setup

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

The 26-test LM Studio stream suite rebuilt the Plugin SDK, LLM, provider, and stream module graph before every test. That made this focused suite unnecessarily slow and memory-heavy, with roughly 11 seconds of test-body time and about 1.5 GiB peak RSS in the controlled baseline.

Why This Change Was Made

The suite now installs exact mocks for the three seams consumed by the stream owner and imports the real stream module once. Each test receives a unique production cache namespace through its LM Studio base URL, preserving within-test preload deduplication, cooldown, retry, canonical-model-key, cancellation, compatibility, and payload behavior without adding a test-only production seam.

Real model-loading behavior remains owned by models.test.ts; provider-header and runtime API-key behavior remains owned by runtime.test.ts. This is an AI-assisted maintainer change that I reviewed and understand.

User Impact

There is no product runtime behavior change. Maintainers and CI get a materially lighter LM Studio stream test suite while retaining the same 26 tests and owner-boundary coverage.

Evidence

Controlled same-Testbox A/B, excluding one warmup per state: https://github.com/openclaw/openclaw/actions/runs/31876152650

Metric Before mean After mean Improvement
Wall 20.680s 17.935s -13.3%
Vitest 15.005s 11.035s -26.5%
Test body 11.325s 6.315s -44.2%
CPU user 23.600s 19.745s -16.3%
Peak RSS 1,570,314 KiB 891,888 KiB -43.2% (~662.5 MiB)

Behavior and isolation proof:

  • Replacing the unique per-test base URL with one constant production cache key made 5 of 26 cooldown/backoff tests fail from cross-test state leakage.
  • Mutating the preload handoff to use the wrong model key made 4 of 26 owner-boundary assertions fail.
  • Filtered late-test execution: 1 passed, 25 skipped.
  • Target stream suite: 26/26 passed.
  • LM Studio owner suite: 154/154 passed across 5 files.
  • Extension boundary tests: 28/28 passed across 2 files.
  • Targeted formatting and git diff --check: passed.
  • Rebased remote changed gate: all 18 extension-test steps passed on Testbox tbx_01m02c3dgm6hg08dm0rr55hzp9: https://github.com/openclaw/openclaw/actions/runs/31877142937
  • Fresh committed-branch autoreview against current origin/main: clean, no accepted/actionable findings.
  • Stable patch-id before and after rebase: 53ed70cc8b9b69d3eff77e549d291ccd0cbac26d.
  • LOC: tests +25/-32; production +0/-0.

No release, package publication, version bump, dependency change, schema/protocol change, baseline/snapshot/budget change, or CHANGELOG.md edit is included or requested.

@clawsweeper

clawsweeper Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review August 15, 2026 09:37
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for exact head 4f3d3ccaff7b35d0467d941716f91ffde3716c93:

Native review artifacts validate with recommendation=READY FOR /prepare-pr, issueValidation.status=valid, and zero findings. The latest ClawSweeper comment is still only the started placeholder, so there is no substantive review or Rank-up moves: list to apply; landing is not blocked on the publisher under repository policy.

@steipete
steipete merged commit 3d643f7 into main Aug 15, 2026
162 checks passed
@steipete
steipete deleted the perf/lmstudio-stream-test-setup branch August 15, 2026 09:52
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant