Skip to content

Conversation

@shuyangli
Copy link
Member

@shuyangli shuyangli commented Oct 28, 2025

This splits the original gather-diff-and-generate-patch job into 2 steps:

  1. with read-only permissions, reads the pull request, calls an LLM, and writes diagnostic output, comments, and a model-generated diff to a file to get uploaded;
  2. with write permissions, read the output from previous step, attempt to apply and create a PR, and post comments to the original PR.

This satisfies the least privilege model. We can switch out step 1 to use mini-swe-agent when we're ready.

Fixes #33.

@shuyangli shuyangli marked this pull request as ready for review October 28, 2025 21:55
Copy link

@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.

ℹ️ 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 +61 to +66
- name: Generate patch artifacts
uses: tensorzero/experimental-ci-bot/generate-pr-patch@main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
tensorzero-base-url: http://localhost:3000
# TODO: Remove when agent creates PRs
tensorzero-diff-patched-successfully-metric-name: tensorzero_github_ci_bot_diff_patched_successfully
output-artifacts-dir: debug-logs
clickhouse-url: ${{ secrets.CI_BOT_CLICKHOUSE_URL }}
clickhouse-table: GitHubBotPullRequestToInferenceMap
output-artifacts-dir: ci-bot-artifacts

Choose a reason for hiding this comment

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

P0 Badge Pass GITHUB_TOKEN to generate-pr-patch action

The new implementation of generate-pr-patch now reads the GitHub token exclusively from process.env.GITHUB_TOKEN (src/generate-pr-patch/main.ts, getRequiredGitHubToken). In the workflow step that invokes the action, the previous token input and GH_TOKEN env were removed, but no GITHUB_TOKEN environment variable is supplied. Actions do not automatically expose secrets.GITHUB_TOKEN to the action process, so this step will crash with “GITHUB_TOKEN environment variable is required” before any artifacts are generated. Re‑introduce an env export, e.g. env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}, so the action can authenticate to GitHub APIs and the gh CLI.

Useful? React with 👍 / 👎.

Comment on lines +134 to +138
artifact-directory: pr-artifacts/ci-bot-artifacts
tensorzero-base-url: http://localhost:3000
tensorzero-diff-patched-successfully-metric-name: tensorzero_github_ci_bot_diff_patched_successfully
clickhouse-url: ${{ secrets.CI_BOT_CLICKHOUSE_URL }}
clickhouse-table: GitHubBotPullRequestToInferenceMap
Copy link
Member

Choose a reason for hiding this comment

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

Do we need all this here?

Copy link
Member

Choose a reason for hiding this comment

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

believe so bc need to write to CH

Copy link
Member Author

Choose a reason for hiding this comment

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

the "proper" way to do this is to spin up a hosted t0 server with auth, have an api key here, and whitelist it so we only accept the github action runners' IP range or something. that's a lot of work though.

Copy link
Member Author

@shuyangli shuyangli Nov 7, 2025

Choose a reason for hiding this comment

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

still worried about repo secrets; let's only run this on trusted code (coming from main repo, not forks)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Split GHA into two workflows

4 participants