Free tools Windows power users keep installed
One-click scans. No signup required.
Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
To fix flaky tests in GitHub Actions, start with the failed run’s evidence, then isolate whether nondeterminism comes from test state, ordering, parallelism, timing, threads, or the runner environment. A rerun can confirm that a failure is intermittent, but a green rerun by itself is not a diagnosis.
This guide shows a repeatable path from log inspection to a durable fix. It also explains when to rerun one job, failed jobs, or the entire workflow; how matrix settings can distort results; and how to use retries or quarantine without hiding regressions.
As an Amazon Associate I earn from qualifying purchases.
Recommended Free Tools
What is a flaky test?
A flaky test fails intermittently without a corresponding code change and appears to behave nondeterministically. The pytest documentation defines a flaky test as one that exhibits “intermittent or sporadic failure” that seems nondeterministic. The same pattern applies whether the test runner is pytest, Jest, JUnit, Go, Playwright, or another framework.
Flakiness is a reliability problem in the feedback signal. A failure that disappears on rerun may still indicate leaked data, an order dependency, a race, an overly strict assertion, or a difference in the Actions environment. Treat the original failure and the successful rerun as two pieces of evidence, not as a pass/fail verdict about the code.
Popular on Amazon
- 【90 Degree Full Function USB C Adapter】Supports the latest USB4 standard for up to 40Gbps of bandwidth, 8K video support, and up to 240W Fast charging; Support USB PD 3.1 Extended Power Range (EPR) including 140W, 180W and 240W. Your productivity is easily doubled. *Warm Tip: For the best fit, please make sure the USB-C port is fully exposed; thick or bulky cases may affect compatibility.
- 【Reliable Quality】Made from high-quality, scratch-resistant aluminum alloy, delicate metal frame. get excellent wear resistance and heat dissipation. Non-Slip Design for easier insertion and removal.
- 【Small and portable】Ultra thin size, ultra compact design, a petite physique that matches the minimalist design of your modern laptops. Coming with a slim figure that won't block the port next to the one it's plugged into.
- 【Compatibility】Widely work with most usb c, thunderbolt 4/3 devices. Compatibilit for ROG Ally, Steam Deck, Switch, MacBook Pro, Quest 3 VR headset, Surface Book 2, iPhone 18/17/16/15, Samsung Galaxy S23/S22/S21, Note 20/10, Google Pixel, ChromeBook, etc.
- 【Excellence Customer Support】If you experience any issues or cable failure, simply reach out to our dedicated customer service team. We provide a prompt response within 18 hours, providing you with the necessary technical support to resolve any concerns.
How should I investigate a flaky GitHub Actions failure first?
Begin with the exact failed step and the setup immediately around it. Do not start by adding retries or increasing every timeout.
- Open the run: In the repository, open Actions, select the workflow run, choose the failed job, and expand the failed step.
- Read the first useful error: The final “process exited” line is usually only a consequence. Capture the assertion, exception, timeout, exit code, or service error that appeared first, plus nearby setup and teardown output.
- Compare a failure with a success: Record the commit, ref, runner image, tool versions, test command, shard or matrix values, seed or order (if available), and elapsed time. GitHub’s workflow run logs documentation explains how to inspect logs, setup information, runner-image details, and links to available preinstalled tools.
- Save a permalink: Link the relevant log line in an issue or pull request so another person can inspect the same evidence. Avoid pasting only the summary at the bottom of the job.
If the ordinary output is insufficient, rerun the smallest useful scope with debug logging. The UI offers a debug option when starting a rerun, and the GitHub CLI command is:
gh run rerun RUN_ID --failed --debug
GitHub documents rerunning all jobs, failed jobs, or a specific job in Re-running workflows and jobs. Debug output adds context; it does not make a nondeterministic test deterministic.
Which part of a workflow should I rerun?
Choose the scope that answers your current question. A smaller rerun is faster and keeps the evidence focused; a broader rerun is useful when jobs interact.
| Rerun scope | Use it when | What to remember |
|---|---|---|
| One specific job | You want to isolate the failing test area or one matrix combination. | Dependent jobs may run again; unrelated jobs retain their previous outputs. |
| Failed jobs | Only the failed portions need fresh execution. | Jobs that depend on a rerun job can also run again. |
| Entire workflow | The failure may involve interactions, artifacts, outputs, or ordering across jobs. | Every job gets a new execution, so runtime and diagnostic noise increase. |
A rerun uses the original triggering actor’s privileges and the original event’s GITHUB_SHA and GITHUB_REF. That makes it useful for checking the same revision, but it does not recreate the exact same machine state, cache state, network conditions, or timing. GitHub currently allows a rerun up to 30 days after the initial run and permits a maximum of 50 reruns for one workflow run; those are feature limits, not evidence that repeated reruns are a sound fix.
How do I tell whether shared state is causing the failure?
First test the hypothesis that another test, fixture, process, or job is leaving state behind. Flaky behavior often means the test assumes a clean database, filesystem, environment variable set, singleton, cache, or service when that assumption is not enforced.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →- Give each test isolated records, temporary directories, ports, and resource names where possible.
- Delete or reset resources in teardown even when the test fails partway through.
- Do not rely on data created by an earlier test. Create the minimum state required inside the test or a clearly scoped fixture.
- Restore global configuration, environment variables, working directories, locale settings, clocks, and mock registrations after each test.
- Make setup idempotent: running it twice should not produce a different result from running it once.
A useful experiment is to run the suspected test alone, then run it after the test that commonly precedes it, and finally run the pair in reverse order. If only one sequence fails, you have evidence of order dependence rather than a random assertion failure. Keep the command, order, and resulting logs with the issue.
Parallel execution can expose the same defect. Two tests may write the same row, use one fixed port, mutate a process-wide setting, or delete each other’s temporary files. The pytest guide specifically warns that tests modifying global state may not be safe in parallel. Temporarily run the relevant subset serially to test the hypothesis, then remove the shared-state assumption instead of permanently disabling parallelism.
Also popular on Amazon
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
How do I find test-order and parallelism bugs?
Change one execution variable at a time and record the result. Randomized ordering is useful for discovery; deterministic ordering and isolated fixtures are the fix.
- Repeat a known sequence: Run the failing test with the same preceding tests, shard, and worker count. If the failure follows a particular predecessor, inspect what that predecessor mutates.
- Vary order: Use your framework’s order-randomization facility. pytest lists
pytest-random-orderandpytest-randomlyas examples that can expose hidden state dependencies. - Vary concurrency: Compare one worker with the normal worker count. A failure that disappears with one worker points toward shared resources, unsafe globals, or a race.
- Make the test self-contained: Allocate unique resources, synchronize access, and clean up in a guaranteed teardown path.
Do not treat “passes when run alone” as proof that the test is correct. Isolation can hide the interaction that causes the production-like failure. The goal is to identify the state transition that was not controlled and make it explicit.
Are the assertion or timeout too strict?
A test can be flaky even when the implementation is behaving within its documented contract. Floating-point equality, exact timestamps, eventual-consistency windows, and arbitrary sleeps are common examples.
- Floating point: Compare with an appropriate tolerance or approximate comparison rather than exact binary equality when the product contract permits a range. pytest’s flaky-test guidance calls out approximate comparison for floating-point results.
- Timing: Assert the condition the test actually needs—such as a state transition, visible element, completed job, or released lock—instead of sleeping for a guessed duration.
- Deadlines: Set a bounded timeout that reflects the documented behavior. A longer sleep can reduce the observed frequency while leaving the race intact.
- Poll intervals: If polling is necessary, log the condition and deadline so a timeout shows what was still missing.
- Time sources: Avoid comparing wall-clock timestamps when monotonic elapsed time is the real requirement.
When increasing a timeout appears to help, compare the failing and passing runs’ elapsed times and service logs. The evidence may show a slow dependency, a startup race, or a cleanup leak. Fix that condition or wait for the real signal; do not convert an unknown delay into a larger magic number without a reason.
What should I check when tests use threads or background services?
Every thread, child process, server, and asynchronous task created by a test needs a defined lifetime. A test that exits while work is still running can leak state into the next test or terminate before an assertion observes the intended result.
- Keep a handle to each spawned thread or task.
- Signal it to stop in teardown, even on an assertion failure.
- Join or await it before releasing its resources.
- Close sockets, temporary files, queues, and subprocess pipes.
- Protect shared data with the synchronization primitive appropriate to the code.
pytest also warns that primitives such as pytest.warns() and pytest.raises() are not thread-safe when used from multiple threads. If an exception or warning is expected from a worker, capture it in the worker and communicate the result back to the test thread rather than invoking a non-thread-safe assertion context across threads.
A race often becomes easier to see when you add structured logging around thread start, state changes, and shutdown. Include an identifier for the worker and the resource it touches. Remove diagnostic logging only after the lifecycle is deterministic.
How do I separate a test defect from a GitHub Actions environment problem?
Compare the execution environment, not just the source revision. A test that passes on a developer workstation may depend on a tool version, operating-system behavior, locale, filesystem ordering, CPU timing, or service startup condition that differs on the runner.
Also popular on Amazon
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
- Record the GitHub-hosted runner image and operating system shown in the job setup.
- Record language runtimes, package-manager versions, browser or driver versions, and other tools reported by setup steps.
- Compare environment variables, locale, timezone, permissions, filesystem paths, and available services.
- Check whether the failing matrix value, shard, or test seed is unique to the failure.
- Inspect setup and teardown output for cache misses, service startup failures, port conflicts, and resource exhaustion.
Use GitHub’s workflow troubleshooting guidance when the failure looks like a workflow or runner problem. A runner issue does not make the test result irrelevant: the test still needs either an environment requirement that is made explicit or a correction to the workflow that supplies it.
How do matrix and failure settings change what I see?
Workflow semantics can make a run look more or less complete than it really was. In GitHub Actions, jobs.<job_id>.strategy.fail-fast defaults to true; when a matrix job fails, GitHub can cancel queued or in-progress matrix jobs. A canceled combination is not evidence that its tests passed or failed.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorscontinue-on-error can allow an explicitly designated job to fail without failing the workflow. That setting changes the workflow result; it does not repair the test or make its signal reliable. When debugging, identify the exact matrix combination and whether it was canceled, allowed to fail, skipped, or actually completed. The workflow syntax reference documents these controls.
For a flaky matrix failure, rerun the specific combination first if the goal is reproduction. Rerun the full workflow when artifacts, outputs, or dependencies between jobs could be involved. Preserve the original run because a rerun may execute dependent jobs again and produce different downstream outputs.
What is the right permanent fix?
The right fix removes the source of nondeterminism and keeps the failure visible until that fix is verified. Match the change to the evidence:
| Evidence | Likely repair | What to verify afterward |
|---|---|---|
| Failure follows a previous test or shard | Isolate fixtures, reset globals, use unique resources, and clean up reliably. | Repeated randomized and serial runs no longer depend on order. |
| Failure appears only with multiple workers | Remove shared mutable state, synchronize access, or give each worker separate resources. | The normal worker count is stable without disabling parallelism. |
| Failure is a boundary-value or float mismatch | Use the product’s documented tolerance and an approximate assertion. | Assertions still catch real regressions outside the allowed range. |
| Failure occurs during startup or shutdown | Wait for a real readiness condition and await or terminate background work. | Logs show orderly startup and cleanup under slow and fast runs. |
| Only one runner image or tool version fails | Pin or update the required tool, or fix the workflow’s environment setup. | The requirement is explicit and the relevant matrix combinations are covered. |
If the same behavior is covered by a more deterministic lower-level test, consider rewriting the flaky higher-level test or removing redundant coverage. pytest’s guidance also discusses separating unit and integration suites, while warning that gating only on unit tests can allow integration regressions to merge if those results are not monitored.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWhen are retries or quarantine acceptable?
Retries are a short-term operational mitigation, not a root-cause fix. Use a bounded retry only when the original failure remains visible in logs or artifacts and someone owns the investigation. Track how often the first attempt fails, how often the retry passes, and when the mitigation will be removed.
Quarantine can keep a known issue from blocking unrelated work, but it needs an owner, an issue link, an expiration or review date, and a separate signal that still reports the failure. A non-strict expected-failure marker that permanently prevents the suite from failing is risky; pytest describes permanent non-strict xfail quarantine as “rather dangerous to use permanently.”
Also popular on Amazon
- Portable and powerful USB-C HUB: BENFEI USB Type-C HUB, with super-soft and knot-free silicone woven design cable, meets most mobile office needs. Compact, lightweight, stylish, and powerful portable USB C Hub equipped with 1 x HDMI port, 1 x 100W charging, and 3 x USB ports. 18-month warranty, 24-hour response, to ensure you feel at ease when using our product.
- Design centered on comfort and reliability: Thanks to BENFEI's end-to-end in-house cable production capability, in-house PCBA and assembly capability, using the industry's most advanced silicone woven design and process, 20cm cable in length, no knots, super-soft, the HUB is easy to use in all scenarios: laptop, tablet, stand etc. Super-soft, 25000+ life cycles, to meet your daily carrying and office needs.
- 100W Charging: Support up to 90W USB C pass-through charging via Type-C port to keep your laptop powered. 10W is reserved for other interface operations. No data and video function on the Type-C port.
- 4K HDMI Display: The HDMI port supports media display at resolutions up to 4K 30Hz, keeping every incredible moment detailed and ultra vivid. Please note that the C port of the Host device needs to support video output.
- Transfer Files in Seconds: Transfer files and from your laptop at speeds up to 10 Gbps with USB A 3.2 port. Extra 2 USB A 2.0 ports are perfectly for your keyboards and mouse.
Do not combine an unbounded retry with a silent quarantine. That arrangement can turn a real regression into a green check while destroying the evidence needed to repair it. Keep the original error, the rerun result, and the diagnostic context available to maintainers.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Why does a test pass locally but fail in GitHub Actions?
Usually the two environments differ in state, timing, tools, operating-system behavior, or concurrency. Local success proves only that one particular execution satisfied the test’s assumptions.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Start by reproducing the Actions command, worker count, test order, and relevant environment values as closely as practical. Then compare the runner setup information with the local toolchain. If the failure remains specific to Actions, decide whether the workflow must provide a missing dependency or whether the test incorrectly assumes local state such as a service, writable path, timezone, or preexisting data.
How do I know whether a green rerun means the bug is gone?
It does not, by itself. A green rerun establishes that the same revision passed under a different execution, while the original failure establishes that the test or environment can produce a different result.
Run the smallest diagnostic scope repeatedly with the suspected variable changed—order, worker count, seed, runner image, or setup timing—and look for a causal pattern. Close the issue only after the underlying condition is corrected and the test’s signal remains stable under the normal workflow configuration.
What information should I attach to a flaky-test issue?
Attach the workflow run URL, a permalink to the first relevant log line, commit SHA and ref, job and matrix values, runner image, tool versions, test command, shard or seed, and whether the first attempt or a rerun failed. Include the original failure and any successful rerun rather than replacing one with the other.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Also record whether the job was canceled by matrix fail-fast, allowed to fail with continue-on-error, or completed normally. That detail prevents a canceled or intentionally tolerated job from being misclassified as a passing test.
Can a GitHub Actions rerun use different code or permissions?
A rerun uses the original event’s ref and GITHUB_SHA, and it uses the original triggering actor’s privileges. It is therefore tied to the same revision and authorization context rather than the code currently at the branch tip.
Also popular on Amazon
- 【Read before You Buy】 Note: This adapter is USB 2.0 version and cannot transmit HDM, VGA, or other video signals. Nevertheless, they are fully capable of charging devices,duplicating files, and can be seamlessly integrated with USB-C earphones, wireless network adapters, and SD card adapters.
- 【Easy to Use and Safe】Thanks to modern manufacturing techniques, we've made these adapters sufficiently compact so that they can remain inserted in your device without noticeable protrusion or inconvenience. This means you don't have to constantly plug and unplug them, reducing the likelihood of wear and misalignment, and making them more convenient to carry around.
- 【Reliable Quality】Engineered for enhanced durability, durable aluminum alloy shell material,get excellent wear resistance and heat dissipation,the male USB C and female USB connectors & the male USB and female USB C connectors are designed to be plugged and unplugged up to 20000 times. Provides data transfer, device charging, memory space expansion, and additional computer peripherals.
- 【Think more for you】Do you need to connect a USB-C-enabled device to an odd device that only has USB-A ports? Then these USB-A male to USB-C female adapters are made for you.Simply insert the adapter into the USB-A port on the device, and you can instantly connect your USB-C device to the device that originally didn't have the correct connection port.
- 【Trusted xiwxi Quality and Service】As a responsible brand seller, you will receive xiwxi's 12-month Quality assurance and lifetime friendly customer service, you're not just buying a product,you're investing in peace of mind with all-round quality and exceptional customer service.
The machine state and timing can still differ, so a rerun is not a byte-for-byte reproduction of the first execution. Preserve both runs when comparing behavior.
How do I prevent flaky tests from returning?
Make determinism part of test and workflow design, not a cleanup task after the next incident.
- Give tests isolated data and unique resource names.
- Reset global state and environment changes in guaranteed teardown.
- Use readiness conditions and bounded deadlines instead of unexplained sleeps.
- Await every background task and close every service, file, socket, and subprocess.
- Record order, seed, shard, worker count, runner image, and tool versions in CI output.
- Run order-randomization and parallel checks periodically to expose hidden coupling.
- Review every retry or quarantine entry with an owner and removal criterion.
- Keep integration results visible even when unit tests are the primary merge gate.
When a failure recurs, follow the same sequence: preserve the original evidence, classify the nondeterminism, change one variable to test the hypothesis, then fix the state or environment that allowed the race. A reliable green build is the result of controlled execution—not simply a build that eventually passes after enough reruns.
Frequently Asked Questions
Does rerunning a failed GitHub Actions job create a new commit?
No. The rerun uses the original event’s ref and `GITHUB_SHA`, so it does not test uncommitted local changes or whatever the branch points to later. Commit a suspected fix and run a new workflow when you need to validate changed code.
Should I disable fail-fast while investigating a flaky matrix?
Only if canceled matrix combinations are preventing you from collecting evidence. Disabling fail-fast can reveal more combinations in one run, but it changes runtime and does not fix the test; restore the intended policy after diagnosis.
How can I tell a timeout from a race condition?
Compare logs from fast and slow runs and record the condition being awaited, not only the elapsed duration. A timeout whose observed state is incomplete or out of order points toward synchronization or readiness; a consistently exceeded documented limit points toward capacity or environment setup.
Is it better to delete a flaky test?
Delete or rewrite redundant coverage only when another test verifies the same behavior more deterministically and the failure is not exposing a real product risk. Removing the only coverage of an important path hides the signal rather than fixing it.

