Skip to content

perf: speed up tracing and realtime unit tests#1027

Merged
seratch merged 2 commits intomainfrom
perf/faster-unit-test-runs
Mar 1, 2026
Merged

perf: speed up tracing and realtime unit tests#1027
seratch merged 2 commits intomainfrom
perf/faster-unit-test-runs

Conversation

@seratch
Copy link
Copy Markdown
Member

@seratch seratch commented Mar 1, 2026

This pull request improves unit test execution time. It updates the Vitest worker pool to use threads, removes real-time waiting from the slowest tracing and realtime session tests, and adds a patch changeset for @openai/agents-core and @openai/agents-realtime.

The main goal is to preserve coverage while reducing wasted wall-clock time in the existing unit suite. Local same-machine benchmarking showed pnpm test improving from about 6.6s average before the change to about 5.7s after it, with warm runs improving from about 5.0s to about 3.8s, roughly a 15 to 20 percent reduction overall.

The test changes are focused and incremental:

  • vitest.config.ts switches the suite to the threads pool.
  • packages/agents-core/test/tracing.test.ts replaces a real shutdown wait with fake timers.
  • packages/agents-realtime/test/realtimeSession.test.ts and packages/agents-realtime/test/stubs.ts replace polling-heavy waits with direct event and promise synchronization and make timeout tests deterministic.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 1, 2026

🦋 Changeset detected

Latest commit: fa3e29f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@openai/agents-core Patch
@openai/agents-realtime Patch
@openai/agents-extensions Patch
@openai/agents-openai Patch
@openai/agents Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added this to the 0.5.x milestone Mar 1, 2026
@github-actions github-actions bot added documentation Improvements or additions to documentation package:agents-core package:agents-realtime project and removed documentation Improvements or additions to documentation labels Mar 1, 2026
@seratch seratch merged commit b9c0378 into main Mar 1, 2026
6 checks passed
@seratch seratch deleted the perf/faster-unit-test-runs branch March 1, 2026 03:40
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