Skip to content

ci: run SDK tests with a Bazel-built codex#16046

Merged
bolinfest merged 1 commit intomainfrom
pr16046
Mar 28, 2026
Merged

ci: run SDK tests with a Bazel-built codex#16046
bolinfest merged 1 commit intomainfrom
pr16046

Conversation

@bolinfest
Copy link
Copy Markdown
Collaborator

@bolinfest bolinfest commented Mar 27, 2026

Why

Before this change, the SDK CI job built codex with Cargo before running the TypeScript package tests. That step has been getting more expensive as the Rust workspace grows, while the repo already has a Bazel-backed build path for the CLI.

The SDK tests also need a normal executable path they can spawn repeatedly. Moving the job to Bazel exposed an extra CI detail: a plain bazel-bin/... lookup is not reliable under the Linux config because top-level outputs may stay remote and the wrapper emits status lines around cquery output.

What Changed

  • taught sdk/typescript/tests/testCodex.ts to honor CODEX_EXEC_PATH before falling back to the local Cargo-style target/debug/codex path
  • added --remote-download-toplevel to .github/scripts/run-bazel-ci.sh so workflows can force Bazel to materialize top-level outputs on disk after a build
  • switched .github/workflows/sdk.yml from cargo build --bin codex to the shared Bazel CI setup and //codex-rs/cli:codex build target
  • changed the SDK workflow to resolve the built CLI with wrapper-backed cquery --output=files, stage the binary into ${GITHUB_WORKSPACE}/.tmp/sdk-ci/codex, and point the SDK tests at that path via CODEX_EXEC_PATH
  • kept the warm-up step before Jest and the Bazel repository-cache save step

Verification

  • bash -n .github/scripts/run-bazel-ci.sh
  • ./.github/scripts/run-bazel-ci.sh -- cquery --output=files -- //codex-rs/cli:codex | grep -E '^(/|bazel-out/)' | tail -n 1
  • ./.github/scripts/run-bazel-ci.sh --remote-download-toplevel -- build --build_metadata=TAG_job=sdk -- //codex-rs/cli:codex
  • CODEX_EXEC_PATH="$PWD/.tmp/sdk-ci/codex" pnpm --dir sdk/typescript test --runInBand
  • pnpm --dir sdk/typescript lint
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4172ee10c7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +60 to +64
bazel cquery \
--ui_event_filters=-info \
--noshow_progress \
--output=files \
//codex-rs/cli:codex \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Run Bazel cquery with CI auth fallback flags

This bazel cquery call bypasses .github/scripts/run-bazel-ci.sh, which is the only place we apply CI-safe remote settings (including clearing --remote_cache/--remote_executor when BUILDBUDDY_API_KEY is absent). On pull_request runs from forks where secrets are unavailable, the build step can still succeed via the wrapper fallback, but this direct query step can fail against the authenticated remote endpoints from .bazelrc before SDK tests run. Route this query through the same wrapper (or pass equivalent flags/header) to keep fork PR CI green.

Useful? React with 👍 / 👎.

@bolinfest bolinfest force-pushed the pr16046 branch 6 times, most recently from 576ee3c to 475d54f Compare March 27, 2026 23:09
@bolinfest bolinfest changed the title fix: stabilize SDK CI codex setup Mar 27, 2026
@bolinfest
Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@bolinfest bolinfest merged commit 2ffb32d into main Mar 28, 2026
75 of 82 checks passed
@bolinfest bolinfest deleted the pr16046 branch March 28, 2026 00:17
@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants