The worst CI failure is not red. It is the job that sits at 43 minutes of a 45-minute timeout, says nothing, and then dies as “cancelled”. I had no idea which test did it, so I re-ran it. The pipeline was now a slot machine.
The usual suspects
Most Flutter CI hangs are one of these:
awaiton a real timer insidetestWidgets- fake async never advances, the future never completes.- A
Completerthat only completes in a code path your mock skipped. pumpAndSettleon an animation that never settles (looping spinners are the classic) - fast to fail in a widget test, ten real minutes per call underintegration_test.- Platform channel calls with no mock handler - the message never comes back.
testWidgets('sync page', (tester) async {
await tester.pumpWidget(const SyncPage());
// the mock never completes syncDone, and real-async time has no timeout
await tester.runAsync(() => syncDone.future);
});Turn a hang into a named failure
The fix is procedural, not heroic: wrap suites with a watchdog that fails fast and prints the test name. A 45-minute silent hang becomes a 30-second failure that says sync page: timed out waiting for syncDone.
Update, November 2026: the watchdog is now part of tarpit. dart run tarpit points at the test lines that will stall, and importing package:tarpit/flutter_test.dart instead of flutter_test fails a stalled testWidgets with a reason.
Fixing the bug is one job; fixing the feedback loop is the one that keeps paying - a CI you trust is a CI you actually ship from.