Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# security known vulnerabilities in the locked Python and JS dependencies, leaked secrets,
# and the license gate.
# The frame tests (Docker, the frame images, the egress proxy) run nightly in integration-frames.yml;
# the deep drills keep their own schedules (evals nightly, perf nightly, chaos weekly).
# the deep drills keep their own schedules (evals weekly, perf nightly, chaos weekly).
name: CI

on:
Expand Down
89 changes: 89 additions & 0 deletions .github/workflows/evals-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Routing evals on a pull request that changes what the agents read or do.
#
# A seeded sample of 50 outcome rows, each decided by ONE in-process Lead call (`--suite decide`): no task,
# no plan, no Machine, no verifier, so it is the cheapest wide signal the evals have. Advisory: a sample
# never gates (the whole suite answers to `--gate`), so the report lands in the job summary for the
# reviewer. A pull request from a fork gets no secrets; the job then says so and runs nothing.

name: PR routing evals

on:
pull_request:
paths:
- "backend/prismoid/ai/**"
- "backend/skills/**"
- ".github/workflows/evals-pr.yml"

concurrency:
group: evals-pr-${{ github.event.pull_request.number }}
cancel-in-progress: true # a newer push makes the older sample worthless; stop paying for it

permissions:
contents: read

jobs:
decide:
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 30
defaults:
run:
working-directory: backend # the service dir (ADR-007)
shell: bash
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
# The in-process Lead reads its key under the worker's prefix, not the bare name.
PRISMOID_WORKER_ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
steps:
- name: Check the model key
id: key
working-directory: .
run: |
if [ -z "$ANTHROPIC_API_KEY" ]; then
echo "has=false" >> "$GITHUB_OUTPUT"
echo "## Routing evals not run: no ANTHROPIC_API_KEY (a fork's pull request gets no secrets)" >> "$GITHUB_STEP_SUMMARY"
else
echo "has=true" >> "$GITHUB_OUTPUT"
fi

- uses: actions/checkout@v7
if: steps.key.outputs.has == 'true'

- name: Install uv
if: steps.key.outputs.has == 'true'
uses: astral-sh/setup-uv@v7
with:
python-version: "3.12"

# The decision reads the model catalog from Postgres, so the database comes up; no API, no worker.
- name: Bring up the stack (postgres + minio, the same compose as local)
if: steps.key.outputs.has == 'true'
run: |
docker compose -f deploy/compose.yaml up -d --wait
docker compose -f deploy/compose.yaml run --rm minio-init

- name: Install deps
if: steps.key.outputs.has == 'true'
run: uv sync --frozen

# uvx --from rust-just: the runner image ships no `just` binary; rust-just runs it without PATH ceremony.
- name: Migrate + seed the catalog
if: steps.key.outputs.has == 'true'
run: |
uvx --from rust-just just migrate
uv run prismoid models seed

- name: Decide a seeded sample of the outcome rows
if: steps.key.outputs.has == 'true'
run: uv run python -m evals.run --suite decide --sample 50 --seed 1 | tee decide.txt

- name: Report → job summary
if: always() && steps.key.outputs.has == 'true'
run: |
{
echo '## Routing evals (50 sampled outcome rows, one Lead call each; advisory)'
cat decide.txt 2>/dev/null || echo "the run produced no report"
} >> "$GITHUB_STEP_SUMMARY"

- name: Stop the stack
if: always() && steps.key.outputs.has == 'true'
run: docker compose -f deploy/compose.yaml down -v
186 changes: 133 additions & 53 deletions .github/workflows/evals.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,40 @@
# Nightly golden evals — the suite, against a real stack, with a run-over-run diff.
# Weekly evals - a sample of the golden cases and the talk set, against a real stack, with a run-over-run diff.
#
# This is a real workflow, not a placeholder. What it needs before it can run — the human inputs the
# build cannot supply for itself:
# • secrets: ANTHROPIC_API_KEY (the producer), and a SECOND frontier key of a different family
# (OPENAI_API_KEY here) so the cross-family judge is not the weak local qwen that rubber-stamps.
# Ollama is not in CI, so the frontier judge is added from that second key; without it the run still
# executes but the RubricJudge column is unverified.
# Spend is bounded three ways (ADR-008, amended for cost):
# • cadence: weekly, and a scheduled run that finds nothing changed since the last green run skips
# (the fingerprint: the prompts every agent reads, the skills, the model catalog seed, the eval cases,
# the lockfile and this file). A change to engine code alone does not re-run it: dispatch by hand.
# • size: a seeded sample of the golden cases (20 of the 104 by default, the same 20 every week so the
# diff compares like with like) and of trivial50 (15 of 48).
# • a cap per golden task (0.50 USD by default, sent as the task's budget; the Bursar holds it).
# The whole hundred runs by hand before a release: Run workflow with cases = 0.
#
# Trigger it by hand (Actions → Nightly golden evals → Run workflow) or let the schedule fire.
# What it needs before it can run - the human inputs the build cannot supply for itself:
# • secrets: ANTHROPIC_API_KEY (the producer; the run refuses to start without it), and optionally a
# second frontier key of a different family (OPENAI_API_KEY here) so the judge is not the
# producer's own family. Without it the run still gates, and the RubricJudge column is unverified.

name: Nightly golden evals
name: Weekly evals

on:
schedule:
- cron: "0 7 * * *" # 07:00 UTC nightly
- cron: "0 7 * * 1" # Mondays, 07:00 UTC
workflow_dispatch:
inputs:
limit:
description: "How many golden cases to run"
default: "100"
cases:
description: "Golden cases to sample (0 = all of them)"
default: "20"
budget:
description: "USD cap per golden task"
default: "0.5"

concurrency:
group: evals
cancel-in-progress: false # a nightly must never cancel the run whose baseline the next one diffs
cancel-in-progress: false # never cancel the run whose report the next one diffs against

permissions:
contents: read
actions: read # read the last green run's report: the baseline and the fingerprint

jobs:
golden:
Expand All @@ -37,41 +49,100 @@ jobs:
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
# The worker and the in-process suites read their keys under the worker's prefix, not the bare names.
PRISMOID_WORKER_ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
PRISMOID_WORKER_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
GH_TOKEN: ${{ github.token }}
PRISMOID_CLI_API_URL: http://localhost:8100
# The browser rows (golden and the web suite) run only when an operator hosts the
# fixture admin app somewhere a task's frame can reach, and then need computer use on.
PRISMOID_EVALS_BROWSER_URL: ${{ vars.PRISMOID_EVALS_BROWSER_URL }}
PRISMOID_COMPUTER_USE_ENABLED: ${{ vars.PRISMOID_EVALS_BROWSER_URL != '' }}
CASES: ${{ github.event.inputs.cases || '20' }}
BUDGET: ${{ github.event.inputs.budget || '0.5' }}
FLOOR: "0.5" # the golden pass rate no run may fall below: 11/20 (55%) on the first measured run, 2026-11-28
steps:
# Without the producer's key every case fails in seconds (0/100, "no artifact"); say why instead.
- name: Check the model key
run: |
if [ -z "$ANTHROPIC_API_KEY" ]; then
echo "::error::ANTHROPIC_API_KEY is not set: every case would fail without a model. Add the repository secret."
exit 1
fi
[[ "$CASES" =~ ^[0-9]+$ ]] || { echo "::error::cases must be a whole number, got '$CASES'"; exit 1; }
[[ "$BUDGET" =~ ^[0-9]+(\.[0-9]+)?$ ]] || { echo "::error::budget must be a number, got '$BUDGET'"; exit 1; }
# Listing models is free; a key the provider refuses fails here, with its reason, not as 0/N.
code=$(curl -s -o models.json -w '%{http_code}' https://api.anthropic.com/v1/models \
-H "x-api-key: $ANTHROPIC_API_KEY" -H "anthropic-version: 2023-06-01")
if [ "$code" != "200" ]; then
echo "::error::Anthropic refused ANTHROPIC_API_KEY (HTTP $code): $(jq -r '.error.message // empty' models.json)"
exit 1
fi
working-directory: .

- uses: actions/checkout@v7

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.12"

- name: Install deps
run: uv sync --frozen

- name: Fingerprint what the evals measure
run: |
{
echo "prompts=$(uv run python -c 'from tools.prompt_evidence import prompts_sha; print(prompts_sha())')"
echo "skills=$(find skills -type f -print0 | sort -z | xargs -0 sha256sum | sha256sum | cut -c1-16)"
echo "files=$(sha256sum prismoid/runner/default_models.yaml evals/cases/golden.jsonl \
evals/datasets/trivial50.jsonl uv.lock ../.github/workflows/evals.yml | sha256sum | cut -c1-16)"
} > fingerprint.txt
cat fingerprint.txt

- name: Fetch the last green run's report
run: |
mkdir -p previous
last=$(gh run list --workflow evals.yml --branch "$GITHUB_REF_NAME" --status success --limit 1 \
--json databaseId -q '.[0].databaseId // empty')
if [ -n "$last" ]; then
gh run download "$last" -n golden-report -D previous || echo "run $last kept no report"
fi
ls previous

- name: Skip when nothing changed
id: decide
run: |
if [ "$GITHUB_EVENT_NAME" = "schedule" ] && [ -f previous/fingerprint.txt ] \
&& cmp -s previous/fingerprint.txt fingerprint.txt; then
echo "skip=true" >> "$GITHUB_OUTPUT"
echo "## Evals skipped: nothing they measure changed since the last green run" >> "$GITHUB_STEP_SUMMARY"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi

- name: Bring up the stack (postgres + minio, the same compose as local)
if: steps.decide.outputs.skip != 'true'
run: |
docker compose -f deploy/compose.yaml up -d --wait
docker compose -f deploy/compose.yaml run --rm minio-init

- name: Install deps
run: uv sync --frozen

# uvx --from rust-just: the runner image ships no `just` binary; rust-just runs it without PATH ceremony.
- name: Migrate + seed the catalog
if: steps.decide.outputs.skip != 'true'
run: |
uvx --from rust-just just migrate
uv run prismoid models seed

- name: Add a frontier judge of a second family (if the key is present)
if: ${{ env.OPENAI_API_KEY != '' }}
if: steps.decide.outputs.skip != 'true' && env.OPENAI_API_KEY != ''
run: |
uv run prismoid models add openai:gpt-5 --classes judge \
--price input_token=1.25/M --price output_token=10/M --enable

# The worker first: its first start creates the durable engine's database, which the API needs to boot.
- name: Start the worker and API
if: steps.decide.outputs.skip != 'true'
run: |
.venv/bin/prismoid run worker > worker.log 2>&1 & echo $! > worker.pid
for _ in $(seq 1 90); do if grep -q "worker ready" worker.log; then break; fi; sleep 2; done
Expand All @@ -83,80 +154,89 @@ jobs:

# Signup is a call to the API, so it comes after the API is up.
- name: Create a user + token (the eval harness reads ~/.prismoid/credentials)
if: steps.decide.outputs.skip != 'true'
run: |
uv run prismoid login --signup --email ci@example.com --name CI \
--password "${{ secrets.CI_USER_PASSWORD || 'correct horse battery staple' }}"

- name: The trivial50 talk set (a report, never a gate; the problem books' rows are dataset rows)
- name: The trivial50 talk set, a seeded sample (a report, never a gate)
if: steps.decide.outputs.skip != 'true'
continue-on-error: true
run: uv run python -m evals.run --suite trivial50 | tee trivial50.txt
run: uv run python -m evals.run --suite trivial50 --sample 15 --seed 1 | tee trivial50.txt

- name: The selection lanes (advisory drift alarms — runners existed, cadence did not)
- name: The selection lanes (advisory drift alarms)
if: steps.decide.outputs.skip != 'true'
continue-on-error: true
run: |
uv run python -m evals.run --suite bot-selection | tee bot-selection.txt
uv run python -m evals.run --suite skill-golden --limit 20 | tee skill-golden.txt
uv run python -m evals.run --suite bot-golden --limit 20 | tee bot-golden.txt
uv run python -m evals.run --suite skill-golden --limit 20 --budget "$BUDGET" | tee skill-golden.txt
uv run python -m evals.run --suite bot-golden --limit 20 --budget "$BUDGET" | tee bot-golden.txt

# The gate: no lower than the floor, and no drop against the last green run's report (the cases both
# runs share may lose GOLDEN_SLACK in run.py, one trial per case flickers). The first run has no
# baseline, so the floor alone holds it.
- name: Run the golden suite
if: steps.decide.outputs.skip != 'true'
run: |
uv run python -m evals.run --suite golden \
--limit "${{ github.event.inputs.limit || 100 }}" \
--concurrency 6 --report report.json | tee run.txt
sample=() baseline=()
if [ "$CASES" != "0" ]; then sample=(--sample "$CASES" --seed 1); fi
if [ -f previous/report.json ]; then baseline=(--baseline previous/report.json); fi
uv run python -m evals.run --suite golden "${sample[@]}" "${baseline[@]}" --budget "$BUDGET" \
--threshold "$FLOOR" --concurrency 6 --report report.json | tee run.txt

# The web suite drives the fixture admin app, so it rides that variable. It runs after the
# required golden step with its own timeout, so it can never starve the job's budget.
- name: The web suite (ADVISORY; runs only with the fixture site)
if: ${{ vars.PRISMOID_EVALS_BROWSER_URL != '' }}
if: steps.decide.outputs.skip != 'true' && vars.PRISMOID_EVALS_BROWSER_URL != ''
timeout-minutes: 45
continue-on-error: true
run: uv run python -m evals.suites.web | tee web.txt

- name: Restore the previous run's baseline
uses: actions/cache/restore@v6
with:
path: backend/baseline.json # action paths resolve from the workspace root, not the step cwd
# The save key appends `-${{ github.run_id }}`, so the exact key NEVER matches on the
# next run — the diff silently no-op'd for every nightly. `restore-keys` prefix-matches
# the newest prior save, which is the baseline this run is meant to diff against.
key: evals-baseline-${{ github.ref_name }}
restore-keys: |
evals-baseline-${{ github.ref_name }}-
# The harness says a case failed; the worker says why.
- name: Show the worker's errors (when a case failed)
if: failure() && steps.decide.outputs.skip == 'false'
run: grep -iE "warn|error|exception|traceback" worker.log | grep -v "StepFailed" | tail -n 80 || echo "worker.log holds no errors"

- name: Run-over-run diff → job summary
if: always()
if: always() && steps.decide.outputs.skip == 'false'
run: |
{
echo '## Golden evals'
echo '```'
tail -n 6 run.txt || true
echo '```'
echo '### Diff vs the previous nightly'
echo '### Diff vs the last green run'
echo '```'
uv run python tools/evals_diff.py baseline.json report.json || true
if [ -f previous/report.json ]; then
uv run python tools/evals_diff.py previous/report.json report.json || true
else
echo "no earlier report to diff against"
fi
echo '```'
} >> "$GITHUB_STEP_SUMMARY"

- name: Promote this run to the baseline
if: success()
run: cp report.json baseline.json

- name: Save the new baseline
if: success()
uses: actions/cache/save@v6
# A green run's report is the next run's baseline and carries its fingerprint; a skipped run hands
# the last green report forward, so the chain never breaks.
- name: Keep this run's report
if: always() && steps.decide.outputs.skip == 'false'
uses: actions/upload-artifact@v7
with:
path: backend/baseline.json
key: evals-baseline-${{ github.ref_name }}-${{ github.run_id }}
name: golden-report
path: |
backend/report.json
backend/fingerprint.txt
retention-days: 90

- name: Keep the report as an artifact
if: always()
- name: Hand the last green report forward
if: steps.decide.outputs.skip == 'true'
uses: actions/upload-artifact@v7
with:
name: golden-report
path: backend/report.json
path: backend/previous/
retention-days: 90

- name: Stop the stack
if: always()
if: always() && steps.decide.outputs.skip == 'false'
run: |
kill "$(cat worker.pid)" "$(cat api.pid)" 2>/dev/null || true
docker compose -f deploy/compose.yaml down -v
2 changes: 1 addition & 1 deletion STATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ cannot pass a dry run with Caddy's `local_certs`.
| Before a workstream merges | `just test`: the whole backend suite, integration tests included (needs `just up`; refuses while `just dev` runs) |
| A sandbar change | `just sandbar-check` |
| A user-visible change | One real run: `just smoke` or the CLI flow. An agent, prompt or skill change adds `just evals` |
| The drills | Nightly in CI: evals, `just perf`, `just e2e` (the browser flows over every surface reachable without a model run, the operator console included; a flow marked `knownBug` names a bug still open, ADR-081), the frame integration tests. Weekly: `just chaos`. On demand: `just e2e-models` (the browser flows on a real model; needs a provider key, also Actions -> E2E model flows), `just load`, `just endurance`, `just backup-restore`, `just fresh-clone`, `just range` |
| The drills | Weekly in CI: evals (a seeded sample, skipped when nothing they measure changed; ADR-008 amended), `just chaos`; on a pull request that changes `prismoid/ai` or `skills`: a sampled routing eval. Nightly in CI: `just perf`, `just e2e` (the browser flows over every surface reachable without a model run, the operator console included; a flow marked `knownBug` names a bug still open, ADR-081), the frame integration tests. On demand: the whole golden hundred (Actions -> Weekly evals, cases = 0), `just e2e-models` (the browser flows on a real model; needs a provider key, also Actions -> E2E model flows), `just load`, `just endurance`, `just backup-restore`, `just fresh-clone`, `just range` |

Red means stop and fix it before new work.

Expand Down
Loading