Repository navigation
feat(check): run recording replays in PR checks, report replay and latency results, and label runs - #117
Conversation
…tency results, and label runs - sim: the verdict reads results.transcriptEvaluation and results.latencyEvaluations. A replay or latency budget counts as scored, failures list the metric, inexact required key values and budgets over threshold, skipped (chat) budgets are ignored as on the platform, and an item with no detail shows its failureReason. Shared by npm run sim and the PR check. - check: a transcriptReplay scenario is sent by its saved UUID (the run API rejects inline replays), voice and own org only. Before a live run the check reads each saved replay scenario and stops, sending nothing, when the branch's replay settings differ from it. - check: an optional per-check label names every entry, with VAPI_CHECK_LABEL_CONTEXT appended (PR #N in CI), so the dashboard's runs table stops showing "API run". - validate: stock personality UUIDs no longer warn reference-by-uuid. - docs: replays, latency budgets, caller background noise and every backgroundSound bed. Refs TEST-291 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This stack of pull requests is managed by Graphite. Learn more about stacking. |
roshan-vapi
left a comment
There was a problem hiding this comment.
Verdict: one blocking issue that #118 does not change. In sim-result.ts, a measured latency budget now turns "all required judges skipped" into a pass (inline, with a probe result). The other inline comments are non-blocking.
I checked this PR against #118, which sits on top of it in the stack. #118 sends replays inline, and that fixes these replay-by-UUID findings. They only matter if #117 lands without #118:
- The saved copy's
targetOverridesandhooksskipwalkObjectand the strict mocks. - The stale-copy comparison misses
targetOverridesandhooks. It is also one-way for nested keys, so droppingrequiredfrom a key value or a budget is not caught. - The
check-mocksguard accepts anyscenarioId-only entry. entry.scenarioId!.
Not inline:
- A replay scenario in a shared suite makes the build fail for every chat check (and, with #118, every squad check) that uses that suite. Skip it with a warning, or document the rule in
pr-checks.md. promotion.ymldoesn't setVAPI_CHECK_LABEL_CONTEXT, so a labelled check run by the promotion gate gets no context.docs/learnings/simulations.md: the replay example hostsdrug-names.wavat a public raw URL. Add a note: synthetic or de-identified audio only, and no tokens inrecordingUrl.- Missing tests: skipped judges plus a measured latency budget, and a failed item whose
failureReasoncomes with transcript detail.
Method: 10 Claude review passes (correctness, tests, silent failures, types, comments, simplification, completeness, security, adversarial, Greg-style) plus 1 Codex pass, de-duplicated. I verified the latency finding with a probe against head 90a6863.
| (item.results?.latencyEvaluations ?? []).some( | ||
| (latency) => | ||
| latency.required !== false && | ||
| latency.isSkipped !== true && | ||
| typeof latency.actualMs === "number", | ||
| ) |
There was a problem hiding this comment.
This OR lets a passing latency budget score an item by itself. I probed simRunVerdict at head: every required judge isSkipped plus one measured budget now returns passed. Without the budget, the same item returns incomplete. A budget says nothing about whether the conversation was right. Count latency only when the item has no required judge or replay metric, and add that test.
| item: itemLabel(item), | ||
| item: label, | ||
| evaluation: "(no evaluation detail)", | ||
| ...(item.failureReason ? { reason: item.failureReason } : {}), |
There was a problem hiding this comment.
failureReason shows only when there is no other detail. If a recording fetch fails and the platform still returns WER with actualValue: null, passed: false, the row reads wer ... null and the real reason is dropped. That is the case the PR body says this fixes. Attach reason: item.failureReason whenever it is set.
| // runLabelBuild), so name those items by scenario and personality instead. | ||
| export function simRunItemLabels(items: SimRunItem[]): Map<string, string> { | ||
| const names = new Set(items.map((item) => item.metadata?.simulation?.name)); | ||
| const shared = items.length > 1 && names.size === 1; |
There was a problem hiding this comment.
nit: shared is inferred from equal names, so it also fires without a label. Examples: npm run sim with iterations > 1, or a check with one simulation. Those rows now read scenario (personality), and two items with the same scenario and personality can't be told apart. Pass an explicit labelled flag from the caller instead.
| value.trim() === "" || | ||
| value.length > MAX_LABEL |
There was a problem hiding this comment.
nit: the length check runs before the trim, so a padded label that trims to 60 or fewer characters is still rejected.
| value.trim() === "" || | |
| value.length > MAX_LABEL | |
| value.trim() === "" || | |
| value.trim().length > MAX_LABEL |

Fixes the known bugs from TEST-291 in one PR, instead of the six planned there. It ports the engine changes from the gitops-sims-demos repository, which ran on prod, and fixes three bugs found in that code along the way.
What changes
Verdict (
src/sim-result.ts, shared bynpm run simandnpm run check)results.transcriptEvaluation, withresults.evaluationsempty. A passing replay was reported "incomplete" (exit 3), and a failing one showed "(no evaluation detail)". It now counts as scored when a required metric was measured or a key value is required. A failure lists each failing metric (expected vs actual) and each required key value that wasn'texact.results.latencyEvaluations) that are over their threshold, or weren't measured, are listed.passed: false, isSkipped: true. Skipped budgets are no longer listed as failures, which matches the platform's pass rule.failureReason, for example a recording that couldn't be fetched.Replays in PR checks (
src/check-payload.ts,src/check-mocks.ts,src/check-run.ts)POST /eval/simulation/runrejects an inlinetranscriptReplay, on purpose (simulationRunTranscriptReplayValidate). A check now sends a replay scenario by its saved UUID, and the target is still built from the branch. The build fails over chat, with arunOrg, or when the scenario hasn't been deployed.transcriptReplay,evaluations,latencyExpectationsortoolMocksdiffer from the saved copy, the check stops with an error and sends nothing. The demo only warned on every replay, so a PR that edited an answer key was judged on the old copy. The comparison ignores keys the platform adds, so a key removed from the file isn't caught (noted inimprovements.md).Run labels (
src/check-config.ts,src/check-build.ts, workflow)label. It's written on every simulation entry, withVAPI_CHECK_LABEL_CONTEXTappended (PR #Nin CI,manual runfor a dispatch), so the dashboard's runs table shows e.g.Background noise (voice) · PR #2instead of "API run". When items share a name, the report names them by scenario and personality.#. A new workflow test asserts the parsed value, and fails if the quotes are removed.Validate: a stock personality's UUID (
a0000000-…-00000000000N) no longer warnsreference-by-uuid. The stock-ID regex now lives in one place,resource-parse.ts.Docs: PR checks (
label, replays, the stale-copy rule, the replay rollout), simulations learnings (replay result shapes, hosting a recording, writing the answer key in the transcriber's style, latency budgets, caller background noise), everybackgroundSoundbed in the resource reference,VAPI_CHECK_LABEL_CONTEXTin configuration, andimprovements.mdentries 45–46.Not included
config.tskeeps every path (a probe with three paths returned all three inapplyFilter.filePaths), andfilterResourcesByPathsloops over all of them. The "would update 1" count was likely unchanged or new files. It needs a reproduction before a fix.Testing
npm run build,npm test(784 pass, 1 skipped because it runs only in CI), andnpx biome checkon the changed files.replayDifferences, the stock-personality exemption, and the quoted workflow value. The demo repo's tests were ported unchanged.npm run checkagainst a scratch org. The ticket's acceptance step (the demo'sharbor-replaysandharbor-latencychecks on a clone of this branch) still needs a run that uses minutes.🤖 Generated with Claude Code