This folder contains all of the source code for the AI bazel build fixer bot. The bot uses a combination of deterministic tooling and LLMs to automatically generate PRs that fix the bazel build.
The bazel bot fixer that runs in GCP uses GitHub app. It uses a secret to generate short-lived tokens which are used to interact with fork repository at google-bazel-bot/llvm-project and upstream LLVM repository at llvm/llvm-project where PRs are created. For running the bot locally, one must use their own personal fork to act as both fork and PR repository. Fine-grained personal access tokens (PATs) must be generated for the personal repository with read/write permission to Contents, Pull request, Workflow.
By default, running the bot on test commits as follows disables usage of GitHub app token and relies on user-provided environment variable, which must be provided in test mode. For example, bot can be run on test commits as follows:
GOOGLE_CLOUD_PROJECT=llvm-bazel GOOGLE_CLOUD_LOCATION=global GOOGLE_GENAI_USE_VERTEXAI=1 BUILDKITE_API_TOKEN=<yourkey> GITHUB_FORK_USER=<you> GITHUB_FORK_USER_TOKEN=<yourforktoken> python bazelbot_server_main.py --test_commits=test.commits.log --llvm_git_repo=/tmp/bazelbot-llvm-git-repo if using VertexAI
or
GEMINI_API_KEY=<yourkey> GOOGLE_GENAI_USE_VERTEXAI=0 BUILDKITE_API_TOKEN=<yourkey> GITHUB_FORK_USER=<you> GITHUB_FORK_USER_TOKEN=<yourforktoken> python bazelbot_server_main.py --test_commits=test.commits.log --llvm_git_repo=/tmp/bazelbot-llvm-git-repo if using Gemini API.