Spaces:
Running

WorkPilot-AI / evals /error_analysis.md
Aynkhn's picture
Deploy WorkPilot demo
fd5dd94 verified
|
Raw History Blame Contribute Delete
6.22 kB

Error analysis loop

Aggregate pass rates say that something fails; error analysis says why, and turns each failure mode into a permanent scenario. The loop follows the "look at your data" practice (open coding, then axial coding) recommended for LLM products: read real failing traces before writing metrics or judges.

1. Export failing trials

python -m evals.harness.runner --suite evals/suites/full.yaml --k 4 --by-language \
    --results-jsonl evals/out/full.jsonl
python -m evals.harness.errors evals/out/full.jsonl --out evals/out/failures.jsonl

failures.jsonl has one row per failing trial: scenario, slice, language, the inbound event, the transcript (customer messages and agent replies), every tool call with its gateway decision (audit log), the database diff, the grader's problems and automatic category tags (approval_violation, forbidden_call, unexpected_side_effect, missing_effect, wrong_status, wrong_tool, wrong_arguments, reply_language_or_content, workflow_check, harness_or_runtime_error). evals/out/ is git-ignored scratch space.

Live runs (real models, --user-sim live, --judges live) are where this loop matters most: with scripted models a failure is a deterministic bug in the system, with real models it is usually a model behaviour worth a category.

2. Open coding (read, note, do not categorize yet)

For each failing trial, read the transcript and the diff, and write one sentence in annotation.note describing the first thing that went wrong (the upstream error, not its consequences). Do at least 30 trials or all of them, whichever is fewer.

3. Axial coding (group into categories)

Group the notes into a small set of failure categories (5-10), name them, and set annotation.category on every row. Then:

python -m evals.harness.errors evals/out/failures.jsonl --annotated

prints the category table (count and the scenario runs in each).

4. Act on each category

category count root cause fix (code / prompt / policy) new scenario (annotation.new_scenario) status
example: wrong_language_reply 3 bare digit replies detected as und, confirmation sent in English carry the conversation language on the offer evals/scenarios/support/00x_digit_reply.yaml open

Rules:

  • Every category gets at least one scenario in evals/scenarios/<slice>/ that reproduces it, added to evals/suites/full.yaml (keep slice targets; replace a weaker scenario or raise the target in the plan).
  • A fix that changes behaviour ships with the scenario that proves it.
  • Categories that are safety-relevant (approvals, injection, recipients) also get a smoke scenario (evals/suites/smoke.yaml), so CI blocks regressions on every PR.

Filed findings (Phase 14)

Findings from building the 150-scenario suite. Fixed items are covered by scenarios; open items are listed as known limitations in docs/evals.md.

# category finding status
1 reply_language_or_content Urdu-script yes/no followed by the Urdu comma ("ہاں،") was not matched by the COD keyword rules (punctuation inside the Arabic-script token class) fixed in packs/ecommerce/cod_reply.py (eco-126 [ur])
2 wrong_status Urdu-script "3 دن" not recognised as a day count in the delayed-orders request fixed in packs/ecommerce/graphs.py (eco-001/002/003 [ur])
3 wrong_status Urdu-script "late orders" (لیٹ, تاخیر) not recognised by the task planner fixed in packs/ecommerce/graphs_ops.py (eco-038 [ur])
4 unexpected_side_effect A refund email re-sent after the refund executed but its confirmation failed refunds again (no per-request dedupe; only the refundable cap protects full refunds). Intake dedupes the same delivery by message id, so this needs a customer re-send. fixed: ecommerce.refund_order refuses to pay an identical refund (same order, same amount) issued in the last 72 h; it re-sends the confirmation instead (policy fact repeat, packs/ecommerce/tools/refunds.py; eco-013, tests/ecommerce/test_graphs.py::test_resent_*). Not covered: a repeat with a different amount, which is treated as a new refund
5 missing_effect A courier timeout during COD auto-booking leaves the order confirmed without a shipment and with no ticket or retry fixed: a failed booking opens a high-priority staff task (ecommerce.create_task, due in 4 h) to book it by hand (packs/ecommerce/graphs_cod.py _booking_followup; rec-001)
6 reply_language_or_content Any booking failure (including infrastructure errors) tells the client the slot "is no longer available" fixed: only a policy forbid or a tool failure marked unavailable (taken, past, nobody free) says so; anything else gets a staff follow-up reply (packs/appointments/graphs.py _slot_unavailable)
7 other Workflow step retry only retries rate limits, not timeouts or DB errors fixed: timeouts, 5xx and dropped DB connections are retried too (core/workflows/executor.py is_transient); self-healing proposes retries for them as class transient but never auto-applies them
8 reply_language_or_content Appointment medical refusal is always English; Urdu-script knowledge questions are not routed to the knowledge base; bare digit replies ("2") are detected as und and answered in English fixed: refusal in ur/roman_ur (safety.MEDICAL_REFUSAL_T, every variant counts as the refusal for policy); Urdu-script policy triggers (packs/ecommerce/knowledge.py); a reply to text with no language follows the sender's last language; lexicon gained "doosra", "jumma", weekdays and times of day
9 reply_language_or_content Language judge: e-commerce refund confirmations and operator-triggered apology emails are English for Urdu / Roman Urdu customers (the diff grading passes; the judge flags it) fixed: refund confirmations follow the customer's own text (or, for an operator, the language the customer last wrote in); delay apologies use each customer's last language (views.customer_languages)