Debug E2E Test
Start from a test name (not a CI run), find its recent distinct failure modes,
investigate one, falsify a root-cause mechanism, and land on fix-the-test vs.
file-a-bug with the action to match. This is an orchestrator: deterministic work
lives in scripts/, and detailed procedures live in references/ that you read
only when a stage needs them.
Editing this skill: this file holds the invariant, the reference holds the
mechanism. Restating a mechanism here makes two copies that drift apart silently.
When to use
You picked up one specific e2e test that is failing or flaking, and want its
evidence without hunting for it by hand. Two entries, one triage. They differ
only in where the evidence comes from; everything from "read the summary" onward
is identical.
| | CI entry | Local entry |
|---|---|---|
| Use when | the test fails/flakes in CI | it just failed on this machine |
| Evidence | test-health history -> one occurrence's report | this run's test-results/ artifacts |
| Needs | E2E_INSIGHTS_API_KEY, gh | nothing |
| Extra steps | pattern table, which-pattern question, prior-triage check | none |
Pick local when the engineer just produced the failure or says "locally"; pick CI
when they name a test CI is failing. When they said neither, don't ask -- look:
run collect-local-evidence.js --test '<what they named>' (drop --test if they
named nothing), and take the local entry if it returns ok (that call is the
local entry's first step), the CI entry otherwise. They compose -- a local dig that needs a rate runs the history
query afterwards, and a CI diagnosis reproduces locally in the verification half.
This is the debugging process for this case. Don't layer a general debugging
workflow on top of it -- the rules below (one pattern at a time, a falsifiable
mechanism, evidence ruled in and out) are that discipline. If you arrived here
mid-way through another one, drop it and restart from the evidence; a hypothesis
formed before the evidence was read is the thing this skill exists to prevent.
Not this skill: a test still being written or edited (author-e2e-tests); a
whole run's failures or a run ID/URL (e2e-failure-analyzer); a Vitest or
extension-host failure.
Non-negotiable rules
These hold on both entries unless a line names one.
- Zero runs is never a clean result (CI) -- only nonzero runs with no failure
patterns is. No local artifacts is not a dead end (local) -- it means the
test hasn't run yet, so it ends in an offer to run it.
- Resolve the test identity with
resolve-test-key.js, never by hand; when it
returns candidates instead of a resolution, ask which test before querying.
The local entry needs this only to build a run command.
- Investigate one selected pattern at a time (CI); ask which when there's
more than one. Never fetch evidence for a pattern the engineer didn't select --
ask first, even to check a side theory about how patterns relate.
- Never run a test in the foreground. Use Bash
run_in_background: trueand
tail the log. A foreground call lasting minutes blocks delivery of the
engineer's messages until it returns, so "it's hung, stop it" cannot reach you
mid-run and you cannot TaskStop the run. This matters most here: debugging
means watching a run you may well want to abandon.
- Fetch one representative occurrence first; a second only for a listed
reason in references/evidence-escalation.md -- name which.
- Agree the fix approach before the first edit, the same way you agree the
pattern before fetching evidence.
- Escalate evidence only to answer a concrete question, and **show the evidence
block before you act on it**. Large output stays on disk and out of the
conversation; how the read is delegated is