Skip to content
This repository was archived by the owner on Nov 10, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
eb54a42
Expand agent-eval to the 15-eval line (#324)
kasperpeulen Jul 2, 2026
aee8c1f
Format fixture and template package.json files
kasperpeulen Jul 2, 2026
bf10829
Fix run-story-tests wiring for the vite-app/monorepo fixtures; gate 8…
kasperpeulen Jul 2, 2026
4c2f1fa
Patch @vercel/agent-eval: classify failures via ANTHROPIC_API_KEY, ha…
kasperpeulen Jul 2, 2026
eb3aaf9
Address independent review findings on the 15-eval line
kasperpeulen Jul 2, 2026
3e5470c
Allow 0.5% project-coverage jitter in codecov
kasperpeulen Jul 2, 2026
b63a27e
Merge branch 'main' into kasper/eval-coverage-324
kasperpeulen Jul 2, 2026
185b83e
813: mark workflow assertions test.todo pending storybookjs/storybook…
kasperpeulen Jul 2, 2026
92072dc
Make display-review the terminal step for visual work; frontload conc…
kasperpeulen Jul 2, 2026
6936169
Assert stories-skill engagement on the plugin path of visual-change e…
kasperpeulen Jul 2, 2026
cdb0854
Accept adapted review-section headings in the final-response assertion
kasperpeulen Jul 2, 2026
e7463c7
Merge branch 'main' into kasper/eval-coverage-324
kasperpeulen Jul 2, 2026
360630e
Address review round 2: coverage, assertion strictness, hint gating, …
kasperpeulen Jul 2, 2026
dee9304
Merge branch 'kasper/eval-coverage-324' of https://github.com/storybo…
kasperpeulen Jul 2, 2026
cce3696
Address Fable + Codex round-3 reviews
kasperpeulen Jul 2, 2026
5d1d09b
Address bot-review wave: upgrade floor for removed deps, signal-aware…
kasperpeulen Jul 2, 2026
4a494e1
Fix shell parser mistaking head -c for a bash -c wrapper
kasperpeulen Jul 3, 2026
1f7ad7c
Close the preview-stories review exit ramp
kasperpeulen Jul 3, 2026
bfe009b
Update mcp-endpoint e2e snapshots for the preview-stories review changes
kasperpeulen Jul 3, 2026
8aa84bb
Route plugin-path story discovery into display-review
kasperpeulen Jul 3, 2026
25c6594
Correct overclaim in story-linking comments
kasperpeulen Jul 3, 2026
cf4e841
Slim the review-enabled preview-stories description to mid-loop framing
kasperpeulen Jul 3, 2026
97b5111
Correct the Mode F root cause: channel contradiction, not a channel gap
kasperpeulen Jul 3, 2026
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
7 changes: 7 additions & 0 deletions .changeset/eval-review-exit-ramp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@storybook/addon-mcp': patch
---

Make display-review the single ending for visual work: the after-change instruction step now feeds story discovery into the review instead of ending at preview URLs, preview-stories is framed as a mid-loop tool, the "or you skipped it" escape is removed (non-visual changes say so plainly instead of listing links), and get-changed-stories results append a "publish the review now" next-step hint when review is enabled. Fixes agents completing visual changes but handing back preview links instead of the review.

The preview-stories tool also closes the review exit ramp: when review is enabled its description states display-review's availability as fact instead of hedging with "when available" (which let an agent that wrongly believed the tool was missing treat raw links as a sanctioned fallback), and its results append a recovery nudge pointing finished visual work and browse requests back to display-review. When review is disabled, the description no longer mentions display-review at all — the tool is not registered in those sessions.
28 changes: 26 additions & 2 deletions agent-eval/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,23 @@ pnpm exec agent-eval cc-mcp-opus-high
Pull requests with the `ci:eval` label run all experiments in CI.

By default only the first core eval (`801-create-component-no-launch-config`)
runs. Set `EVAL_EXTRA_EVALS=1` to run the full hand-crafted 8xx eval line, or
`EVAL_ONLY=<name>[,<name>]` to debug specific core evals one at a time:
runs. Set `EVAL_EXTRA_EVALS=1` to run the full hand-crafted line — the 8xx
workflow evals on every experiment plus the lifecycle 82x evals
(`storybook-init`/`storybook-upgrade` scenarios) on the plugin experiments —
or `EVAL_ONLY=<name>[,<name>]` to debug specific evals one at a time:

```bash
EVAL_EXTRA_EVALS=1 pnpm eval
EVAL_ONLY=803-edit-component pnpm eval
```

A full `EVAL_EXTRA_EVALS=1` run (12 workflow evals × 4 experiments + 3
lifecycle evals × 2 plugin experiments) costs roughly **$30–45** in agent
tokens at current per-run averages ($0.30–0.80 per workflow eval, $1–2 per
lifecycle eval). The budget guardrail is **$75 per full run** — check the
usage metadata in the results playground before growing the eval set past it
(see storybookjs/mcp#324).

The 9xx evals (ports from the old `/eval` system) never run automatically; see
`lib/experiment.ts`.

Expand Down Expand Up @@ -121,6 +130,21 @@ Templates live in `agent-eval/templates/<template-name>` and are copied into the
sandbox during setup before the agent runs. They intentionally stay visible in
saved result project snapshots so eval runs are easy to inspect.

Three templates exist today:

- `reshaped-storybook`: the design-system shape — Reshaped components, full
Storybook (`next`) with the local addon builds, MSW, and the vitest story
test setup.
- `vite-app`: a minimal React + Vite app with **no Storybook at all**. The
lifecycle fixtures use it directly (820 init) or layer an old Storybook on
top (821/822 upgrades, which also set `evals.pinStorybook: false` so the
harness keeps their intentionally outdated versions); 812 layers a full
Storybook `next` setup with zero stories on top.
- `monorepo`: an npm-workspaces repo where the runnable Storybook lives in the
`packages/ui` leaf (the spec's monorepo-leaf project shape). Storybook
pinning and the local `file:` build detection cover workspace package.json
files too.

This keeps prompt variants small: each variant keeps its own `PROMPT.md`,
`EVAL.ts`, and metadata `package.json`, while shared app files stay in the
template.
Expand Down
24 changes: 24 additions & 0 deletions agent-eval/evals/801-create-component-no-launch-config/EVAL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import {
expectAllStoryExportsInDisplayReview,
expectDisplayReviewForVisualChange,
expectPreviewBrowserStarted,
expectSkillInvoked,
getEvalContext,
expectStoryDiscoveryBeforeReview,
expectStoryTestsRanAndPassed,
expectValidStorybookLaunchConfig,
expectWorkflowCalls,
} from '#test-utils';
Expand All @@ -27,6 +31,19 @@ test('uses Storybook story instructions and publishes a display review', () => {
expectDisplayReviewForVisualChange();
});

// Required workflow step (dev instructions "Mapping any input to story IDs"):
// story IDs in the review must come from a discovery tool, not from guessing.
test('discovers stories through the workflow tools before publishing the review', () => {
expectStoryDiscoveryBeforeReview();
});

// Required workflow step (test-instructions.md Validation Workflow): run
// run-story-tests after the change and do not report completion while story
// tests are failing.
test('runs story tests after the change and finishes with them passing', () => {
expectStoryTestsRanAndPassed({ covering: ['toggleswitch'] });
});

// Yann confirmed §6a.2 (2026-07-02, #sb-ade-plugins): stories the agent
// created must always appear in the review; curation groups, it never omits.
// The display-review hard rules and server instructions now state this.
Expand All @@ -49,6 +66,13 @@ test.skip('publishes a well-curated review', async () => {
// The fixture overrides the template's .claude/launch.json with an empty
// configurations array (fixtures can only overwrite files, not delete them),
// so the plugin must set up the Storybook launch entry itself.
// The plugin path must engage the stories skill (Claude: via the Skill tool;
// Codex: by reading its SKILL.md). Skipped on the MCP integration, where no
// skills are installed.
test.skipIf(getEvalContext().integration === 'mcp')('invokes the stories skill', () => {
expectSkillInvoked('stories');
});

test('writes a valid Storybook launch config for Claude preview tooling', () => {
expectValidStorybookLaunchConfig();
});
Expand Down
31 changes: 31 additions & 0 deletions agent-eval/evals/802-create-component/EVAL.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { test } from 'vitest';
import {
expectAllStoryExportsInDisplayReview,
expectDisplayReviewForVisualChange,
expectPreviewBrowserStarted,
expectSkillInvoked,
getEvalContext,
expectStoryDiscoveryBeforeReview,
expectStoryTestsRanAndPassed,
expectValidStorybookLaunchConfig,
expectWorkflowCalls,
} from '#test-utils';
Expand All @@ -14,6 +19,32 @@ test('uses Storybook story instructions and publishes a display review', () => {
expectDisplayReviewForVisualChange();
});

// Same clean-project create scenario as 801, so the §6a.2 completeness rule
// applies identically: every story the agent created must appear in the review.
test('every new story appears in the display review', () => {
expectAllStoryExportsInDisplayReview();
});

// Required workflow step (dev instructions "Mapping any input to story IDs"):
// story IDs in the review must come from a discovery tool, not from guessing.
test('discovers stories through the workflow tools before publishing the review', () => {
expectStoryDiscoveryBeforeReview();
});

// Required workflow step (test-instructions.md Validation Workflow): run
// run-story-tests after the change and do not report completion while story
// tests are failing.
test('runs story tests after the change and finishes with them passing', () => {
expectStoryTestsRanAndPassed({ covering: ['profilecard'] });
});

// The plugin path must engage the stories skill (Claude: via the Skill tool;
// Codex: by reading its SKILL.md). Skipped on the MCP integration, where no
// skills are installed.
test.skipIf(getEvalContext().integration === 'mcp')('invokes the stories skill', () => {
expectSkillInvoked('stories');
});

test('keeps the pre-existing Storybook launch config valid', () => {
expectValidStorybookLaunchConfig();
});
Expand Down
24 changes: 24 additions & 0 deletions agent-eval/evals/803-edit-component/EVAL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import { test } from 'vitest';
import {
expectDisplayReviewForVisualChange,
expectPreviewBrowserStarted,
expectSkillInvoked,
getEvalContext,
expectStoryDiscoveryBeforeReview,
expectStoryIdsInDisplayReview,
expectStoryTestsRanAndPassed,
expectValidStorybookLaunchConfig,
expectWorkflowCalls,
} from '#test-utils';
Expand All @@ -21,6 +25,26 @@ test('the review covers the edited ReviewCard component', () => {
expectStoryIdsInDisplayReview(['reviewcard']);
});

// Required workflow step (dev instructions "Mapping any input to story IDs"):
// story IDs in the review must come from a discovery tool, not from guessing.
test('discovers stories through the workflow tools before publishing the review', () => {
expectStoryDiscoveryBeforeReview();
});

// Required workflow step (test-instructions.md Validation Workflow): run
// run-story-tests after the change and do not report completion while story
// tests are failing.
test('runs story tests after the change and finishes with them passing', () => {
expectStoryTestsRanAndPassed({ covering: ['reviewcard'] });
});

// The plugin path must engage the stories skill (Claude: via the Skill tool;
// Codex: by reading its SKILL.md). Skipped on the MCP integration, where no
// skills are installed.
test.skipIf(getEvalContext().integration === 'mcp')('invokes the stories skill', () => {
expectSkillInvoked('stories');
});

test('keeps the pre-existing Storybook launch config valid', () => {
expectValidStorybookLaunchConfig();
});
Expand Down
24 changes: 24 additions & 0 deletions agent-eval/evals/804-write-story-for-existing-component/EVAL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import { test } from 'vitest';
import {
expectDisplayReviewForVisualChange,
expectPreviewBrowserStarted,
expectSkillInvoked,
getEvalContext,
expectStoryDiscoveryBeforeReview,
expectStoryIdsInDisplayReview,
expectStoryTestsRanAndPassed,
expectValidStorybookLaunchConfig,
expectWorkflowCalls,
} from '#test-utils';
Expand All @@ -22,6 +26,26 @@ test('the review covers the new AlertBanner stories', () => {
expectStoryIdsInDisplayReview(['alertbanner']);
});

// Required workflow step (dev instructions "Mapping any input to story IDs"):
// story IDs in the review must come from a discovery tool, not from guessing.
test('discovers stories through the workflow tools before publishing the review', () => {
expectStoryDiscoveryBeforeReview();
});

// Required workflow step (test-instructions.md Validation Workflow): run
// run-story-tests after the change and do not report completion while story
// tests are failing.
test('runs story tests after the change and finishes with them passing', () => {
expectStoryTestsRanAndPassed({ covering: ['alertbanner'] });
});

// The plugin path must engage the stories skill (Claude: via the Skill tool;
// Codex: by reading its SKILL.md). Skipped on the MCP integration, where no
// skills are installed.
test.skipIf(getEvalContext().integration === 'mcp')('invokes the stories skill', () => {
expectSkillInvoked('stories');
});

test('keeps the pre-existing Storybook launch config valid', () => {
expectValidStorybookLaunchConfig();
});
Expand Down
97 changes: 97 additions & 0 deletions agent-eval/evals/808-shared-infra-fallback/EVAL.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import { readFileSync } from 'node:fs';
import { expect, test } from 'vitest';
import {
expectDisplayReviewForVisualChange,
expectPreviewBrowserStarted,
expectSkillInvoked,
expectStoryDiscoveryBeforeReview,
expectStoryIdsInDisplayReview,
expectStoryTestsRanAndPassed,
expectValidStorybookLaunchConfig,
getEvalContext,
getWorkflowCalls,
getWorkflowToolResults,
} from '#test-utils';

// Shared-infrastructure change (Agentic Review Eval instructions §7 branch 2):
// the edited token file has no stories of its own, so the review must surface
// the stories of its *consumers* (Badge and StatusPill).

// Guard against a vacuous pass: skipping the fallback only counts if the token
// change was actually performed.
test('changes the accent color token', () => {
const colors = readFileSync('src/theme/colors.ts', 'utf8');
expect(colors, 'Expected the accent token to change to #7c3aed').toMatch(/#7c3aed/i);
expect(colors, 'Expected the old accent value #2563eb to be gone').not.toMatch(/#2563eb/i);
});

test('publishes a display review for the visual token change', () => {
expectDisplayReviewForVisualChange();
});

test('the review surfaces the consumer stories, not the token file', () => {
expectStoryIdsInDisplayReview(['badge', 'statuspill']);
});

test('discovers stories through the workflow tools before publishing the review', () => {
expectStoryDiscoveryBeforeReview();
});

// The get-stories-by-component fallback is required exactly when the diff
// alone is insufficient (spec §4 "when to switch"): the token file is not a
// component, so unless get-changed-stories already surfaced both consumers,
// the agent must resolve them via get-stories-by-component.
// Deliberately conditional, not unconditional: on the MCP path the module
// graph's related-stories detection can legitimately surface both consumers
// from the diff alone (observed in the 2026-07-02 cc-mcp QA run — one
// get-changed-stories call covering badge + statuspill, zero fallback calls),
// and punishing that correct behavior would fight the spec.
test('falls back to get-stories-by-component when the diff does not cover the consumers', () => {
const changedStoriesResults = getWorkflowToolResults('get-changed-stories');
const lastChangedStories = changedStoriesResults.at(-1);
const diffCoversConsumers =
lastChangedStories !== undefined &&
!lastChangedStories.isError &&
/badge/i.test(lastChangedStories.output) &&
/statuspill/i.test(lastChangedStories.output);

if (diffCoversConsumers) {
return;
}

expect(
getWorkflowCalls('get-stories-by-component').length,
'get-changed-stories did not surface the consumer stories, so get-stories-by-component must be used',
).toBeGreaterThan(0);
});

// Required workflow step (test-instructions.md Validation Workflow): run
// run-story-tests after the change and do not report completion while story
// tests are failing.
// Accepted known failure — MCP-path agents skip validation for shared-token
// edits: the Validation Workflow section is lost to the 2,048-char MCP
// server-instruction truncation that PR #320 addresses (0 run-story-tests
// calls in the 2026-07-02 cc-mcp QA run, while the same fixture passes on
// cc-plugin and codex-plugin). Gated to the plugin integration; re-enable on
// the MCP path once #320 lands.
test.skipIf(getEvalContext().integration === 'mcp')(
'runs story tests after the change and finishes with them passing',
() => {
expectStoryTestsRanAndPassed({ covering: ['badge', 'statuspill'] });
},
);

// The plugin path must engage the stories skill (Claude: via the Skill tool;
// Codex: by reading its SKILL.md). Skipped on the MCP integration, where no
// skills are installed.
test.skipIf(getEvalContext().integration === 'mcp')('invokes the stories skill', () => {
expectSkillInvoked('stories');
});

test('keeps the pre-existing Storybook launch config valid', () => {
expectValidStorybookLaunchConfig();
});

test('opens the preview browser when using the plugin', () => {
expectPreviewBrowserStarted();
});
1 change: 1 addition & 0 deletions agent-eval/evals/808-shared-infra-fallback/PROMPT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Change the accent color token in `src/theme/colors.ts` from blue (`#2563eb`) to violet (`#7c3aed`). It is shared styling infrastructure used across our components.
7 changes: 7 additions & 0 deletions agent-eval/evals/808-shared-infra-fallback/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "808-shared-infra-fallback",
"type": "module",
"evals": {
"template": "reshaped-storybook"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import type { ReactNode } from 'react';
import { accentColor, accentContrastColor, neutralColor } from '../theme/colors';

export type BadgeProps = {
children: ReactNode;
variant?: 'accent' | 'neutral';
};

export default function Badge({ children, variant = 'accent' }: BadgeProps) {
const background = variant === 'accent' ? accentColor : neutralColor;

return (
<span
data-testid="badge"
style={{
backgroundColor: background,
color: accentContrastColor,
borderRadius: 999,
display: 'inline-block',
fontSize: 12,
fontWeight: 600,
padding: '2px 10px',
}}
>
{children}
</span>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { accentColor, neutralColor } from '../theme/colors';

export type StatusPillProps = {
label: string;
active?: boolean;
};

export default function StatusPill({ label, active = false }: StatusPillProps) {
const border = active ? accentColor : neutralColor;

return (
<span
data-testid="status-pill"
style={{
border: `2px solid ${border}`,
color: border,
borderRadius: 6,
display: 'inline-block',
fontSize: 13,
padding: '4px 12px',
}}
>
{label}
</span>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Shared design tokens. This file has no stories of its own; components
// consume these values.
export const accentColor = '#2563eb';
export const accentContrastColor = '#ffffff';
export const neutralColor = '#6b7280';
Loading
Loading