Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

test(ci): shard MCP tests with the native Node runner (#1909)

Michael D'Angelo6696705319ef
diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml
index d9b2fc727..3b6907883 100644
--- a/.github/workflows/node-ci.yml
+++ b/.github/workflows/node-ci.yml
@@ -239,10 +239,14 @@ jobs:
mcp:
if: needs.classify-changes.outputs.source-required == 'true'
- name: MCP app tests
+ name: MCP app tests (${{ matrix.shard }}/${{ strategy.job-total }})
needs: [classify-changes, package]
runs-on: ubuntu-latest
timeout-minutes: 20
+ strategy:
+ fail-fast: false
+ matrix:
+ shard: [1, 2, 3]
steps:
- *checkout-repository
- &set-up-mcp-tools
@@ -260,13 +264,18 @@ jobs:
- name: Restore bundled plugin
run: tar -xzf dist/*.tgz --strip-components=1 -C sdk/typescript package/_bundled_plugin
- name: Test MCP app
- run: pnpm --dir plugins/codex-security/mcp-app run test:mcp
+ working-directory: plugins/codex-security/mcp-app
+ # Keep Node options before the glob; trailing shard flags run every file.
+ run: >-
+ node --experimental-strip-types --test --test-concurrency=2
+ --test-shard=${{ matrix.shard }}/${{ strategy.job-total }}
+ --test-reporter=./scripts/test_reporter.mts "tests/test_*.ts"
- name: Upload MCP test reports
if: always()
continue-on-error: true
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
- name: mcp-test-reports
+ name: mcp-test-reports-${{ matrix.shard }}
overwrite: true
path: plugins/codex-security/mcp-app/reports/junit.xml
if-no-files-found: warn
diff --git a/sdk/typescript/TESTING.md b/sdk/typescript/TESTING.md
index 0a50f9c03..491f7811b 100644
--- a/sdk/typescript/TESTING.md
+++ b/sdk/typescript/TESTING.md
@@ -151,7 +151,9 @@ Source qualification runs the full Bun suite once per OS under Node 22: six
file shards on Linux and macOS, and fourteen on Windows. GitHub runs the shards
as separate jobs; each job uses Bun's default serial runner. The other selected
Node versions run the installed-package checks instead of repeating the same
-Bun suite. MCP and Python tests run in separate required jobs. Python uses four
+Bun suite. MCP tests run in three required jobs using Node's native file sharding,
+with two isolated test file processes per job. Local and release `test:mcp`
+commands still run the full suite. Python tests run separately and use four
isolated pytest-xdist workers with work stealing; worker crashes fail the run
without automatic restarts.