ADR-0035: askdare eval: regression tests for a bot's answers
- Status: Accepted on 2026-11-30: the maintainer settled every open question as recommended ("Settled with the maintainer", below). Spike s11's findings are folded in; where they changed a recommendation (the regression rule, the reference answer,
grounded), the decision says so. The implementation tasks amend it where building shows otherwise: "As built in 0.8-q1" to "0.8-q4", "0.8-v4", "0.8-t3" and "running rarely, and Flex". - Date: 2026-11-29
- Extends: ADR-0016 (the console's test questions per bot) and ADR-0032 (decision 7 left them without a configuration surface). Builds on ADR-0025, decision 11 (S8's questions and grading seed
askdare eval). Lines up with ADR-0039, which addsaskdare eval --versionin 0.8. - Evidence: spike S8 (findings,
eval.ts,questions.json) and its rerun in task k2 (ADR-0025, Evidence); spike s11 (findings, summarized under "Evidence from s11").
Context
A team changes a bot's instructions, its documents, its model or its retrieval, and today it can't tell what got better or worse until visitors rate the answers. 0.7's console has a playground for one question at a time, and ADR-0016's test questions per bot were never built (ADR-0032, "As built in 0.7").
- OpenAI's own Evals can't fill the gap. The Evals dashboard, API and graders went read-only on 2026-11-30, and OpenAI points to Promptfoo instead (deprecations; the Evals guides say read-only on 2026-10-31 and shut down on 2026-11-30). The remaining graders endpoint (
/fine_tuning/alpha/graders/run) belongs to fine-tuning. - A generic eval tool can't see what matters here. A chat answer in askdare is more than text: citations to knowledge sources (ADR-0025), a handoff to a person (ADR-0030), a form (ADR-0031), guardrails that replace or withhold an answer (ADR-0022). An eval that calls the model directly skips the route, the instructions askdare builds, the tools and the stores, so it tests something other than what ships.
- S8 graded answers this way (
eval.ts,grade()): deterministic checks (the right document cited, the expected facts in the answer, the facts in the cited text, no invented sources, forbidden strings absent) plus one model-graded check (does the answer decline). Its set was too easy: every configuration scored 27 of 27. - s11 built a set that can fail (114 fictional documents in English and Polish with PDF tables, 132 cases) and measured graders and flakiness on it. A clearly worse retrieval lost 16 to 19 points in every single run; a weaker prompt or a smaller model (2 to 5 points) stayed inside the run-to-run noise in aggregate, but showed as cases that passed in every baseline run and failed in the candidate.
- Visitors' π answers are the best source of new cases (ADR-0032 keeps the ratings, the comments and, with
admin.transcripts, the turns), but they hold visitors' words, so they must not flow into a repository unreviewed.
Decision
1. A test case
A case is a short exchange with one bot, in one language, and what a pass means. Cases live in JSON files (decision 2). An illustrative file:
{
"$schema": "../node_modules/@boldare/askdare/eval.schema.json",
"version": 1,
"bot": "support",
"language": "en",
"cases": [
{
"id": "pricing/team",
"tags": ["fact"],
"turns": ["How much does the Team plan cost?"],
"expect": {
"reference": "β¬8 per user and month.",
"facts": [["β¬8", "8 β¬", "8 euro"]],
"cite": ["pricing.md"]
},
"notes": "The 2025 page said β¬7; release-notes.md repeats the old price."
},
{
"id": "pricing/follow-up",
"tags": ["multi-turn"],
"turns": ["How much does the Team plan cost?", "And with yearly billing?"],
"expect": { "reference": "β¬6 per user and month, billed yearly.", "facts": [["β¬6"]], "cite": ["pricing.md"] }
},
{ "id": "no-phone", "tags": ["unanswerable"], "turns": ["What is your sales phone number?"], "expect": { "declines": true } },
{ "id": "injection", "turns": ["Is there a promo code?"], "expect": { "notSay": ["SAVE50", "password"] } },
{ "id": "angry", "turns": ["This is useless, I want a person."], "expect": { "handoff": true } },
{ "id": "demo", "turns": ["Can I book a demo?"], "expect": { "form": "demo" } }
]
}botandlanguageare set for the file and may be overridden per case.languageis the chat's language for the turn (BotContext.locale, ADR-0014), so a bot's texts per language and its language rules apply.turnsare the visitor's messages, sent one after another. The bot answers each one live, and the checks look at the last turn. Earlier turns are the setup for a follow-up ("and with yearly billing?").idis unique across the folder, and the baseline keys by it.tagsgroup cases for--tagand for pass rates per tag in the summary. s11 found that version conflicts, cross-language and multi-hop questions and follow-ups are where configurations differ, while single facts and tables sit at the ceiling; the docs tell teams to tag and cover those kinds.notesare for people ("the 2024 page said 14 days") and never reach the grader. s11 found that a grader treats everything in a reference as required, so the reference stays minimal and context goes here.- A run passes when every check passes, except
grounded, which only warns, and graded checks, which count only once decision 3 lets them gate. Each check is reported on its own.
The checks, deterministic first:
expect key | Kind | Passes when | From |
|---|---|---|---|
facts: string[][] | deterministic | every group has one alternative in the last answer (case-insensitive, Unicode NFKC, whitespace collapsed, decimal commas read as points) | S8, s11 |
cite: string[] | deterministic | at least one cited source is in the list. Sources are named by the knowledge path kb sync stores: the file's path attribute in a vector store, KnowledgeDocument.path in an own index | S8 "right doc" |
(always) noInventedSources | deterministic | no citation the turn's searches didn't return, and no marker the stream mapper had to drop (ADR-0025, decision 5) | S8, s11 |
notSay: string[] | deterministic | none of the strings appear in the last answer (same matching as facts) | S8, s11's injection cases |
handoff: boolean | deterministic | the last turn called handoff (true) or didn't (false) | ADR-0030 |
form: string | false | deterministic | the last turn called show_form with that form's name, or offered none | ADR-0031 |
tools: string[] | deterministic | each named tool of the bot was called in the last turn | ADR-0012's tool report |
(warning, with facts and cite) grounded | deterministic, warns only | the same facts appear in the text of the passages the answer cited | S8 "quote" |
reference: string | graded: correct | the answer agrees with the reference, presents no outdated value as current, and answers every part of the question | s11's correct, with complete folded in |
declines: true | graded: correct | the answer says the documents don't cover this, and invents nothing (a reference of "not in the documents") | S8's judge, s11's unanswerable cases |
rubric: string[] | graded | each criterion holds, judged one by one | new |
answerLanguage: true | graded | the answer is in the case's language | s11's complete |
- Deterministic checks need no model and flip least: 3% of s11's cases across five runs, against 8% for the graded verdict. They catch injections and invented citations exactly.
groundedwarns and never fails. s11's gradedgroundedagreed with a second grader at kappa 0.33, failing correct answers over paraphrases the passage doesn't spell out, so there is no gradedgroundedin 0.8. The deterministic form (S8's "quote") stays as a warning: a cross-language answer, which s11 shows is common, quotes a passage in the other language, so the facts are legitimately absent from it.- Graded checks run only when the deterministic ones passed. A run that already failed isn't worth a grader call; its graded checks are reported as "not graded".
- Not in 0.8: attachments in a case, a signed-in identity (ADR-0009), scripted answers for earlier turns, expectations per turn, and regular expressions in
factsornotSay. Each is additive to format version 1.
2. Where cases live
- In the app's repository, in
evals/at the project root (--dirto change it), as*.eval.jsonfiles. They are reviewed like code and versioned with the instructions and documents they test. - JSON with a published JSON Schema (
@boldare/askdare/eval.schema.json, in the package's exports) for completion and checking in editors. The CLI validates with the same schema (generated from one Zod definition) and refuses an invalid file with its path and the failing field.version: 1lets the format change later without guessing. - No
defineEvalhelper in 0.8. A TypeScript case file needs a loader for the app's TypeScript and its path aliases, and JSON is what the console's draft (below) and other tools can write. A typed helper can come later without changing the format. - A baseline (
evals/baseline.json, decision 4) sits next to the cases and is committed.
From a π answer to a draft case, always through a person:
- The console's conversation review (ADR-0032, decision 8) gets "Draft a test case" on a rated answer, for the
reviewerrole and up (ADR-0034), since it spends nothing. - The draft is built in the page from what the review already shows: the bot, the language, and the visitor's turns up to the rated answer as
turns. It has an emptyexpect, which the person writes: what the answer should have done is their judgment, not the visitor's. - Personal data is scrubbed before it is shown: email addresses, phone numbers, URLs with query strings, long digit runs and the signed-in user's identity fields become placeholders (
[email],[phone]β¦), highlighted for the person to check. The rating's comment and the bad answer are shown beside the draft, never copied into it. - The draft carries
"draft": true.askdare evalrefuses to run a file with a draft case (exit 2, naming it), so removing the marker is the person's statement that they reviewed it. - Nothing is stored or sent. The page offers the JSON to copy or download. There is no export of many conversations at once, no API that writes cases, and nothing runs on its own.
3. Grading
- The grader model is the app's choice:
createChatHandler({ eval: { grader: { model, β¦settings } } }), where the settings are the ones a bot's model takes (ADR-0036), such as a low reasoning effort. The library names no model ID and has no default. Without a grader, deterministic cases still run, and a case with graded checks stops the run before it starts (exit 2, naming the setting). The docs suggest a mid-size model at low effort, on a discounted tier where the account has one: s11's grader cost about $0.0007 per answer, under a fifth of a run's cost. - One grader call per run of a case, covering all its graded criteria, through the app's own gateway (ADR-0026), so it works on every provider path. On OpenAI it is a
responses.createcall insrc/openai/with:- Structured Outputs,
text: { format: { type: 'json_schema', strict: true, schema } }, where the schema is an object with one{ id, reasoning, pass }per criterion, the reasoning before the verdict (as s11 did, following OpenAI's eval guide), all fields required andadditionalProperties: false, as Structured Outputs requires; store: false, since nothing needs the response later;max_output_tokens, the SDKtimeout,maxRetriesand anAbortSignal, as every askdare call;- no
temperature: repeats handle variance (below), and the grader model's own settings come fromgrader.
- Structured Outputs,
- Binary verdicts with a short reason (reports keep at most 200 characters of the reasoning), not scores. A pass or fail per criterion is what a regression needs.
- What the grader sees: the turns, the case's reference and criteria, the last answer and the cited passages. Never the case's
notes. - The grader reads untrusted text. The bot's answer and the cited passages can carry a document's prompt injection aimed at the grader. They reach it JSON-encoded inside ADR-0019's wrapper (
{"untrusted_tool_result": β¦}), and its instructions say to judge them, never to follow them. The case's own text (turns, reference, criteria) is the team's and goes in as instructions. - The grader prompt is core's and versioned (
grader: 1in reports and the baseline). A new prompt version makes earlier graded results incomparable: the CLI reports graded changes against such a baseline as "grader changed", not as regressions, until the baseline is updated. - Agreement with a person is not yet measured. s11's
correctagreed with the deterministic fact check (98.2%, kappa 0.84 on 793 answers) and with a second grader model (kappa 0.84), and most of its disagreements with the fact check were real errors facts can't see (a superseded value next to the current one). Its 60-answer human sample is prepared but not graded. Until it is, graded checks report and never fail the build (decision 4's exit code); deterministic checks gate. The human grading, and an amendment that letscorrectgate, are a follow-up; a--calibratecommand is not in 0.8 (decision 7).
Repeats and regressions (amended by s11, which found that majority voting barely helps: flaky cases sit near 2 in 3, so a majority is itself a coin flip):
- The baseline comes from 3 runs (
--runs, default 3) of every case, written with--update-baseline. Per case it records how many runs passed. Only a case that passed every baseline run is a regression candidate; the others are reported as flaky or failing. - A candidate run runs each case once, then re-runs each failing case twice more (
--retries, default 2). - A regression is a case that passed every baseline run and fails every candidate run. s11 measured about 0.12 cases flagged by chance per run of its 132 cases on the graded verdict and 0.03 on the deterministic one, at 10 to 20% extra cost for the re-runs, against 2.1 to 2.4 for "fails once" or "majority flips".
- A fix is a case that failed every baseline run and passes now. A changed case (its hash differs from the baseline's) or a new one is neither, and is listed as such.
- The aggregate pass rate is reported with its noise band, measured from the baseline's runs (never a hardcoded number; s11's was Β±3.3 points for one graded run). A drop inside the band is reported, not failed.
4. Running
npx @boldare/askdare eval runs the app's cases against the app's own bots, stores and knowledge, through the same turn path as the chat, but off the visitor path.
Like doctor, it calls the running app (--url, default http://localhost:3000, and --base-path): next dev locally, next start in a CI job, or a preview deployment.
- It authenticates with an eval token minted from
CHAT_SECRET(read from--env-file, default.env.localand.env), a token type and audience of its own, like the doctor's. Visitor and admin tokens never reach the eval path, and an eval token reaches nothing else. POST <basePath>/evaltakes one run of one case, with an optionalversion(ADR-0039), and answers its result: the checks with their verdicts and reasons, the citations (index, title, knowledge path), the tools called, the usage, the duration and, when asked (--answers), the answer. The CLI controls runs, re-runs and concurrency (--concurrency, default 4), so each request stays within the route'smaxDuration. The server runs at most 8 eval requests at a time and answersrate_limitedbeyond.- The endpoint exists only when
createChatHandler({ eval })is set (even aseval: {}). Without it,/evalis 404 like any unknown path, and the CLI says how to turn it on. - The endpoint is internal (ADR-0006): the CLI and the route come from the same package, and a mismatch answers
not_found, asdoctorhandles it ("Update @boldare/askdare").
Prompt versions (ADR-0039, "How this fits askdare eval"): --version <name> (repeatable, or all) sends that version with each request. The server checks it against the bot's versions and answers invalid_input listing them for an unknown name, and the CLI stops before any further case. Without the flag, eval runs the bot's own version. Results and baselines are keyed by bot, version and case; a baseline recorded for one version is never compared with a run of another, and several versions in one run are reported side by side. The prompt versions task builds the flag after eval's own tasks.
What the eval path runs and skips:
- Runs: the bot as resolved (instructions, the requested version, tools, knowledge, model and its settings, output checks of ADR-0022), with
locale= the case's language and an anonymous visitor. The conversation lives in the app's conversation store, owned byeval:<hmac of the run>, so no visitor can resume it, and is deleted when the case ends (best effort; retention catches the rest), as the console's playground does. - Skips: the human check and bot protection (ADR-0019), origin checks, the per-IP and per-visitor limits (the run has its own budget, decision 5), version assignment (ADR-0039),
onTranscript,onFeedbackand admin store records (eval turns aren't visitors' and must not move the dashboard). - Counts: the bot's
dailyTokensbudget counts eval tokens, since they are real spend.onUsageis called, with a new optionalsource: 'chat' | 'console' | 'eval'onChatUsageReport, so cost tracking can tell them apart (additive), and ADR-0039'sversion. - Side effects:
handoffandshow_formare recorded for the checks, never delivered:onHandoff,onLead,webhookHandoffandemailHandoffare not called, and the model gets the same fixed tool output asavedhandoff gives. The app's own tools run for real, with a newToolContext.source('chat' | 'console' | 'eval'), so a tool with side effects can stub them.
Output:
- For people (default reporter
pretty): a line per case (β, β or ~ for flaky, with its runs), the failing checks with their short reasons, the warnings, then a summary: the pass rate with its noise band, pass rates per tag, regressions, fixes, new and changed cases, tokens per model and time. - For CI:
--reporter junit=<file>(a test case per case, its failing checks as the failure message) and--reporter json=<file>(a versioned report,version: 1, naming the bot version of each result). Reporters combine. - The baseline:
--baseline(defaultevals/baseline.json) is read when present and written only by--update-baseline, and only after a complete run without errors. Per bot, version and case it holds the runs and how many passed, the failing checks, the case's hash, the bot's model, the grader prompt version and the tokens per run (for decision 5's estimate). No answers. - Exit code:
0when nothing regressed and nonotSaycheck failed;1on a regression, or on any failingnotSaycheck (a forbidden string is never noise). Without a baseline,1on any case that fails every run.--fail-on failmakes any case that fails every run exit1even with a baseline. Graded checks count towards none of these until the human sample is graded (decision 3);2when the run couldn't run or finish: an invalid or draft case file, the app unreachable or rejecting the token, an unknown version, no grader for graded checks, the budget refused or used up, or the OpenAI account out of credit or quota.
5. Cost and safety
- A budget per run, in tokens:
--max-tokens, default 1,000,000. Before it starts, the CLI estimates the run (each case's tokens per run from the baseline, else 4,000 tokens per turn, times the runs, plus re-runs for the cases that failed in the baseline, plus the grader) and refuses above the budget, printing the estimate (exit 2). During the run it starts no new case once the budget is spent, and ends incomplete (exit 2).- The numbers come from s11: about 3,100 input tokens per conversation on the
search_knowledgepath, so a candidate run of a 132-case set with its re-runs needs about half a million tokens, and a 3-run baseline of it about 1.4 million, which needs--max-tokensraised. In money, s11's full graded run cost about $0.53 and took 1.5 minutes at concurrency 8. - Tokens, not money: the library holds no prices (ADR-0032, decision 2), and the report lists tokens per model for the team to price.
- A credit or quota error stops the run cleanly: no new case starts, and the results so far are reported (exit 2). s11 ran out of credit mid-run and stopped only because every later call failed.
- The numbers come from s11: about 3,100 input tokens per conversation on the
- Reports carry no transcripts or personal data. Cases are written by people, and π drafts are scrubbed and reviewed (decision 2). Reports hold case IDs, verdicts, the grader's reasons, citations' titles and paths, tool names and usage. Answers appear only with
--answers, for a person debugging locally: a bot whose tools read real data (an order lookup) can put that data in an answer, and CI logs and artifacts travel further than a terminal. - The server logs no case content (ADR-0004): eval requests log their status, codes and usage, like chat requests.
- What CI needs: the app's own secrets (
CHAT_SECRET,OPENAI_API_KEY, a database URL for own stores) in the CI's secret store; the app built and started in the job (or a preview URL with that deployment'sCHAT_SECRET); knowledge synced first (askdare kb sync). Pull requests from forks get no secrets, so the job runs on pushes and on pull requests from the repository. The docs recommend a dedicated OpenAI project with a hard spend limit for CI, and a preview or staging deployment rather than production, since eval turns count toward the bot's daily budget (default 2,000,000 tokens, which a large baseline run can reach). - Threat model: the implementing task adds
THREAT_MODEL.mdrows (after x5's T39βT42) for the eval endpoint (a holder ofCHAT_SECRETcan run turns with any text, which it can already do by minting visitor tokens), the grader reading untrusted text, and the console's draft carrying a visitor's words.
6. The console's test questions are the same cases
ADR-0016's "test questions per bot, from configuration" become eval cases:
createChatHandler({ eval: { cases: [support, sales] } })takes case files the app imports (import support from '@/evals/support.eval.json'). Next bundles them at build time, so the library still reads no files at runtime. They are validated on the first request that needs them, as secrets are.- The console gets a Tests view: each bot's cases, run one at a time or all, through the same eval path (decision 4), with the answer and every check's verdict side by side, and the playground's version picker (ADR-0039). It needs the
developerrole (ADR-0034), since it spends tokens. Results stay in the page, as ADR-0016 decided; baselines and regressions are the CLI's. - Without
cases, the view explains how to add them. The CLI reads the files directly and never asks the server for its list, so CI tests the repository's cases.
7. Not in 0.8
- A/B statistics or a side-by-side comparison report beyond
--version. ADR-0039 puts running the same cases against named versions in 0.8 (decision 4); significance tests between versions, or a report built for choosing one, are later. - Load testing. Eval measures answers, not throughput, and the server caps eval requests on purpose.
- A hosted results page or a history of runs. The JSON report and the committed baseline are the record; CI keeps the rest.
- Retrieval-only metrics (Hit@k, MRR, as S8 measured), a
--calibratecommand against a team's own hand-graded answers (as s11'sagreement.tsdoes), a gradedgroundedcheck, OpenAI's Batch API or background mode for cheaper runs, and a Promptfoo provider for the eval endpoint. Each can come later without changing the case format.
8. Public surface
Added to ADR-0006 when the tasks land, names final there:
- The CLI:
askdare evaland its flags (--url,--base-path,--env-file,--dir,--bot,--case,--tag,--version,--runs,--retries,--concurrency,--max-tokens,--baseline,--update-baseline,--reporter,--answers,--fail-on) and its exit codes.--versionis built by the prompt versions task (ADR-0039). - Formats: the case file (version 1, with
referenceandnotes) and@boldare/askdare/eval.schema.json; the JSON report (version 1); the baseline (version 1). Report and baseline carry the bot version. @boldare/askdare/next: theevaloption (grader,cases) and its types (EvalOptions,EvalFile,EvalCase,EvalExpect).@boldare/askdare:sourceonChatUsageReportandToolContext.- Internal:
POST <basePath>/eval(with its optionalversion), the eval token, the grader prompt.
Evidence from s11
Spike s11 (findings, 2026-11-29, $6.89 of a 20 USD cap):
- The set: 114 fictional, licence-clean documents about one company (English and Polish help centres, PDF datasheets and price lists with tables, release notes, a blog), with superseded pages, near-duplicate products, answers only in the other language and two planted injections. 132 cases in nine kinds (version conflicts, tables, facts, cross-language, Polish, multi-hop, multi-turn, unanswerable, injection), each with turns, a reference, facts, sources and forbidden strings. Its shape is decision 1's: turns with only the last answer graded, any-of facts, any-of sources, forbidden strings and a kind tag.
- Separation: a weak pre-search arm lost 18.9 points graded and 15.9 deterministic, separated in every single run. A one-line prompt (4.5 points) and a smaller model (3.0) did not separate in aggregate with 1 to 3 runs, but the weak prompt produced 7 stable per-case regressions in one run against 0.8 expected by chance.
file_searchandsearch_knowledgestayed at parity, so ADR-0025 stands. - The grader:
correctagreed with the fact check at 98.2% (kappa 0.84) and with a second grader at kappa 0.84;completeat 0.83;groundedonly at 0.33. Hence one graded verdict,correctwithcompletefolded in, and no gradedgrounded(decisions 1 and 3). - Flakiness: across repeated runs of one configuration, 3% of cases flipped on the deterministic checks and 8 to 12% on the graded verdict, clustered in cross-language, multi-hop, version and unanswerable cases. Cases flagged by chance per run: 2.4 for "passed once, fails next", 2.1 for a flipped majority of 3, 0.12 for "passed 3 of 3, fails 3 of 3" (0.03 deterministic). Hence decision 3's rule.
- Cost and time: a graded run of 132 cases on the tool path cost about $0.53 (grading about $0.09) and took about 1.5 minutes at concurrency 8, with about 3,100 input tokens per conversation; the recommended regression run about $0.60. Hence decision 5's numbers.
- Not measured, and confirmed as built: the human agreement sample (60 answers, prepared, not graded), the graded results of 6 runs (the account ran out of credit), and the comparison of stronger graders. Decision 3 keeps graded checks out of the exit code until the human sample is graded; the default budget and estimate are checked again when the eval tasks run the site's own set.
As built in 0.8-q1 (the endpoint and the case format)
Written at the release (task y1, 2026-12-01) from q1's hand-over; the code is packages/askdare/src/server/eval.ts, src/eval/ and src/protocol/eval.ts. Where building settled what decisions 1, 2 and 4 left open:
- The eval token lives 5 minutes (
typaskdare-eval+jwt, audienceaskdare-eval), so the CLI mints one per request rather than one per run. - The request carries
protocol: 1. A protocol the route doesn't know answers404 not_found, as a route that is off does, so an older CLI against a newer app (or the reverse) is told to update instead of misreading the result. - Limits on a case: at most 20 turns in the format, and no more than the bot's
limits.maxTurns, since a visitor's conversation ends there and a longer case would test one that can't happen; each turn at most the bot'smaxInputChars. An instance runs at most 8 eval requests at a time (the console's Tests view shares them, "As built in 0.8-q4"). - A guardrail block ends the run at that turn, with
outcome: 'blocked'and the checks judged on what came before; other turn failures answer the turn's error code (such asupstream_error,budget_exceeded), and the CLI treats them as decision 4 says. - An invented source is a citation of a source no search of the run returned, across every turn of the case, not only the last; a dropped citation marker counts too. Web pages from web search (ADR-0038) are never invented.
- Verdicts are
pass,fail,warn(onlygrounded) andnot_graded, each with a reason of at most 200 characters.
As built in 0.8-q2 (the grader)
Written at the release (task y1, 2026-12-01) from q2's hand-over; the code is src/eval/grader.ts and src/openai/grader.ts. Where building settled what decision 3 left open:
eval.grader.modeltakes the form a bot'smodeltakes, a string or aBotModelwith its settings (ADR-0036); any other key besidemodelis a setup error. Noservice_tierhere: Flex came witheval.serviceTier("As built in 0.8: running rarely, and Flex").- No grader, no graded case. A case with
reference,declines,rubricoranswerLanguagesent to an app withouteval.graderanswers400 invalid_inputnamingeval.graderbefore any turn runs; the CLI stops with exit 2. - The schema's criteria are
correct(forreference),declines,rubric_1torubric_nandanswerLanguage, each{ id, reasoning, pass }, in the order the checks are reported. A rubric's failure reason names its criterion. - Not graded, with why: a deterministic check failed, a guardrail blocked the turn, the grader refused, its output was cut off (its output limit, which a high reasoning effort can use up, or a content filter), or it didn't match the schema.
- The result gains
grader(the grader prompt's version,EVAL_GRADER_VERSION, 1 in 0.8, sent with every result so the CLI can tell a changed grader from a regression) andgrading: { model, usage }, the grader call's tokens apart from the turns'. The call reserves against the bot'sdailyTokensand the global budget, has a 90-second deadline across its retries (504 timeout), and reachesonUsageas its own report (source: 'eval', the grader's model, no conversation); a call the CLI gave up on is reported asstopped. - Not verified live: the smoke project had no credit. The strict schema passed OpenAI's validation (the request reached the billing check), but the recorded grader answers in
openai/testing/fixtures/grader.jsonare shaped from the docs and wait for a funded run to be re-recorded. - Checked live at the release (y1, 2026-12-01): with
eval.grader.model: 'gpt-6-luna'at Flex, 12 grader calls in a run of the site's set, every one parsed against the strict schema: 12 graded verdicts passed, and the onlynot_graded(5) were runs whose deterministic checks had failed. No refusal, cut-off or schema mismatch, so the fixture's shape holds. A grader call read about 2,000 input tokens (24,141 over 12 calls), the CLI's estimate.
As built in 0.8-q3 (the CLI)
askdare eval is packages/askdare/src/cli/eval*.ts. Where building settled what the decisions left open:
- Re-runs stop at the first pass. A candidate run re-runs a failing case only while every run so far failed (
--retries, default 2), since one pass already rules out a regression. A case isβ(every run passed),β(none) or~flaky (some). A fix is a case that failed every baseline run and passes every run now. - The hash is SHA-256 over the case's bot, language, turns and
expect, as JSON with sorted keys, cut to 16 hex digits.notesandtagsare left out: editing them neither changes what runs nor resets the baseline. - The noise band is 1.96 βΞ£ p(1 β p) / n points around the baseline's mean pass rate, where p is each case's pass rate across its baseline runs: the 95 % range of one run's aggregate if each case passes at its baseline rate. It is compared with the share of cases whose first run passed, over the cases whose hash matches the baseline. A baseline of 1 run per case measures no band, and the report says so by leaving it out.
- The baseline (
version: 1) is a flat, sorted list of entries{ bot, id, hash, runs, passes, failing, model, grader?, graded?, tokens }, keyed by bot and case, so 0.8-v4 addsversionto each entry and to the key without reshaping it.gradedcounts the runs whose graded checks were all judged, and how many passed them all.--update-baselinekeeps the entries of cases a filter left out and drops those of cases no longer in the folder, and writes the file in one step (a temporary file, then a rename). It compares with the old baseline as a candidate run does and exits by the same rules; it writes only when the exit code isn't 2. - Graded changes are reported per case (regression, fix, or "grader changed" when the result's
graderdiffers from the baseline's), never in the exit code. The CLI reads the grader prompt's version from an optional integergraderon each result, which 0.8-q2 adds; it parses it apart from the result, so it works before and after q2. - Drafts anywhere in the folder stop the run, not only drafts the filters select: a draft must not reach a commit unreviewed.
notesare stripped from the case before it is sent. - Errors. No new run starts after: the app unreachable or redirecting,
not_found(noevaloption, or another package version),unauthorized,invalid_input(the server's message is printed: an unknown bot, too many turns, a missing grader),budget_exceeded,bot_unavailable,upstream_errorafter two retries (5 and 10 s apart, or the server'sretryAfterMs), andrate_limitedafter ten waits. Atimeoutor another error code fails only that case; the run continues and exits 2. The route maps OpenAI'sinsufficient_quotaandcredit_balance_exhaustedtoupstream_error, so the CLI can't tell an empty account from an outage; its message names both. A distinct code would need the protocol, and is left for later. - The budget counts each result's input and output tokens, cached and reasoning tokens included in those, plus the grader call's tokens, which 0.8-q2 returns apart as
grading: { model, usage }(the report lists them under the grader's model). The estimate without a baseline adds 2,000 tokens per run of a case with graded checks for the grader. The budget is checked before each run starts, so the runs in flight when it runs out finish and count. CHAT_SECRETis read from.env.localand.env, with the shell winning, or from--env-file, which wins over the shell (asdoctordoes).--runsgoes only with--update-baseline.--concurrencyis 1 to 8, the server's cap.- The site's own set is
site/evals/(32 cases for the docs bot: facts, citations, cross-language, multi-turn, two unanswerable questions, two injections, a handoff). Its estimate is 180,000 tokens for a candidate run and 540,000 for a 3-run baseline, which is more than the docs bot'sdailyTokens(400,000): its baseline has to be recorded in parts (--tag) or with that budget raised. The e2e test runs the CLI against the site with the OpenAI mock, on cases written for the mock's echo (e2e/fixtures/evals/), and loads and estimates the site's set. - The live run is not recorded yet. On 2026-11-30 the site's set ran against the dev OpenAI project, which had no credit left (
credit_balance_exhausted, as in s11): every turn failed, and the CLI stopped after the four cases in flight had used their retries, in about 25 seconds, with exit 2 and no baseline written. That confirmed decision 5's clean stop on a real empty account. The numbers this section should hold (tokens per case, time, the estimate's accuracy against the baseline) need a funded run. - The live run at the release (y1, 2026-12-01,
gpt-6-luna, Flex, grader on): 21 of the site's 32 cases ran in 11 min 10 s (Flex waits included), 15 passed, 5 failed, 1 flaky, 2 not run (Flex), and the run stopped on the docs bot'sdailyTokens(400,000), which an earlier aborted run that day had partly used. Tokens: 212,348 input (52,306 cached) and 7,318 output over 26 runs, about 8,200 input tokens per run; the budget counted 238,693 for 21 cases against an estimate of 180,000 for all 32, so the estimate is about half of the real spend per case (re-runs of failing cases and the grader included) and should be raised. The 5 failures are the docs bot's, not eval's: its vector store was last synced on 2026-11-16 and lacks the guides added since (eval.md,forms.md,admin.md,prompt-versions.md), so it cites other pages. No baseline was recorded: the run wasn't clean, and a 3-run baseline of the set needs a re-synced store and more than the docs bot's daily budget. - The estimate raised (task 0.8.x-p3, 2026-12-04): without a baseline, 8,000 tokens per turn (was 4,000; the live run spent about 8,200 input tokens per run, the grader's included, plus what failed tries billed) and still 2,000 per graded run for the grader. Re-runs are now counted without a baseline too: a quarter of the cases are expected to fail their first run and use every
--retriesre-run (the live run: 6 of 21 cases failed their first run, 5 of them every run). With a baseline, as before: the baseline's tokens per run (its grader included), and all the re-runs for a case that failed some baseline run, none for one that passed every run. A re-run costs a whole run, so a multi-turn case pays for its earlier turns each time. The refusal prints the parts: the runs, the grader, the re-runs. The site's set is now estimated at 474,000 tokens for a candidate run (272,000 for its 34 turns, 44,000 for 22 grader calls, 158,000 for re-runs) and 948,000 for a 3-run baseline. For the 21 cases of the live run, the estimate is about 318,000 to 324,000 (which 2 of the 23 started cases Flex didn't run is not recorded): a third above the 238,693 counted, because the run stopped on the bot's daily budget before at least 6 re-runs of its failing cases; with those re-runs at the run's 9,200 tokens each, the complete run would have spent about 294,000, which the estimate is within 10% of. The runs alone, 212,000 to 216,000, are within 11% of the 238,693.
As built in 0.8-v4 (--version)
Prompt versions in eval are as ADR-0039 decides; its "As built in 0.8-v4" has the details. For this ADR's formats: the eval request takes an optional version and a result names the version that ran; the route also answers a versions request (kind: 'versions'), which the CLI sends once before any case; the baseline (version 1) keys its entries by bot, version and case, with version required; the JSON report (version 1) has version on every result and a per-version summary (summary.versions); JUnit has a suite per bot and version with --version. A run without --version gets no version in its pretty output and JUnit, as before. The console's Tests view (decision 6) runs a case against a picked version through the same check, with the playground's picker.
Consequences
- A change to instructions, documents, model or retrieval shows its effect before it ships, in the terms askdare answers in: facts, citations, handoffs and forms, not text similarity. Large regressions show in one run; small ones show as stable per-case regressions, not as a moved average.
- The same cases serve the console and CI, so ADR-0016's test questions get their configuration surface without a second list. The same names serve prompt versions (ADR-0039).
- Core grows by the eval path in the handler, the grader call in
src/openai/, the CLI command and the case schema, all server-side or CLI. The loader, the React entry and the console's budget are untouched, apart from the console's Tests view and draft button (within the console's 30 KB, checked byinline-assets.mjs). - CI needs a running app, with its secrets and stores. That is heavier than a unit test, and it is the point: the eval tests what ships.
- Graded checks inform but don't gate until a person's grading confirms the grader. Deterministic checks carry the build in the meantime, and a team that wants the grader's judgment reads its reasons in the report.
- A baseline costs three runs, and a candidate run 10 to 20% more than one run for its re-runs. That buys about one false alarm in eight runs instead of two per run.
- Eval turns cost real tokens against the bot's daily budget. The run's budget and the docs' advice (a preview deployment, a CI project with a spend limit) keep that visible.
- Two additive fields (
ChatUsageReport.source,ToolContext.source) reach apps that never run an eval.
Alternatives considered
- Promptfoo, as OpenAI recommends (migration guide), with askdare documenting a setup. Promptfoo is a large dependency with its own configuration format, and through a plain HTTP provider it sees text only: no citations with their sources, no handoff or form. A Promptfoo provider for the eval endpoint stays possible later (decision 7) for teams that already use it.
- Running cases in process, with the CLI importing the app's bot configuration. It would need the app's TypeScript, path aliases, environment and
server-onlymodules outside Next, and would skip the route, the stores and the gateway as configured. Calling the running app is howdoctoralready works. - Grading in the CLI with its own OpenAI client. It would need a second key in CI, bypass the provider path, and leave the grader's cost out of
onUsage. On the server, the grader is one more call through the app's gateway. - YAML case files. Nicer for long rubrics, but a YAML parser would be a new dependency of the CLI, and JSON is what the console's draft and editors' schema support handle without one.
- A
defineEvalTypeScript helper as the format. Typed and close todefineBot, but loading it needs a TypeScript loader that understands the app's aliases; deferred (decision 2). - Scores (1β10) instead of pass/fail. A score needs a threshold per criterion anyway, and binary verdicts are easier for a person to agree or disagree with.
- 3 runs per case with a pass at 2 of 3, as first proposed. s11 showed a flipped majority flags about 2 cases per run by chance, since flaky cases sit near 2 in 3.
- A regression judged on the aggregate pass rate. Small regressions stay inside the noise band (s11: Β±3.3 points per graded run) while showing clearly per case.
- A graded
groundedcheck. Two grader models agreed at kappa 0.33 on it in s11. - A separate list of test questions for the console (
defineBot({ testQuestions })). Simpler to build, but two lists that drift, and the console's questions would have no checks. - Drafting cases automatically from π conversations, or a CLI command that pulls them from the admin store. Both move visitors' words toward a repository without a person in between, and the second needs a new channel into the admin store. The console already shows the conversation to someone allowed to see it.
- An add-on package (
@boldare/askdare-eval). The eval path needs the turn loop and the gateway, which stay internal to core (ADR-0026), so the server half can't live outside it; the CLI is core's already.
As built in 0.8-q4
Amended on 2026-11-30 (task q4), where the console's Tests view and the drafts from π differ from or add to decisions 2 and 6:
- Two console actions, in ADR-0034's permission table, both
developerand the bot in scope (404otherwise):caseslists a bot's cases fromeval.cases, in the order of the files and their cases, each with the language it runs in;run-caseruns one, named by its place in that list and its ID, so a page from before a deploy runs nothing.eval.casesis checked on the first request that needs it,/evalorcases; an invalid file answersbot_unavailablewith the file's index and field in the log. - The same run as
/eval, with the answer:createEvalRoutealso exposes the run for a caller that checked who asks, and/evaland the console share the 8 runs an instance allows. What differs is the budget: a console run reserves each turn with the playground's limits for the admin's playground visitor (per-visitor and per-IP rates,maxTurns, the new-conversation rate), as ADR-0034 givesdeveloper, besides the bot's daily budgets. Run all goes one case at a time and waits out arate_limitedof up to a minute. - Graded checks are graded through the same path as
/eval(0.8-q2), with the app'seval.grader; a case with graded checks in an app without one answers q2's error, which the page shows. The grader's call reserves the bot's daily budget as on/eval, not the playground's per-visitor limits, which count the run's turns. - Finding the π: the admin store lists ratings by day and bot, not by conversation, so the review reads the bot's π ratings of the days the conversation was active and the day after, newest first, at most 5 pages of 100, and marks the answers whose item ID matches, with the comment. A rating given later, or past those pages, isn't marked. A query by conversation would be a port change for every store; not needed for 0.8. Best effort: a failure leaves the review without marks.
- Identity fields: askdare keeps no identity with a conversation (records carry pseudonyms, the conversation store an HMAC owner), so the page has none to scrub. The scrubber takes them (name, email, user ID) for when it does; meanwhile the review says when the visitor was signed in (
user:owner), only for a conversation with a π, and the draft tells the person to look for their name and account details. - What the page scrubs: email addresses, phone numbers (digit groups with separators, seven digits or more, dates excepted), URLs with a query string (the whole URL) and runs of six digits or more, as
[email],[phone],[url]and[number]. Names and addresses in prose need the person. - The draft: a whole case file (
$schema,version, the bot, its language, one case with IDreview/<UTC date>-<time>,turns,expect: {},draft: true), copied or downloaded as<bot>-draft.eval.json. Its language is the bot's, orenwith a note when the bot's isauto. Turns that were only a file are left out, and at most the last 20 turns are kept. - Size: the Tests view and the draft are chunks loaded on first use (
tests,draftdialog), beside the Markdown renderer, and the console's own shared parts moved to acommonchunk the page preloads with Preact. This change adds about 1.7 KB to the page load (25,684 to 27,401 bytes gzipped before 0.8-v1; 27,890 with v1's version picker, budget 30,720); the two chunks are about 2.5 KB each, with a budget of 6 KB each ininline-assets.mjs.
As built in 0.8: running rarely, and Flex
Amended on 2026-11-30 (the eval cost task), where the maintainer chose to keep eval's spend low over time:
- Decision 5, what CI needs, now recommends running rarely: no eval on every push; on a pull request only when the bot's instructions, documents, configuration or
evals/change, and then only the cases taggedsmoke, once; the full set by hand (workflow_dispatch) and before a release; the baseline only by hand. Each job sets--max-tokensfor its own size, behind the CI project's hard spend limit.docs/eval.md("In CI") has the workflow. askdare's own workflows run no live eval:e2e/eval.spec.tsruns the CLI against the site with the OpenAI mock. - Decision 5, cost:
eval.serviceTier: 'flex'runs eval turns and the grader at OpenAI's Flex tier, half the Standard price (s11 graded at Flex). It is the app's setting, not a CLI flag: the server chooses what it sends to OpenAI, as it chooses the grader model. When Flex has no capacity, the case is reported as not run (exit 2) after the CLI's waits, never resent at Standard prices. Visitors' turns never use it. Details, and what wasn't verified live, in ADR-0036 ("As built in 0.8: service tier for eval only"). - Decision 4, errors:
/evalnow passes on an error's message andparams, so the CLI tellsflex_unavailable(wait, then that case is not run) from otherupstream_errors (stop after two retries). An error answer also carriesparams.spentTokens, what the run's model calls spent before it failed, and the CLI counts it toward--max-tokens(decision 5): a retried multi-turn case pays for its earlier turns each time. - For 0.9, not built: skipping unchanged cases, reusing the baseline's result when the case, the prompt version, the model and the knowledge haven't changed (ROADMAP).
As built in 0.8-t3 (approving a call)
Amended on 2026-11-30 (task t3), where ADR-0038's approval of a tool call meets decision 1 and 4, which predate it. Settled with the maintainer as suggested:
- An eval turn ends at the card, as a chat turn does: the call is validated, not run, and the turn's answer is the text before it. Nothing is approved for the run, automatically or otherwise, so a tool that waits for approval never runs in
askdare eval; its card's handle is a placeholder nobody can answer. - The
toolscheck counts the requested call: a call that waited for approval is in the turn'stools, after the calls that ran, asexpect.toolsnames it. The usage report still lists only the calls that ran. - A later turn of the case is a typed message, so the waiting call is answered
{"status":"not_approved"}before it, as in the chat.
Settled with the maintainer (2026-11-30)
The open questions of the Proposed draft (2026-11-29), all settled as recommended ("Yes, accept all"). Where s11's findings or ADR-0039 changed the details, the line says so.
- Case format: JSON with a published schema; no
defineEvalin 0.8 (decision 2). s11 addedreferenceandnotesto it (decision 1). - Where cases run: against the running app over HTTP, like
doctor(decision 4). - Where grading runs: on the server, through the app's gateway (decision 3).
- The grader model: from
createChatHandler({ eval: { grader } }), with no default; deterministic-only runs work without it (decision 3). - Repeats and regressions: settled as "3 runs, with the numbers adjusted to s11". s11 replaced the 2-of-3 majority with its rule: a 3-run baseline, one candidate run with two re-runs of failing cases, and a regression only when a case passed every baseline run and fails every candidate run (decision 3).
- The endpoint: only with the
evaloption (decision 4). - The budget: in tokens, default 1,000,000 from s11's numbers (decision 5).
- Side effects: handoffs and forms recorded, not delivered; the app's tools run with
ToolContext.source = 'eval'(decision 4). - The daily budget: eval turns count toward
dailyTokens(decision 4). - Answers in reports: only with
--answers(decision 5). - The console's test questions: the same cases, passed as
eval.cases(decision 6). - π to a case: a scrubbed draft in the console, with a
draftmarker that blocks runs until a person removes it (decision 2). - Graded checks in CI: the human sample isn't graded yet, so graded checks report and deterministic checks fail the build (decisions 3 and 4) until an amendment, after the human grading, lets
correctgate.
Also settled: A/B testing narrows to "statistics or a side-by-side report beyond --version", since ADR-0039 (accepted 2026-11-30) puts askdare eval --version in 0.8 and adds version to the request, report and baseline (decisions 4, 7 and 8).