Docs/Triage
#

Triage

Find out why a run failed, and tell a real bug from a flaky test, a test problem or a setup problem.

Work out why a run failed

When a suite fails, Cofactor writes up the cause. You get a verdict, the failures grouped by cause, and a diagnosis for each failed test, so you start from the causes.

Read the triage of a suite run

  1. Open the suite run. In Suites, open Test Runs, then the run that failed. Cofactor triages a suite run when any test in it did not pass, once the diagnoses are ready. This can take up to about 20 minutes. The triage summary only reads results.

  2. Read the verdict. The triage panel shows a verdict and a headline.

    VerdictMeaning
    All clearEvery test ran, and at most some suite maintenance is left.
    Needs attentionA real bug or lost coverage needs work.
    UrgentSomething is broken badly.
  3. Read the findings. Findings are ranked, most important first, and sit in three groups. Grouped failures are failures with one shared cause. Real bugs are defects in your app. Suite maintenance covers tests that need updating. Each finding lists the failed tests behind it and the issues already filed. Failures that started failing in this run are marked as newly failing. Partial diagnostics means some diagnoses were not ready in time.

  4. Get the same view from the CLI.

    bash
    cofactor triage wait latest
    cofactor triage get latest
    cofactor triage failures latest --new-only
    

    latest is your most recent suite run. wait stops after 1200 seconds unless you pass --timeout <seconds>. With an API key, triage commands need a key with the * scope.

Read the diagnosis of one failed run

  1. Open the failed run and select Diagnose root cause. When a diagnosis exists, the button reads Jump to root cause, and View analysis while one is running. Cofactor diagnoses a test automatically when it newly fails after passing and when it keeps failing. A test's very first failure is not diagnosed until you ask.

  2. Read the category. The diagnosis names a category, with the evidence and a recommendation. To read it from a terminal:

    bash
    cofactor test-suite diagnostics <workflow id> <run id>
    
  3. Decide. Use the category to find who fixes it.

    CategoryWhat it meansWho fixes it
    Software BugA clear defect, such as an error page or a failed request.Your app. Work the issue.
    App ChangedThe app now behaves differently than the test expects.You decide. If the change was intended, update the test. If not, it is a regression.
    Agent ConfusionThe test agent misread the page or took a path no user would. When the run failed only on assertions, the diagnosis corrects the run to a pass.The test. Make its steps clearer.
    Test UnderspecifiedThe test does not say enough about what success looks like.The test. Add assertions.
    Data CollisionTest data clashed with other data.The test data.
    Dependency IssueSomething the test relies on let it down.The dependency, or its data.
    Platform ErrorA problem on the Cofactor side.Run it again, and contact us if it repeats.
    Test BugThe code of your own test is wrong.Your test code.

    Agent Confusion and Test Underspecified apply to tests written in Cofactor. Test Bug applies only to your own suites.

Tell a flaky test from a real failure

When a diagnosis is unsure, it can add one confirming rerun of the failed test to the suite. Otherwise flakiness shows up across runs. A test is Flaky when its latest run passed, one of its last ten runs failed, and it has not passed five times in a row since.

  • A test that passes when you run it again points to a flaky test or a timing problem. To make the test steadier, see End-to-end tests.
  • A missing seed, an expired login or the wrong environment is a setup problem. Fix the setup and run again. Do not file an issue.
  • A change from green to red is a strong sign of a regression only when the test passed steadily before.
  • A test in a suite that has passed before and then fails five runs in a row is Degraded. Suites skip it until you edit it, or select Re-enable degraded flows when you start a suite run.

Check it worked

For each failed test, you can say its category, the evidence for it and the fix. For a real bug, the issue exists and holds the evidence. See Issues. For a false alarm, you closed the issue as not a bug and gave a reason.

bash
cofactor issues list --status open

Go deeper

Advanced

Let your coding agent dig in, and the CLI debug commands.

Install the debugging skill, then give your coding agent a run id or a run URL.

bash
cofactor skill install cofactor-debug-run

The debug commands each read one part of what a run recorded. --slow sorts the steps slowest first, --grep filters the agent's thoughts by text, and --misses-only shows only the cache misses.

bash
cofactor workflow debug overview <run id>
cofactor workflow debug steps <run id> --slow
cofactor workflow debug thoughts <run id> --grep "delete"
cofactor workflow debug cache <run id> --misses-only

If a diagnosis could not finish, the issue's Diagnostics tab shows Re-run Analysis.