Skip to content

[Hackathon] feat: test failure triage — group batch failures by root cause #116

Closed as not planned

Description

@SahilRakhaiya05

Discord Username / User ID

uxdev

What does this improvement do?

New CLI command to triage failed tests by grouping related failures into deterministic clusters.

When many tests fail in the same project, such as during test run --all, regression reruns, or MCP execution, agents and humans currently see a flat list of individual failures. In practice, many of those failures often share the same root cause, such as an expired auth token, staging environment outage, broken routing, shared code defect, or cascading test data failure.

Today, the CLI only supports per-test failure analysis through commands like test failure get and test failure summary. This forces agents to download many bundles or guess which failed test to inspect first, wasting AI tokens, testing credits, and debugging time.

This improvement adds:

testsprite test failure triage --project <id>

The command lists failed tests, fetches lightweight failure summaries, and groups related failures client-side using deterministic heuristics over existing failure metadata. This helps users quickly identify the most likely root cause and choose the best representative test to investigate first.

Details / implementation notes

Implement a CLI-first failure triage command:

testsprite test failure triage --project <id>

Behavior:

  1. List all failed tests using the existing failed-test API surface.

  2. Fetch lightweight failure or summary information for each failed test.

  3. Do not download screenshots, videos, or full bundles.

  4. Group failures client-side using deterministic heuristics based on existing M2.1 fields.

  5. Return clusters containing:

    • representativeTestId
    • memberTestIds
    • confidence
    • fixPriority

Suggested grouping heuristics:

  • Shared recommendedFixTarget.reference

  • Environment-wide failure kinds such as:

    • infra
    • network
    • network_timeout
    • routing_404
  • Normalized rootCauseHypothesis prefix

  • Singleton fallback when no grouping signal is found

Supported flags:

--project <id>
--output json
--type
--filter
--max-concurrency
--dry-run

Acceptance criteria:

  • testsprite test failure triage --project <id> --output json returns clustered failure output.
  • Clusters include representativeTestId, memberTestIds, confidence, and fixPriority.
  • Command uses existing public APIs only.
  • Command does not require backend changes.
  • Command avoids downloading heavy artifacts such as screenshots and videos.
  • --type is supported.
  • --filter is supported.
  • --max-concurrency is supported.
  • --dry-run returns a canned sample.
  • Unit tests cover grouping heuristics and singleton fallback.
  • Integration tests cover command behavior.
  • Documentation is updated.
  • CHANGELOG is updated.
  • Agent skill documentation is updated.

Why CLI-first:

  • Uses only existing public APIs.
  • Reduces duplicate investigation immediately.
  • Avoids unnecessary bundle downloads.
  • Saves AI tokens, testing credits, and debugging time.
  • Provides a natural read surface for future backend-native clustering.

Future backend follow-up:

Add a native clustering API using semantic embeddings, wave/cascade graph analysis, and optional --rerun-representatives orchestration.

Confirmations

  • I have searched existing issues and this is not a duplicate.
  • I have provided my Discord identity above for reward coordination.

Activity

  1. added
    needs-triage
    hackathon
    on Jul 1, 2026
  2. zeshi-du commented on Jul 3, 2026

    @zeshi-du
    Contributor

    Triage: parked for design — client-side heuristic clustering can actively mislead agents when it groups wrong, and this overlaps the project-report surface we are redesigning against the V3 schema. Leaving the issue open as the anchor; PR #44 will wait on that design.

  3. removed
    needs-triage
    on Jul 3, 2026
  4. zeshi-du commented on Aug 13, 2026

    @zeshi-du
    Contributor

    Update: I've closed #245 (the recovered PR that implemented this) rather than leave it parked indefinitely against an undated dependency. This issue stays open — the need is real — but I want to be honest that it has no date.

    Two things recorded there that belong here too:

    • Batch failure triage depends on the failure/result surface we're rebuilding in V3. Until that exists, any grouping has to be inferred client-side.
    • And that inference is the substantive concern: a heuristic signature presented as a root-cause grouping reads as authoritative in a terminal, and when it's wrong it sends someone to debug the wrong thing. If we build this, the grouping should come from the platform's own failure classification.

    When the V3 failure surface lands I'll come back here and link #245 as the starting point. Credit for the original design is @SahilRakhaiya05's.

  5. zeshi-du commented on Oct 20, 2026

    @zeshi-du
    Contributor

    Thanks again @SahilRakhaiya05. This stays open but parked, with no date. Grouping failures by root cause should come from the platform's own failure classification, not CLI heuristics, and that isn't available yet. The failure commands are also being consolidated in 1.0 (test failure get and test failure summary move under result get), so a new test failure triage would land on a surface that is about to change. #245 is still the starting point when we pick it up.

  6. zeshi-du commented on Nov 19, 2026

    @zeshi-du
    Contributor

    Thanks @SahilRakhaiya05 for the design and the original PR. Our roadmap has changed and this repo isn't taking new CLI features, and the next release folds test failure get and test failure summary into result get, so a test failure triage command would have nowhere to live. Closing as not planned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    hackathon

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions