Engineering
Fix the flakiest test every week
Every week, Merlin finds the test that failed most often without a code change, fixes the cause and opens a pull request. You get the link in #eng.
@Merlin every Monday at 10:00, use gh to find the test in acme/web that failed most often last week and then passed on a rerun of the same commit. Find why it's flaky, fix the cause and open a pull request with the failure count and the evidence, then post the link here. Don't skip or delete the test or add retries; if you can't find the cause, post what you found instead.
Starts whenA weekly schedule runs every Monday at
10:00and posts to#engMerlin worksClaude Code or Codex uses gh to find the test that failed most often last week and passed on a rerun of the same commit, then fixes the cause
- You getA pull request with the fix and the evidence, linked in
#eng
Tools
- GitHub
- Slack
Capabilities
- Automations
- Integrations
How it works
From last week's CI history to a fix for the flakiest test.
A weekly schedule starts a run every Monday at 10:00 and posts to
#eng.Claude Code or Codex uses
ghto find the test that failed most often last week and then passed on a rerun of the same commit. It works out why, fixes the cause and reruns the test until the fix holds. No skips and no retries.The link lands in
#engwith the failure count and the evidence. If no cause turns up, the post says what Merlin found instead.
A weekly schedule starts a run every Monday at 10:00 and posts to #eng.
Claude Code or Codex uses gh to find the test that failed most often last week and then passed on a rerun of the same commit. It works out why, fixes the cause and reruns the test until the fix holds. No skips and no retries.
The link lands in #eng with the failure count and the evidence. If no cause turns up, the post says what Merlin found instead.
Overview
Agents
Skills
Memory
Automations
Integrations
Settings
Fix the flakiest test every week
PauseDetailsRun history
Trigger
When Merlin runs it.
Run
What Merlin does each time, where it runs, and where the result goes.
every Monday at 10:00, use gh to find the test in acme/web that failed most often last week and then passed on a rerun of the same commit. Find why it's flaky, fix the cause and open a pull request with the failure count and the evidence, then post the link here. Don't skip or delete the test or add retries; if you can't find the cause, post what you found instead.
Before and after
Flaky tests get fixed one a week instead of rerun forever.
Without Merlin
Everyone reruns red jobs and moves on, and nobody owns finding the worst offender.
- 01List last week's failed runs
- 02Find reruns of the same commit
- 03Count failures per test
- 04Reproduce it in a loop
- 05Read the test and its setup
- 06Find the race
- 07Fix the cause
- 08Run it 200 times
- 09Open a pull request
- 10Post the link in #eng
With Merlin
Every Monday the worst flake gets a fix up for review.
- Every Monday at
10:00Weekly schedule posting to #eng Finds and fixes the flake on Omar's MacBookClaude Code with gh, no skips or retries
- Fix pull request linked in
#engWith the failure count and the evidence
Setup
Sign in gh on a machine with the code, then schedule it from #eng.
Set these up once and a flake fix arrives every Monday. Whoever sends the prompt becomes the automation's creator.
- 01Connect a machineRuntimeInstall the Merlin desktop app or CLI on a computer running Claude Code or Codex. You can also use a machine a teammate shares with your workspace.
- 02Install the GitHub appIntegrationsPick the repositories Merlin can access, so it can read and link the pull requests there. Pushes use the machine owner's own Git access.
- 03Sign in to the gh CLIRuntimeSome steps use
gh, so sign it in on the machine that runs this. - 04Keep your code on the machineRuntimeMerlin reads the code in a local project on the runtime, so keep the repository checked out there.
- 05Add Merlin to SlackIntegrationsInstall the Slack app and add Merlin to the channel you work in. A private channel needs
/invite @Merlin. - 06Keep reruns in your Actions historyRuntime
A flake here is a test that failed and then passed when the same commit's workflow was rerun, read from your GitHub Actions runs with
gh. If your team never reruns failed jobs, there is nothing for it to count. - 07Paste the setup promptAutomationsSend the prompt below to @Merlin in Slack, in the channel it should post to. Merlin creates the automation and tells you what it set up.
Prompt
Schedule the weekly flake fix with one message in #eng.
@Merlin every Monday at 10:00, use gh to find the test in acme/web that failed most often last week and then passed on a rerun of the same commit. Find why it's flaky, fix the cause and open a pull request with the failure count and the evidence, then post the link here. Don't skip or delete the test or add retries; if you can't find the cause, post what you found instead.
Once, when you send it
- PromptYou send the prompt to @Merlin
- AutomationMerlin creates the automation
Every scheduled run
- ScheduleThe schedule starts a run
- RuntimeMerlin picks the creator's machine first
- ContextThe run gathers context
- WorkClaude Code or Codex finds and fixes the flaky test
- ResultMerlin links the pull request in #eng
- SteeringReplies in its thread follow up
Related use cases
More engineering tasks you can hand to Merlin.
- IntegrationsSkills
Engineering
Fix a red CI run
Mention Merlin on a pull request with a failing check. It reads the job log, reproduces the failure and pushes a fix, or shows why the test is flaky.
@usemerlin-aion a pull request with a red checkA fix commit, or a flake verdict with evidence - Integrations
Engineering
Speed up a slow test suite
Ask Merlin in Slack to speed up a slow test suite. It profiles it, fixes the slowest tests or setup and opens a pull request with the before and after times.
@Merlinin#engA pull request with before and after times - Integrations
Engineering
Add the missing tests to a pull request
Mention Merlin on a pull request that needs tests. It writes tests for the changed code, runs them and pushes them to your branch.
@usemerlin-aion a pull request that needs testsTests pushed to the branch
Bring your coding agents into the tools your team already uses.
Let your whole team hand work to Claude Code and Codex today. Connect one machine and add Merlin to Slack, Linear or GitHub. 14-day free trial, no API keys, no card.