Skip to content

Route Bazel CI through shared BuildBuddy remote config wrapper#25156

Merged
anp-oai merged 15 commits into
mainfrom
codex/buildbuddy-ci-host-routing-rebased
Jun 2, 2026
Merged

Route Bazel CI through shared BuildBuddy remote config wrapper#25156
anp-oai merged 15 commits into
mainfrom
codex/buildbuddy-ci-host-routing-rebased

Conversation

@anp-oai
Copy link
Copy Markdown
Collaborator

@anp-oai anp-oai commented May 29, 2026

Why

Bazel remote configuration was selected in several CI scripts and workflow steps. That made the BuildBuddy tenant policy easy to duplicate and harder to audit, especially for fork pull requests that must not use the OpenAI tenant.

This builds on sluongng/buildbuddy-ci-host-routing and consolidates the policy in one place.

What to do if this breaks you

See codex-rs/docs/bazel.md for details. TLDR:

  1. make a BuildBuddy API key and put it in ~/.bazelrc
  2. if you're an OpenAI employee, add common --config=buildbuddy-openai-rbe to user.bazelrc in the repo root

Run just bazel-test to ensure it works.

Note that just bazel-remote-test no longer exists, you need to select a remote configuration as documented to use RBE.

What changed

  • Add .github/scripts/run_bazel_with_buildbuddy.py as the shared Bazel wrapper and Python library. It selects the OpenAI host only for trusted upstream GitHub Actions runs, routes keyed fork runs to the generic host, and falls back to local Bazel execution when no key is available.
  • Move endpoint selection into explicit .bazelrc configurations and update Bazel CI, query helpers, and rusty_v8 staging to use the shared policy. Loading-phase target-discovery queries remain local.
  • Add wrapper and rusty_v8 unit coverage, plus just test-scripts for the .github/scripts Python tests.
  • Document local Bazel usage, user.bazelrc setup, BuildBuddy configurations, and CI behavior in codex-rs/docs/bazel.md.

Validation

  • just test-scripts
  • bash -n .github/scripts/run-bazel-ci.sh .github/scripts/run-bazel-query-ci.sh .github/scripts/run-argument-comment-lint-bazel.sh scripts/list-bazel-clippy-targets.sh
  • python3 -m py_compile .github/scripts/run_bazel_with_buildbuddy.py .github/scripts/test_run_bazel_with_buildbuddy.py .github/scripts/test_rusty_v8_bazel.py .github/scripts/rusty_v8_bazel.py
  • ruff check .github/scripts/run_bazel_with_buildbuddy.py .github/scripts/test_run_bazel_with_buildbuddy.py .github/scripts/test_rusty_v8_bazel.py .github/scripts/rusty_v8_bazel.py

Comment thread .github/scripts/run-bazel-ci.sh
Comment thread .github/workflows/bazel.yml Outdated
Comment thread .github/workflows/bazel.yml Outdated
Comment thread .bazelrc
Comment thread justfile
@anp-oai
Copy link
Copy Markdown
Collaborator Author

anp-oai commented May 29, 2026

@codex review

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: 67fae88400

ℹ️ 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 thread .github/scripts/run-bazel-ci.sh Outdated
Comment thread .github/scripts/run-argument-comment-lint-bazel.sh Outdated
Comment thread .github/scripts/run-bazel-ci.sh
Comment thread .github/scripts/run-bazel-query-ci.sh Outdated
Comment thread .github/scripts/run_bazel_with_buildbuddy.py
Comment thread .github/scripts/run_bazel_with_buildbuddy.py
Comment thread .github/scripts/run_bazel_with_buildbuddy.py Outdated
Comment thread .github/scripts/run_bazel_with_buildbuddy.py
Comment thread .github/scripts/test_run_bazel_with_buildbuddy.py Outdated
Comment thread .github/scripts/test_run_bazel_with_buildbuddy.py Outdated
Comment thread .github/scripts/test_rusty_v8_bazel.py
Comment thread codex-rs/docs/bazel.md Outdated
Comment thread codex-rs/docs/bazel.md Outdated
Comment thread codex-rs/docs/bazel.md Outdated
Comment thread .bazelrc Outdated
Comment thread .bazelrc
anp-oai added a commit that referenced this pull request May 29, 2026
Comment thread scripts/list-bazel-clippy-targets.sh Outdated
Comment thread .bazelrc Outdated
Comment thread .bazelrc
anp-oai added a commit that referenced this pull request May 30, 2026
anp-oai added a commit that referenced this pull request Jun 1, 2026
anp-oai added a commit that referenced this pull request Jun 1, 2026
anp-oai added a commit that referenced this pull request Jun 1, 2026
@anp-oai anp-oai marked this pull request as ready for review June 2, 2026 04:21
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: 1df12acf01

ℹ️ 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 thread .bazelrc
Comment thread .bazelrc
@anp-oai
Copy link
Copy Markdown
Collaborator Author

anp-oai commented Jun 2, 2026

@codex review

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: 91db5b42e0

ℹ️ 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 thread .github/scripts/run_bazel_with_buildbuddy.py
@anp-oai anp-oai force-pushed the codex/buildbuddy-ci-host-routing-rebased branch from 91db5b4 to d92d74f Compare June 2, 2026 04:54
@bolinfest
Copy link
Copy Markdown
Collaborator

@anp-oai err

if you're an OpenAI employee, add common --config=buildbuddy-openai-rbe to user.bazelrc in the repo root

Can/should we recommend ~/.bazelrc instead? I have many clones of Codex and most people create Git worktrees that will not get this file automatically because it is in .gitignore, correct?

@bolinfest
Copy link
Copy Markdown
Collaborator

Upon further inspection, let's use https://developers.openai.com/codex/app/local-environments to deal with user.bazelrc in a follow-up.

Incidentally, we should consider whether user.bazelrc should be unreadable to Codex?


if [[ $# -ne 1 ]]; then
echo "Usage: $0 [--windows-cross-compile] [<bazel query args>...] -- <query expression>" >&2
if [[ $# -lt 2 || "${@: -2:1}" != "--" ]]; then
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yep, this file is definitely a candidate for a Python rewrite in a follow-up PR...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

On it!

Copy link
Copy Markdown
Collaborator

@bolinfest bolinfest left a comment

Choose a reason for hiding this comment

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

Let's do this!

@anp-oai anp-oai merged commit ebb7980 into main Jun 2, 2026
46 checks passed
@anp-oai anp-oai deleted the codex/buildbuddy-ci-host-routing-rebased branch June 2, 2026 16:56
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants