Skip to content
Merged
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
8 changes: 4 additions & 4 deletions packages/cli/script/eval-skill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
/**
* Evaluate SKILL.md effectiveness by testing LLM command planning.
*
* Sends test prompts to agent models (Opus 4.6 + Sonnet 4.6) with SKILL.md
* Sends test prompts to agent models (Sonnet 5 + GPT-5.6 Luna) with SKILL.md
* as context, then grades the planned commands on efficiency criteria.
* Commands are verified against the real CLI binary (via `-h`) to ground
* the LLM judge with empirical results.
*
* Requires an eval provider credential: OPENROUTER_API_KEY (preferred) or
* ANTHROPIC_API_KEY. OpenRouter is used when its key is set; default model IDs
* are OpenRouter slugs (e.g. `anthropic/claude-sonnet-4.6`).
* are OpenRouter slugs (e.g. `anthropic/claude-sonnet-5`).
*
* Usage:
* tsx script/eval-skill.ts
* EVAL_AGENT_MODELS=anthropic/claude-sonnet-4.6 tsx script/eval-skill.ts
* EVAL_AGENT_MODELS=anthropic/claude-sonnet-5 tsx script/eval-skill.ts
*
* Environment variables:
* OPENROUTER_API_KEY - OpenRouter API key (preferred)
* ANTHROPIC_API_KEY - Anthropic API key (fallback when no OpenRouter key)
* EVAL_AGENT_MODELS - Comma-separated model IDs (default: sonnet-4.6, opus-4.6)
* EVAL_AGENT_MODELS - Comma-separated model IDs (default: sonnet-5, gpt-5.6-luna)
* EVAL_JUDGE_MODEL - Judge model ID (default: haiku-4.5)
* EVAL_THRESHOLD - Minimum pass rate 0-1 (default: 0.75)
* SENTRY_CLI_BINARY - Path to pre-built binary (falls back to tsx src/bin.ts)
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/test/e2e/skill-eval.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import type { CaseResult, TestCase } from "../skill-eval/helpers/types.js";
const SKILL_PATH = "plugins/sentry-cli/skills/sentry-cli/SKILL.md";
const DEFAULT_THRESHOLD = 0.75;

/** Models under test — env-overridable, defaults to sonnet + opus. */
/** Models under test — env-overridable, defaults to sonnet-5 + gpt-5.6-luna. */
const AGENT_MODELS = process.env.EVAL_AGENT_MODELS
? process.env.EVAL_AGENT_MODELS.split(",").map((m) => m.trim())
: ["anthropic/claude-sonnet-4.6", "anthropic/claude-opus-4.6"];
: ["anthropic/claude-sonnet-5", "openai/gpt-5.6-luna"];

const provider = resolveEvalProvider();

Expand Down
13 changes: 12 additions & 1 deletion packages/cli/test/eval-common/anthropic-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,17 @@ async function anthropicChat({
messages,
maxTokens,
}: ChatArgs): Promise<string> {
// Anthropic direct path only supports Anthropic models; strip the
// OpenRouter-style `anthropic/` prefix and reject anything else.
let anthropicModel = model;
if (model.startsWith("anthropic/")) {
anthropicModel = model.slice("anthropic/".length);
} else if (model.startsWith("openai/")) {
throw new Error(
`Anthropic direct provider cannot serve OpenAI model "${model}"`
);
}

const { default: Anthropic } = await import("@anthropic-ai/sdk");
const client = new Anthropic({ apiKey, baseURL });

Expand All @@ -146,7 +157,7 @@ async function anthropicChat({
.map((m) => ({ role: "user" as const, content: m.content }));

const response = await client.messages.create({
model,
model: anthropicModel,
max_tokens: maxTokens,
system,
messages: userMsgs,
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/test/skill-eval/helpers/llm-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import type {

/** Default agent models — the target models for the skill (OpenRouter slugs). */
export const DEFAULT_AGENT_MODELS = [
"anthropic/claude-sonnet-4.6",
"anthropic/claude-opus-4.6",
"anthropic/claude-sonnet-5",
"openai/gpt-5.6-luna",
Comment thread
jared-outpost[bot] marked this conversation as resolved.
];
Comment on lines 15 to 18

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The new default models include an OpenAI model incompatible with the Anthropic-direct provider, causing skill evaluations to fail silently when only ANTHROPIC_API_KEY is present.
Severity: MEDIUM

Suggested Fix

Validate that the selected provider is compatible with all models at the start of the evaluation. If there is a mismatch, either filter out the incompatible models or throw a clear error detailing the configuration problem. Alternatively, revert the default models to a pair that is compatible with a single provider.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: packages/cli/test/skill-eval/helpers/llm-client.ts#L15-L18

Potential issue: The default agent models for skill evaluation were changed to
`["anthropic/claude-sonnet-5", "openai/gpt-5.6-luna"]`. When the evaluation environment
only has the `ANTHROPIC_API_KEY` available and not the `OPENROUTER_API_KEY`, the system
selects the Anthropic-direct provider. This provider cannot handle the OpenAI model.
While an explicit crash is prevented, an error is caught, leading to a `null` plan for
the OpenAI model. This results in a score of 0, causing the entire skill evaluation to
fail its quality threshold, incorrectly flagging a valid skill as faulty.

Also affects:

  • packages/cli/test/e2e/skill-eval.test.ts:25~28

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We are only going to use OpenRouter from going on so this should be fine


/** Default judge model — cheap and fast, just needs to grade command plans. */
Expand Down
Loading