Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Your Agent Is Fixing Flaky Tests by Quietly Weakening Them

Description and use

Agents that fix flaky tests can quietly weaken assertions, degrading test quality. A diff-based assertion-count gate in CI, requiring human review for reductions, prevents this.

Problem

Agents that fix flaky tests by weakening assertions can silently degrade test quality, leading to weaker test suites that pass CI but no longer validate code behavior.

Outcome

Implementing a diff-based assertion-count gate in CI prevents agents from quietly weakening tests, ensuring that any reduction in assertions triggers human review and maintains test suite integrity.

Workflow

  • 1. Detect when a commit touches test files via git diff.
  • 2. Count lines containing assert/expect/should that are added or deleted.
  • 3. If deleted assertions exceed added assertions, emit a warning or fail the build unless a test-reviewer label is present.
  • 4. Require human review for any threshold changes or assertion removals.
  • 5. Optionally enforce that API contract changes (OpenAPI spec) are reviewed before tests are altered.

Evidence

When a commit touches a test file, block merge unless one of these is true: A human reviewed the test change explicitly. The assertion count went up, not down. The change to a threshold is paired with a comment explaining the new number.

Source

It won't catch every weakening. It will catch the automated kind, which is the kind that compounds.

Source

The defense that sticks for us is keeping the OpenAPI spec as the thing the test runs against, not the test that the agent freely edits.

Source

  • Record date: 2026-10-10T00:55:57.719Z