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

ci: reuse packaged native fixtures and avoid unnecessary rebuilds (#1925)

Michael D'Angelo3bc25dd6a2f4
diff --git a/.github/workflows/native-artifacts.yml b/.github/workflows/native-artifacts.yml
index 5d2f39f16..f7d6cb5f9 100644
--- a/.github/workflows/native-artifacts.yml
+++ b/.github/workflows/native-artifacts.yml
@@ -35,9 +35,10 @@ jobs:
set -euo pipefail
# Include filenames and modes, not only file contents. Windows proofs
# bundle MCP helpers, including their schema and workbench dependencies.
- source_hash="$(git ls-tree -r -z HEAD -- \
+ empty_tree="$(git hash-object -t tree --stdin </dev/null)"
+ source_hash="$(git diff-tree -r -z --no-abbrev "$empty_tree" HEAD -- \
.gitattributes .cargo .npmrc .pnpmfile.cjs package.json pnpm-workspace.yaml \
- .github/actions/setup-tools .github/scripts \
+ .github/actions/setup-tools .github/scripts ':(exclude).github/scripts/invoice-desk-*.mjs' \
.github/workflows/native-artifacts.yml \
.github/workflows/native-unix.yml \
.github/workflows/native-windows.yml \
@@ -47,6 +48,7 @@ jobs:
sdk/typescript/pnpm-workspace.yaml \
sdk/typescript/tsconfig.json sdk/typescript/tsconfig.ci.json \
plugins/codex-security/native plugins/codex-security/mcp-app \
+ ':(exclude)plugins/codex-security/mcp-app/tests' \
plugins/codex-security/schemas plugins/codex-security/scripts \
plugins/codex-security/shared | git hash-object --stdin)"
# Hosted runner images can change without a source change.
diff --git a/.github/workflows/native-unix.yml b/.github/workflows/native-unix.yml
index fd2a93a33..3ef24f5ab 100644
--- a/.github/workflows/native-unix.yml
+++ b/.github/workflows/native-unix.yml
@@ -74,6 +74,13 @@ jobs:
- name: Prepare shared native notices
if: matrix.platform == 'linux' && matrix.arch == 'x64'
run: node notices.mjs
+ - name: Pull pinned glibc image
+ if: matrix.platform == 'linux'
+ run: |
+ if ! docker pull "$NATIVE_IMAGE"; then
+ sleep 5
+ docker pull "$NATIVE_IMAGE"
+ fi
- name: Build and verify Linux on glibc 2.28 with Node.js 22
if: matrix.platform == 'linux'
run: |
@@ -81,7 +88,7 @@ jobs:
printf '#!/bin/sh\nexit 99\n' > "$RUNNER_TEMP/native-no-python/python"
cp "$RUNNER_TEMP/native-no-python/python" "$RUNNER_TEMP/native-no-python/python3"
chmod +x "$RUNNER_TEMP/native-no-python/"*
- docker run --rm \
+ docker run --pull=never --rm \
--volume "$PWD:/source" \
--volume "$RUNNER_TEMP/native-cargo:/cargo" \
--volume "${CARGO_HOME:-$HOME/.cargo}/registry:/cargo/registry:ro" \
@@ -110,7 +117,7 @@ jobs:
- name: Verify the same Linux artifact with Node.js 20
if: matrix.platform == 'linux'
run: |
- docker run --rm \
+ docker run --pull=never --rm \
--volume "$PWD:/source:ro" \
--volume "$(dirname "$(dirname "$(command -v node)")"):/node:ro" \
--workdir /source "$NATIVE_IMAGE" /bin/bash -euc '
diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml
index 006468079..e5a5ef21f 100644
--- a/.github/workflows/node-ci.yml
+++ b/.github/workflows/node-ci.yml
@@ -126,8 +126,7 @@ jobs:
persist-credentials: false
- name: Check plugin source boundary
run: node sdk/typescript/scripts/check-plugin-source.mjs
- - &download-native
- name: Prepare native runtime
+ - name: Prepare native runtime
uses: ./.github/actions/download-native
- *set-up-typescript-tools
- *install-dependencies
@@ -159,7 +158,6 @@ jobs:
shard: [1, 2, 3, 4, 5, 6]
steps:
- *checkout-repository
- - *download-native
- *set-up-typescript-tools
- &set-up-bun
name: Set up Bun
@@ -173,8 +171,12 @@ jobs:
with:
name: package-${{ github.sha }}
path: dist
- - name: Restore bundled plugin
- run: tar -xzf dist/*.tgz --strip-components=1 -C sdk/typescript package/_bundled_plugin
+ - &restore-sdk-test-plugin
+ name: Restore bundled plugin
+ shell: bash
+ run: |
+ tar -xzf dist/*.tgz --strip-components=1 -C sdk/typescript package/_bundled_plugin
+ cp -R sdk/typescript/_bundled_plugin/mcp/native/. plugins/codex-security/native/prebuilt
- name: Install ripgrep
if: matrix.os == 'ubuntu-latest'
run: |
@@ -512,14 +514,11 @@ jobs:
steps:
- *checkout-repository
- *set-up-python
- - *download-native
- *set-up-typescript-tools
- *set-up-bun
- *install-dependencies
- *download-package-for-this-commit
- - name: Restore bundled plugin
- shell: bash
- run: tar -xzf dist/*.tgz --strip-components=1 -C sdk/typescript package/_bundled_plugin
+ - *restore-sdk-test-plugin
- name: Prepare private Windows test root
id: windows-temp
shell: pwsh
diff --git a/sdk/typescript/tests-ts/native-artifact-cache.test.ts b/sdk/typescript/tests-ts/native-artifact-cache.test.ts
index fe426cdf4..deddd0a96 100644
--- a/sdk/typescript/tests-ts/native-artifact-cache.test.ts
+++ b/sdk/typescript/tests-ts/native-artifact-cache.test.ts
@@ -86,13 +86,32 @@ test("native reuse hashes committed inputs with Git alone across platforms", ()
const initial = key();
expect(initial).toMatch(/^key=native-universal-v1-2026-43-[a-f0-9]{40}$/);
writeSource(repository, "README.md", "updated documentation\n");
+ writeSource(
+ repository,
+ ".github/scripts/invoice-desk-target.mjs",
+ "invoice\n",
+ );
+ writeSource(
+ repository,
+ "plugins/codex-security/mcp-app/tests/support/new.ts",
+ "fixture\n",
+ );
commit();
expect(key()).toBe(initial);
+ writeSource(
+ repository,
+ ".github/scripts/new-proof-input.mts",
+ "compile me\n",
+ );
+ commit();
+ const changedCompilerInput = key();
+ expect(changedCompilerInput).not.toBe(initial);
+
writeSource(repository, source, "updated native source\n");
commit();
const changedNative = key();
- expect(changedNative).not.toBe(initial);
+ expect(changedNative).not.toBe(changedCompilerInput);
writeSource(repository, helper, "updated helper source\n");
commit();