Skip to content

perf(test): speed up new-session model control observations - #127101

Merged
steipete merged 1 commit into
mainfrom
perf/new-session-model-control-polling
Aug 21, 2026
Merged

steipete merged 1 commit into
mainfrom
perf/new-session-model-control-polling

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

The new-session model-control test spends unnecessary wall-clock time waiting for Vitest's default 50 ms observation-polling interval after immediately resolved metadata and initial UI rendering.

Why This Change Was Made

Use the existing 1 ms waitForFast helper for 10 initial-observation waits only. Preserve all 40 request-order, shared-ownership, catalog-freshness, reconnect, agent/model-selection, and preference-restoration waits, along with every existing assertion, deferred barrier, test case, timeout, and production file.

User Impact

No user-facing or production behavior changes. Maintainers and CI get faster new-session model-control coverage without weakening its ownership, recovery, or persistence contracts.

Evidence

  • Same Blacksmith Testbox, one excluded warmup, eight retained interleaved samples per variant, one worker, separate filesystem-module caches, import diagnostics, and GNU /usr/bin/time -v.
  • Median wall: 3.995 s -> 3.565 s (-0.430 s, -10.8%). Median Vitest: 3.020 s -> 2.725 s. Median test body: 1.955 s -> 1.705 s (-12.8%).
  • Median imports: 380 ms -> 374 ms; peak RSS: 720,302 KiB -> 716,152 KiB; CPU user/system: 3.020/0.350 s -> 2.820/0.280 s. Every sample passed the same 37 tests.
  • Reversible production-owner fault proof: removing the CLI target capability filter correctly failed the history-only-target assertion; removing fresh-catalog auth gating correctly failed the pending-refresh auth assertion; both passed after restoring the exact production file.
  • Focused owner/sibling validation: 122 passing tests across 10 files, including metadata startup-retry/deadline, catalog targets, model selection, new-session ownership, preferences, and isolated draft persistence.
  • Real Chromium plus isolated mocked Gateway: 29 passing scenarios across four files, covering model-catalog retries, reconnect/request ordering, preference/model restoration, and durable draft handoff. No live Gateway was used.
  • Complete Blacksmith pnpm check:changed passed in 11m04s, including ratchets, dead-code scans, Control UI i18n, core-test typechecks, and changed-file lint with 0 warnings / 0 errors. Structured independent review passed clean; production delta +0/-0, test delta +11/-10.

@clawsweeper

clawsweeper Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added the app: web-ui App: web-ui label Aug 21, 2026
@steipete
steipete marked this pull request as ready for review August 21, 2026 08:12
@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Aug 21, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Landing proof for exact head d994f5d55e955ec75216944b521f948fd6011c6e:

  • One test-only file: production delta zero; 37 existing tests and every assertion preserved.
  • Classified all 50 waits: changed only ten incidental initial-observation waits and preserved 40 deliberate ordering, catalog freshness, agent/model selection, draft restoration, persistence, and deadline-sensitive waits.
  • Controlled Blacksmith Testbox benchmark: one excluded cold warmup, eight interleaved retained samples per variant, one worker, distinct caches, GNU time/import diagnostics. Median wall 3.995 s -> 3.565 s (-10.8%); median test body 1.955 s -> 1.705 s (-12.8%); import medians 380 ms -> 374 ms.
  • Focused new-session, draft, model, catalog, and metadata siblings: 122 passing tests across ten files.
  • Real Chromium with mocked Gateway: 29 passing scenarios across four catalog, reconnect, draft-handoff, and workspace-memory suites.
  • Two reversible production-owner faults were both caught by unchanged assertions: history-only providers becoming selectable and premature authentication blocking during cold catalog revalidation; original production blobs restored exactly.
  • Full remote pnpm check:changed passed; exact-head focused rerun passed all 37 tests; formatting, diff, test audit, production-zero audit, and independent structured review clean.
  • Exact-head hosted CI: https://github.com/openclaw/openclaw/actions/runs/32462093729

No production files, dependencies, snapshots, baselines, changelog, schemas, or protocol were changed.

@steipete
steipete merged commit 627f862 into main Aug 21, 2026
144 checks passed
@steipete
steipete deleted the perf/new-session-model-control-polling branch August 21, 2026 08:20
@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

Labels

app: web-ui App: web-ui maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant