Skip to content

fix(evals): Support any provider key, default CI to OpenRouter - #563

Merged
Jeffreyhung merged 4 commits into
mainfrom
fix/evals-provider-keys
Nov 4, 2026
Merged

Jeffreyhung merged 4 commits into
mainfrom
fix/evals-provider-keys

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

The evals job fails before running anything on PRs that touch packages/evals/ (e.g. #562): WARDEN_ANTHROPIC_API_KEY is required to run evals in CI. The workflow only wires the Anthropic secret. Warden's own review workflow dropped that key in #434 and runs on WARDEN_OPENROUTER_API_KEY, which resolves fine on the same PRs. The evals harness was also hardcoded to Anthropic: suites skipped without ANTHROPIC_API_KEY, and the judge called the Anthropic SDK directly.

Changes

Provider selection (packages/evals/src/provider.ts)

  • WARDEN_EVAL_MODEL: a Pi provider/model selector. When set, it replaces every scenario's model, forces the Pi runtime, and enables the suites without an Anthropic key.
  • WARDEN_EVAL_JUDGE_MODEL: optional judge model. Defaults to WARDEN_EVAL_MODEL, then anthropic/claude-sonnet-4-6.
  • Credentials use the existing WARDEN_<PROVIDER>_API_KEY convention, which eval setup already bridges to the SDK's env name.
  • With neither variable set, behavior is unchanged: YAML models, Anthropic key required.

Judge

  • runJudge now goes through getRuntime('pi').runAuxiliary with the configured model instead of new Anthropic(). Same prompt, same verdict-count validation, same fail-closed fallback.
  • Adds an eval_judge auxiliary task name so judge calls are labeled in telemetry.
  • @anthropic-ai/sdk is no longer a dependency of warden-evals.

Workflow

  • WARDEN_EVAL_MODEL defaults to openrouter/anthropic/claude-sonnet-4.6. That's the same model the suites already pin, so scores stay comparable, on the OpenRouter key the repo already has. The WARDEN_EVAL_MODEL / WARDEN_EVAL_JUDGE_MODEL repo variables override it.
  • Passes WARDEN_OPENROUTER_API_KEY, WARDEN_ANTHROPIC_API_KEY, and WARDEN_OPENAI_API_KEY. Unset secrets are empty and harmless.
  • "Verify eval credentials" checks the WARDEN_<PROVIDER>_API_KEY for each selected model and names the missing one.
  • "Create eval status check" only runs when verification passed. It used to throw a second, misleading Eval results file not found on top of the real error.

This PR touches evals.yml, so its own evals run exercises the OpenRouter path end to end.

Verification

  • New provider.test.ts and judge.test.ts. harness.test.ts was updated for the new judge options. The evals unit suite passes: 69 tests.
  • pnpm lint, pnpm build, and typecheck all pass. The Warden src/sdk tests pass.
  • With no keys, pnpm evals skips all 62 evals, same as before.
  • With WARDEN_EVAL_MODEL=openrouter/anthropic/claude-sonnet-4.6 and a fake key, the run reaches OpenRouter on Pi and fails with Authentication required.. Without a key it fails locally with No API key found for openrouter.
  • I ran the verify step script locally for: valid key, missing key, a judge on a different provider with a missing key, and a selector without a provider.

Notes

  • Providers whose SDK env name doesn't follow <PROVIDER>_API_KEY (e.g. vercel-ai-gateway → AI_GATEWAY_API_KEY) still work locally via the SDK's own env name. In CI the verify step expects the WARDEN_-prefixed form, so adding one means adding that secret to the workflow env.

via Jeffrey Hung.

--

View Session [Sentry]

The evals workflow only wired WARDEN_ANTHROPIC_API_KEY, which Warden's
own CI no longer uses, so the job failed before running any evals.

- Add WARDEN_EVAL_MODEL and WARDEN_EVAL_JUDGE_MODEL. A model override
  replaces every scenario model, forces the Pi runtime, and enables the
  suites without an Anthropic key.
- Run the LLM judge through Warden's Pi runtime instead of the Anthropic
  SDK, so it can use any provider. Drop the @anthropic-ai/sdk dependency.
- CI defaults to openrouter/anthropic/claude-sonnet-4.6 with
  WARDEN_OPENROUTER_API_KEY, the same model as before on a key the repo
  already uses. The verify step checks the key for the selected
  provider, and the status check no longer reports a second, misleading
  "results file not found" error when verification fails.

Co-Authored-By: Jeffrey Hung <[email protected]>
@vercel

vercel Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
warden-prod Skipped Skipped Nov 4, 2026 8:13pm UTC

Request Review

The eval configs alias @sentry/warden to its source, but warden's config
schema imports @sentry/warden-service-api, which resolves to an unbuilt
dist/ in the evals job. Every suite failed to import, so no results were
recorded. Alias it to source the same way.

Co-Authored-By: Claude <[email protected]>
@sentry-junior sentry-junior Bot changed the title fix(evals): Run evals on any Pi provider, default CI to OpenRouter fix(evals): Support any provider key, default CI to OpenRouter Nov 4, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit af2f7ee. Configure here.

Comment thread packages/evals/src/e2e.eval.ts Resolved
With a model override, extraction repair, verification, and merge still
ran on Pi's default model because the eval runner never set
auxiliaryModel or synthesisModel. Forward the eval model to both so
OpenRouter-only runs stay on the configured provider.
@Jeffreyhung
Jeffreyhung merged commit d5b75b7 into main Nov 4, 2026
21 of 23 checks passed
@Jeffreyhung
Jeffreyhung deleted the fix/evals-provider-keys branch November 4, 2026 22:14
sentry-junior Bot added a commit that referenced this pull request Nov 5, 2026
CI now runs evals on OpenRouter (#563). roach.json allowed only
api.anthropic.com, so Roach refused OpenRouter calls and every pipeline
eval stopped with "Provider unavailable". Allow and match the
OpenRouter and OpenAI model APIs, and redact their keys.
@linear-code

linear-code Bot commented Nov 5, 2026

Copy link
Copy Markdown

SEC-2113

This branch was successfully deployed

1 active and 1 inactive deployments
Preview – warden — f3ae6020 Deployed Nov 4, 2026 by vercel[bot]
Preview – warden-prod — f3ae6020 Deployed Nov 4, 2026 by vercel[bot]
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.

1 participant