Skip to content

test(agents-core): stabilize leak detection harness#1169

Draft
wsk-builds wants to merge 1 commit intoopenai:mainfrom
wsk-builds:test/stabilize-coverage-leak-detection
Draft

test(agents-core): stabilize leak detection harness#1169
wsk-builds wants to merge 1 commit intoopenai:mainfrom
wsk-builds:test/stabilize-coverage-leak-detection

Conversation

@wsk-builds
Copy link
Copy Markdown
Contributor

This pull request fixes the flaky leak-detection harness used by packages/agents-core/test/result.test.ts.

The previous regression checks spawned separate Node processes and asserted on stdout, which made the harness brittle under coverage and worker execution. This change keeps the manual scripts runnable from the CLI, but refactors them into importable helpers with structured results so the Vitest suite can assert directly.

It also adds a shared gcRuntime test helper that lazily exposes gc inside the worker when Node was not launched with --expose-gc, and adds the required patch changeset for @openai/agents-core.

Validation notes:

  • Passed: pnpm vitest run packages/agents-core/test/result.test.ts --reporter=dot
  • Passed: pnpm vitest run packages/agents-core/test/result.test.ts --coverage --reporter=dot
  • Passed: node --expose-gc --import tsx packages/agents-core/test/manual/streamedRunResultLeakCheck.ts
  • Passed: node --expose-gc --import tsx packages/agents-core/test/manual/streamedRunResultLeakStress.ts with the reduced stress env from the test
  • Passed: pnpm -F @openai/agents-core build-check
  • Passed: pnpm -F @openai/agents-core dist:check
  • Passed: pnpm lint
  • Full bash .agents/skills/code-change-verification/scripts/run.sh still stops on packages/agents-core/test/logger.test.ts, which times out during the full pnpm test run under load. That test was not changed in this branch.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 15, 2026

🦋 Changeset detected

Latest commit: 27750bd

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-extensions Patch
@openai/agents-openai Patch
@openai/agents-realtime 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

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.

2 participants