Testing / Evals

Sero uses repository tests and promptfoo evals as separate quality signals. Not every suite runs for each pull request. Run real LLM evals only when their provider cost and credentials are intentional.

Current root command surface

pnpm typecheck
pnpm build
pnpm test
pnpm test:ci
pnpm eval:snapshot
pnpm eval
pnpm eval:view

pnpm test runs turbo run test. Use the root commands above as the supported entry points.

CI workflows

The Test workflow runs for pushes to main, pull requests to main, and manual dispatch. It classifies changed paths. The affected jobs run pnpm typecheck, pnpm build, and pnpm test.

The root pnpm test:ci command also runs pnpm e2e:contract, but the Test workflow does not call that root command. The separate E2E Contract and E2E Agent workflows run each day and by manual dispatch. E2E Workflow is manual-only. No workflow runs pnpm eval or pnpm eval:snapshot.

Evals command reference

CommandSource scriptWhen to useCost/auth
pnpm eval:snapshotnode eval/patch-drizzle.cjs && node scripts/run-promptfoo.mjs eval --config eval/promptfoo-snapshot.yaml --no-cacheFast prompt assembly/cache drift checkNo live LLM calls; low/no provider cost.
pnpm evalnode eval/patch-drizzle.cjs && node scripts/run-promptfoo.mjs evalReal agent behavior checksRequires credentials and may cost money.
pnpm eval:viewnode scripts/run-promptfoo.mjs viewInspect saved promptfoo resultsNo new model calls.

Snapshot evals

Snapshot evals use eval/promptfoo-snapshot.yaml and eval/snapshotProvider.ts. They assemble an approximation of the full Sero session prompt from real prompt-building functions and check:

  • SDK/base prompt block presence
  • CLI prompt block presence
  • container/subagent prompt guidance where applicable
  • prompt block ordering for cache stability
  • full prompt size against baseline
  • metadata completeness

Run snapshot evals before committing changes to prompt assembly, CLI instructions, container prompt blocks, subagent guidance, or session setup.

Real LLM evals

Real evals use promptfooconfig.yaml and eval/seroProvider.ts. They run through promptfoo with actual model calls. The default config uses the Sero provider with a 120s timeout and an Anthropic grading provider for rubric assertions.

Auth/cost notes:

  • pnpm eval can consume paid provider tokens.
  • It expects provider credentials such as ANTHROPIC_API_KEY from the shell or eval environment handling.
  • The eval provider can apply env credentials as runtime API-key overrides before falling back to ~/.sero-ui/agent/auth.json.
  • Do not run live evals in CI or on PRs unless budget and credentials are explicitly intended.

Scenario matrix

Scenario fileTestsModeCoverage
eval/scenarios/prompt-stability.yaml7SnapshotPrompt block presence, ordering, size, and metadata.
eval/scenarios/file-ops.yaml3Real LLMCreate/read/edit file behavior and latency.
eval/scenarios/coding-tasks.yaml3Real LLMTypeScript/React generation, null-safety fixes, utility generation.
eval/scenarios/cli-ops.yaml4Real LLMsero-cli use for todos, workspace info, batch commands, and VCS status.

To add scenarios, create/edit a YAML file under eval/scenarios/ and add it to the relevant promptfoo config.

Failure interpretation

FailureLikely next step
Snapshot says a block is missingInspect prompt assembly source and confirm the block is still intentionally included.
Snapshot ordering failsTreat as cache-sensitive; confirm the prompt order change was intentional.
Prompt size growth failsRemove accidental verbosity or update the baseline with an intentional prompt change.
pnpm eval auth failsCheck env credentials and stale profile auth under ~/.sero-ui/agent/auth.json.
Real eval times outInspect provider latency and scenario complexity; adjust timeout only when justified.
Tool-sequence assertion failsInspect context.providerResponse.metadata.toolCalls in the result viewer.
LLM rubric failsRead the output; rubrics are useful but can be noisy.

Relationship to other tests

Risk areaBest current signalNotes
Prompt assembly / cache stabilitypnpm eval:snapshotLow-cost check for prompt block drift, ordering drift, and size regressions.
Agent file-editing behaviorpnpm evalExercises real tool use in isolated temp workspaces.
Agent CLI usage patternspnpm evalChecks that the agent prefers sero-cli in supported scenarios.
Desktop startup/session wiringdesktop Vitest + Playwright CINot primarily an eval concern.
Plugin/runtime bridge regressionspackage tests + focused e2eBetter covered by targeted source tests.
Container lifecycle/full-render UXlocal/manual Playwright runsEnvironment-sensitive and not a generic promptfoo check.