-
Notifications
You must be signed in to change notification settings - Fork 54
feat: new GH smoke test #165
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
Open
cdev412
wants to merge
20
commits into
main
Choose a base branch
from
rob/ae-32-id-most-important-parts-of-the-code-base-to-test-and-test
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 17 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
21c8586
feat: new GH smoke test
cdev412 bc29944
fix: new run
cdev412 0b06a94
feat: added new auth
cdev412 d8c46cf
feat: new auth
cdev412 943bf6a
feat: new auth
cdev412 c36db3b
feat: new auth
cdev412 9427c79
redo pipeline
cdev412 31926d5
fix: decrypt
cdev412 2eb4520
feat: number of max tasks respected
cdev412 a595333
fix: failed silently
cdev412 e71506e
enabled claude code access to env var
cdev412 785cef6
fix venv pull API keys
cdev412 fce3cc7
fix missing API key, fix max tasks
cdev412 ba3cc81
tests for end of run
cdev412 121bb56
feat: stop downloading the environment if not needed
cdev412 402e15b
fix: ruff format
cdev412 41dde32
Merge branch 'main' of https://github.com/princeton-pli/hal-harness i…
cdev412 d39bada
Merge branch 'main' into rob/ae-32-id-most-important-parts-of-the-cod…
cdev412 6509b0a
Merge branch 'main' into rob/ae-32-id-most-important-parts-of-the-cod…
cdev412 a112499
fix: indent
cdev412 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| # Runs a minimal CoreBench hard VM smoke eval. Requires a GitHub Environment | ||
| # (update `environment.name` below) with the secrets/vars listed in the job `env` block. | ||
| # Azure auth (pick one): (A) OIDC — Azure login with client-id, tenant-id, subscription-id | ||
| # and id-token: write (see https://github.com/azure/login ); (B) service principal + secret — | ||
| # Environment secrets `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_TENANT_ID` plus var | ||
| # `AZURE_SUBSCRIPTION_ID` assembled into azure/login `creds` JSON; omit id-token: write. | ||
| name: HAL eval CoreBench hard (VM) | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| # New run on the same branch/PR cancels the previous in-progress run (saves VM/API cost). | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| corebench-hard-vm: | ||
| runs-on: ubuntu-latest | ||
| # Create this Environment in Repo → Settings → Environments and attach secrets/vars. | ||
| environment: test-environment | ||
| permissions: | ||
| contents: read | ||
| env: | ||
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | ||
| WANDB_API_KEY: ${{ secrets.WANDB_API_KEY }} | ||
| AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }} | ||
| AZURE_RESOURCE_GROUP_NAME: ${{ vars.AZURE_RESOURCE_GROUP_NAME }} | ||
| AZURE_LOCATION: ${{ vars.AZURE_LOCATION }} | ||
| NETWORK_SECURITY_GROUP_NAME: ${{ vars.NETWORK_SECURITY_GROUP_NAME }} | ||
| SSH_PRIVATE_KEY_PATH: ${{ vars.SSH_PRIVATE_KEY_PATH }} | ||
| SSH_PUBLIC_KEY_PATH: ${{ vars.SSH_PUBLIC_KEY_PATH }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| # Warm capsules avoid re-downloading from corebench.cs.princeton.edu every run. | ||
| # - uses: actions/cache@v4 | ||
| # with: | ||
| # path: hal/benchmarks/corebench/capsules | ||
| # key: corebench-capsules-${{ hashFiles('hal/benchmarks/corebench/core_test.json.gpg') }} | ||
| # restore-keys: | | ||
| # corebench-capsules- | ||
|
|
||
| - name: Assemble Azure creds JSON | ||
| id: azure_creds | ||
| env: | ||
| AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | ||
| AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }} | ||
| AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | ||
| run: | | ||
| set -euo pipefail | ||
| for v in AZURE_CLIENT_ID AZURE_CLIENT_SECRET AZURE_TENANT_ID AZURE_SUBSCRIPTION_ID; do | ||
| if [ -z "${!v:-}" ]; then | ||
| echo "::error::Required $v is empty (set on GitHub Environment \`test-environment\` secrets or vars)." >&2 | ||
| exit 1 | ||
| fi | ||
| done | ||
| CREDS="$(python3 -c 'import json, os; print(json.dumps({"clientId": os.environ["AZURE_CLIENT_ID"], "clientSecret": os.environ["AZURE_CLIENT_SECRET"], "subscriptionId": os.environ["AZURE_SUBSCRIPTION_ID"], "tenantId": os.environ["AZURE_TENANT_ID"]}))')" | ||
| { | ||
| echo 'creds<<CREDS_JSON_EOF' | ||
| echo "$CREDS" | ||
| echo 'CREDS_JSON_EOF' | ||
| } >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Azure login (service principal) | ||
| uses: azure/login@v2 | ||
| with: | ||
| auth-type: SERVICE_PRINCIPAL | ||
| creds: ${{ steps.azure_creds.outputs.creds }} | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| set -euo pipefail | ||
| pip install -e ".[dev,azure,corebench,coreagent]" | ||
| # Ensure gql 4+ (weave needs TransportConnectionFailed); extras can pull gql 3.x. | ||
| pip install "gql[httpx]>=4.0,<5" | ||
|
|
||
| - name: Generate SSH key pair for VM provisioning | ||
| run: | | ||
| set -euo pipefail | ||
| key="${SSH_PRIVATE_KEY_PATH:?SSH_PRIVATE_KEY_PATH must be set}" | ||
| pub="${SSH_PUBLIC_KEY_PATH:?SSH_PUBLIC_KEY_PATH must be set}" | ||
| mkdir -p "$(dirname "$key")" | ||
| rm -f "$key" "$pub" | ||
| ssh-keygen -t ed25519 -f "$key" -N "" -q | ||
| test -f "$pub" | ||
| chmod 600 "$key" | ||
| chmod 644 "$pub" | ||
|
|
||
| # core_test.json is gitignored; benchmark loads decrypted JSON (see README / hal/benchmarks/corebench.py). | ||
| - name: Decrypt CoreBench test set | ||
| run: | | ||
| set -euo pipefail | ||
| gpg --batch --yes --pinentry-mode loopback \ | ||
| --passphrase 'reproducibility' \ | ||
| --output hal/benchmarks/corebench/core_test.json \ | ||
| --decrypt hal/benchmarks/corebench/core_test.json.gpg | ||
|
|
||
| - name: Run hal-eval (CoreBench hard, one test, VM) | ||
| run: | | ||
| set -euo pipefail | ||
| if [ -z "${OPENAI_API_KEY:-}" ]; then | ||
| echo "::error::OPENAI_API_KEY is empty — add repository or environment secret \`OPENAI_API_KEY\` on GitHub Environment \`test-environment\`." >&2 | ||
| exit 1 | ||
| fi | ||
| log="$(mktemp)" | ||
| set +e | ||
| set -o pipefail | ||
| hal-eval --benchmark corebench_hard \ | ||
| --agent_dir agents/core_agent \ | ||
| --agent_function main.run \ | ||
| --agent_name "CORE-Agent" \ | ||
| --vm \ | ||
| --no-download-environment \ | ||
| --max_concurrent 1 \ | ||
| --max_tasks 1 \ | ||
| -A 'model_name=openai/gpt-4.1-2025-04-14' \ | ||
| 2>&1 | tee "$log" | ||
| eval_status=${PIPESTATUS[0]} | ||
| set -e | ||
| if [ "$eval_status" -ne 0 ]; then | ||
| echo "::error::hal-eval exited with status $eval_status" >&2 | ||
| exit "$eval_status" | ||
| fi | ||
| if ! grep -Fq 'hal.cli: Evaluation completed successfully' "$log"; then | ||
| echo "::error::hal-eval output must contain: hal.cli: Evaluation completed successfully" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Verify CoreBench hard result layout and upload JSON | ||
| run: | | ||
| set -euo pipefail | ||
| bash tests/gh_actions/verify_corebench_hard_e2e.sh | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
please uncomment or delete