-
Notifications
You must be signed in to change notification settings - Fork 0
Codex split action into two steps #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
996d8c8
e8faeb2
6b010aa
c2d7c38
c33f101
31763da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,15 +7,19 @@ on: | |
| - completed | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| contents: read | ||
| pull-requests: read | ||
| actions: read | ||
|
|
||
| jobs: | ||
| gather-diff-and-generate-patch: | ||
| collect-artifacts: | ||
| if: ${{ github.event.workflow_run.conclusion == 'failure' }} | ||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| actions: read | ||
| runs-on: ubuntu-latest | ||
| name: Gather failure context and generate PR | ||
| name: Gather failure context and generate artifacts | ||
| steps: | ||
| - name: Checkout TensorZero config file | ||
| uses: actions/checkout@v5 | ||
|
|
@@ -54,33 +58,84 @@ jobs: | |
| fetch-depth: 0 | ||
| fetch-tags: false | ||
|
|
||
| - name: Debug | ||
| run: | | ||
| ls -lR /tmp/tensorzero-for-gateway | ||
| cat /tmp/tensorzero-for-gateway/tensorzero.toml | ||
| cat /tmp/tensorzero-for-gateway/prompt.minijinja | ||
|
|
||
| - name: Call LLM to generate PR revision | ||
| - 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 | ||
|
|
||
| - name: Upload diagnostics bundle | ||
| - name: Upload CI bot artifacts | ||
| if: always() | ||
| continue-on-error: true | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ci-failure-diagnostics | ||
| name: tensorzero-ci-bot-artifacts | ||
| path: | | ||
| debug-logs/ | ||
| ci-bot-artifacts/ | ||
|
|
||
| - name: Stop TensorZero gateway | ||
| if: always() | ||
| continue-on-error: true | ||
| run: docker stop tensorzero-gateway | ||
|
|
||
| apply-artifacts: | ||
| needs: collect-artifacts | ||
| if: >- | ||
| ${{ github.event.workflow_run.conclusion == 'failure' && | ||
| needs.collect-artifacts.result == 'success' }} | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| actions: read | ||
| runs-on: ubuntu-latest | ||
| name: Apply collected artifacts and update PR | ||
| steps: | ||
| - name: Download CI bot artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: tensorzero-ci-bot-artifacts | ||
| path: pr-artifacts | ||
|
|
||
| - name: Checkout TensorZero config file | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| repository: tensorzero/experimental-ci-bot | ||
| sparse-checkout: | | ||
| tensorzero | ||
|
|
||
| - name: Move tensorzero to tensorzero-for-gateway | ||
| run: | | ||
| mv ./tensorzero /tmp/tensorzero-for-gateway | ||
| ls -lR . | ||
|
|
||
| - name: Start TensorZero gateway | ||
| run: | | ||
| docker pull tensorzero/gateway:latest | ||
| docker run -d --rm \ | ||
| --name tensorzero-gateway \ | ||
| -e TENSORZERO_CLICKHOUSE_URL=${{ secrets.CI_BOT_CLICKHOUSE_URL }} \ | ||
| -e OPENAI_API_KEY=${{ secrets.CI_BOT_OPENAI_API_KEY }} \ | ||
| -p 3000:3000 \ | ||
| --volume /tmp/tensorzero-for-gateway:/action-config \ | ||
| tensorzero/gateway:latest --config-file /action-config/tensorzero.toml | ||
|
|
||
| for _i in {1..100}; do | ||
| curl -fsS http://localhost:3000/health && exit 0 | ||
| sleep 3 | ||
| done | ||
| echo "Gateway never became ready" >&2 | ||
| exit 1 | ||
|
|
||
| - name: Apply diagnostic artifacts | ||
| uses: tensorzero/experimental-ci-bot/apply-pr-artifacts@main | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| 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 | ||
|
Comment on lines
+134
to
+138
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need all this here?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. believe so bc need to write to CH
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) |
||
|
|
||
| - name: Stop TensorZero gateway | ||
| if: always() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| name: apply-pr-artifacts | ||
| description: | ||
| Consume TensorZero CI Bot artifacts, verify them, and apply patches and | ||
| comments with privileged GitHub access. | ||
| author: shuyangli | ||
|
|
||
| inputs: | ||
| artifact-directory: | ||
| description: Directory containing the downloaded artifact bundle. | ||
| required: true | ||
| manifest-path: | ||
| description: | ||
| Relative path to the manifest inside the artifact directory (defaults to | ||
| manifest.json). | ||
| required: false | ||
| tensorzero-base-url: | ||
| description: Base URL for the TensorZero instance. | ||
| required: true | ||
| tensorzero-diff-patched-successfully-metric-name: | ||
| description: Metric name for tracking diff patching success. | ||
| required: true | ||
| clickhouse-url: | ||
| description: | ||
| URL for ClickHouse HTTP interface, in the format of | ||
| http[s]://[username:password@]hostname:port[/database]. | ||
| required: true | ||
| clickhouse-table: | ||
| description: Table where inference to PR associations should be recorded. | ||
| required: true | ||
|
|
||
| runs: | ||
| using: node24 | ||
| main: ../dist/apply-pr-artifacts/index.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new implementation of
generate-pr-patchnow reads the GitHub token exclusively fromprocess.env.GITHUB_TOKEN(src/generate-pr-patch/main.ts,getRequiredGitHubToken). In the workflow step that invokes the action, the previoustokeninput andGH_TOKENenv were removed, but noGITHUB_TOKENenvironment variable is supplied. Actions do not automatically exposesecrets.GITHUB_TOKENto 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 theghCLI.Useful? React with 👍 / 👎.