Files
supabase/.github/workflows/braintrust-evals.yml
Matt Rossman ba86e23d63 fix: restore Studio Braintrust evals in CI (#54345)
## Problem

Our workflow sets `package_manager: pnpm`, which tells the Braintrust
action to run `pnpm dlx braintrust eval`. That command fetches the
latest `braintrust` package. Braintrust 4.0 dropped the bundled CLI, and
the [eval job now fails with
`ERR_PNPM_DLX_NO_BIN`](https://github.com/supabase/supabase/actions/runs/46545460526).

## Solution

```diff
- package_manager: pnpm
+ package_manager: npm
```

The new setting launches the CLI from Studio’s frozen pnpm install.
[Action
source](https://github.com/braintrustdata/eval-action/blob/c0dd75b29984a0cc63a827d6e8da2f23f2752be4/eval/src/braintrust.ts#L78-L116)

The action’s latest release, v2.1.0, still hardcodes `pnpm dlx
braintrust` in pnpm mode. The `npm` setting is a workaround to restore
CI now. We’ve asked Braintrust whether pnpm mode can use the project’s
installed CLI. [v2.1.0
source](https://github.com/braintrustdata/eval-action/blob/ed007eb24e933007a4079bd56643bc72d3cb016f/eval/src/braintrust.ts#L147-L154)

## Review instructions

The [PR
workflow](https://github.com/supabase/supabase/actions/runs/46563640999)
passed and posted the [Assistant eval
summary](https://github.com/supabase/supabase/pull/54345#issuecomment-7299032048).
Locally, `npx` also found the Assistant eval using Studio’s installed
CLI with npm offline.
2026-12-01 15:14:36 -05:00

99 lines
3.2 KiB
YAML

name: Run Braintrust evals
on:
push:
branches: [master]
pull_request:
types: [opened, synchronize, labeled]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
# Cheap, always-on gate: verifies the eval harness can reach the MCP server
# (its one real tool, search_docs). Runs on every push/PR — no OpenAI, no full
# eval suite — so a broken MCP connection is caught early with an actionable
# message. The eval job depends on this, so evals never run against a broken
# MCP connection.
preflight:
name: Eval MCP preflight
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Install pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
with:
run_install: false
- name: Use Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Preflight — MCP connectivity
run: cd apps/studio && pnpm evals:preflight
eval:
name: Run evals
needs: preflight
permissions:
pull-requests: write
if: github.event_name == 'push' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'run-evals') && github.event.pull_request.head.repo.full_name == github.repository)
runs-on: ubuntu-latest
timeout-minutes: 20
env:
BRAINTRUST_PROJECT_ID: ${{ secrets.BRAINTRUST_PROJECT_ID }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false
# For PR events, checkout the actual branch so Braintrust can report the correct branch name instead of detached HEAD.
# github.head_ref is the PR source branch, github.ref_name is the fallback for push events (e.g., master).
ref: ${{ github.head_ref || github.ref_name }}
- name: Install pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
with:
run_install: false
- name: Use Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Setup Evals
run: cd apps/studio && pnpm evals:setup
- name: Run Evals
uses: braintrustdata/eval-action@c0dd75b29984a0cc63a827d6e8da2f23f2752be4 # v1.0.16
with:
api_key: ${{ secrets.BRAINTRUST_API_KEY }}
runtime: node
# Use `npx braintrust` to run Studio's locked CLI because `pnpm dlx braintrust`
# fetches the latest package, which stopped bundling the CLI in 4.0.
package_manager: npm
root: apps/studio