Skip to main content

Tests as My Verification Loop: Self-Running, Red-or-Green

PhaseTestingRolesEngineer · QA EngineerSeverityMediumApplies toAll coding agentsEvidenceOfficial docs

In one sentence: Runnable checks give me real feedback, but green only means the covered assertions passed. Give the loop acceptance criteria, a budget, and a no-progress stop condition, and verify that regressions detect the original defect.

Symptom​

I read the code and declare completion; you run it and find a window-boundary error. Tests let me observe and fix failures. But wrong assertions, missing dependencies, or flaky checks can make “keep going until green” a loop without progress.

Why this happens​

Runtime feedback checks concrete behavior and reduces reliance on looking correct. Its quality depends on contracts, assertions, data, and environment. Lint, builds, type checks, and behavioral tests cover different problems and cannot replace each other.

A loop guarantees neither convergence nor complete correctness. Diagnose repeated failures; do not delete assertions, relax acceptance, or fabricate fixtures for a green signal.

Consequences​

  • Code that has not been run is treated as complete and failures reach acceptance later.
  • Incorrect tests drive implementation toward the wrong target.
  • Unbounded loops consume time, tokens, and external-service resources.

What to do instead​

Confirm acceptance, then verify implementation through a bounded loop.

  1. Reuse existing checks. Add missing assertions and infrastructure according to risk; a mechanical, low-impact change need not create a new testing system.
  2. A regression should fail on the old implementation because of the target defect, then pass after fixing it. Test and fix can share a commit or PR. Commit boundaries do not establish whether red was observed; retain both runs as evidence.
  3. Distinguish implementation failures, incorrect tests, environment blockers, and flaky tests. Explain and review justified test corrections; do not silently change acceptance criteria.
  4. Set time, tool-call, or spending limits and a no-progress stop condition. Report failure output, attempts, and next steps when limits are reached; see runaway loops.
  5. After green, check requirement coverage and necessary human review. Rerun relevant checks for new changes without repeatedly expanding testing without reason.

Example​

Before:

You: Keep fixing until everything is green.
Me: The same environment failure repeats, and I eventually skip the test.

After:

You: Reproduce the cross-minute limiter error, then fix it; retain old-fails/new-passes evidence.
This run has 20 minutes. Stop after two attempts without progress, report the blocker, and do not skip acceptance.
Me: I confirm the target failure, fix it, run relevant regressions, and record deployment checks still uncovered.

When the exception applies​

Copy, comments, or other low-impact mechanical changes may need only appropriate static checks and inspection. Review is still possible without an executable signal, but identify what remains unverified rather than calling “not run” a pass.

Version notes​

Verified 2026-10-29

Runnable verification is an engineering method, not an all-model correctness guarantee. Budget and stopping controls vary by tool surface; verify limits in the actual controller/CI rather than only writing them in a prompt.

Further reading and sources​