I handed Devin AI a complex refactor job and came back three hours later to find it still re-running the same test in the same file. No progress, same error message, ACU counter still climbing the whole time. Devin AI getting stuck on long-running tasks is actually a pretty common problem, and most of the time it’s not just one cause — a few different mechanisms tend to kick in at once.
In this post I’ll go through what actually works versus what just sounds like good advice on paper. Some of this comes from official docs, some from my own trial and error.
Quick Answer
- Devin’s performance degrades over long sessions — Cognition’s own recommendation is to keep sessions under 10 ACU
- The “infinite loop” is the most common type of stuck state: the same edit-run-fail cycle repeating
- A max_steps limit and the “Human Intervention” button are the fastest ways to recover
- Startup commands in machine snapshots have a hard 2-minute timeout — long-running server commands won’t work there
- Vague task descriptions (no file paths, no expected behavior, no test criteria) are the most overlooked cause of getting stuck
Why It Gets Stuck — The Real Technical Causes
It falls into an infinite loop because the solution space has run dry. While trying to fix a bug, Devin sometimes ends up in an edit-run-fail cycle and can’t break out of it on its own. The fix here is usually setting a max_steps limit in the configuration, or using the “Human Intervention” button in the UI.
The task description isn’t specific enough. Prompts like “fix the bug” or “improve performance” push Devin toward wrong solutions, guesswork, or repeatedly asking for clarification. Tasks that include file paths, line numbers, expected behavior, and test cases show a noticeably higher success rate — I’ve confirmed this myself a few times, and honestly the difference surprised me the first time I saw it.
The session runs too long and Devin’s performance drops. Cognition’s own guidance is clear here: keep sessions under 10 ACU, because Devin’s performance degrades in long sessions. That sounds a little odd at first — why would working longer make things worse — but it’s probably tied to context growing and earlier decisions starting to conflict with the current state of things.
Environment mismatch. Devin’s sandbox runs on Linux (Ubuntu), but if your project assumes macOS-style paths, that mismatch can cause weird errors and repeated failed attempts. This one’s tricky to spot because the error message usually looks innocent — something like “file not found” — when the real cause is the environment difference.
Context hallucination. Devin sometimes references files that don’t actually exist, and wastes time trying to work around references that aren’t real. Explicitly listing key file paths in the prompt, or using the @file selector, cuts this down a lot.
“System 2” thinking — sometimes it’s not stuck, just slow. On complex tasks, Devin might be simulating multiple solutions before picking one. That’s not really a stuck state, just slow progress, and it can be hard to tell the difference. Checking the command history through Shell Updates usually clears it up though — if the commands keep changing, it’s progressing; if the same command keeps repeating, you’re probably looking at a loop.
Where This Shows Up in Different Scenarios
- Large refactor jobs — ACU consumption climbs fast on tasks touching a lot of files, and the performance drop from long sessions becomes more noticeable the longer it runs.
- Legacy code migrations (COBOL, Fortran, Objective-C, etc.) — these are naturally long and high-ambiguity tasks, so without checkpoints they can run for hours without real progress.
- Tasks wired into CI/CD — Devin automatically responds to PR comments and CI failures, but if CI keeps failing the same way, that can turn into its own kind of loop.
- Repetitive tasks that need a playbook — thanks to Universal Planner, Devin can now handle multi-step looping tasks more reliably without a Playbook, but tasks attempted without one are more likely to get stuck.
Technical Comparison: Types of Stuck States and Fixes
| Type of stuck state | Symptom | Most effective fix |
|---|---|---|
| Infinite edit-run-fail loop | Same error repeating in the same file | max_steps limit + Human Intervention button |
| Environment mismatch | Vague errors like “file/command not found” | Use a Dockerized environment |
| Vague task description | Devin keeps asking for clarification or making wrong assumptions | Add file paths, line numbers, test criteria |
| Long-session fatigue | General slowdown, inconsistent decisions | Keep sessions around 10 ACU, split the task |
Step-by-Step Fixes
Step 1: Check Shell Updates for Actual Progress
During a session, you can click into Devin’s progress updates to see the specific shell commands it used while working through sub-tasks. If the command history shows different commands over time, it’s progressing. If the same command keeps repeating, it’s probably in a loop.
Step 2: Set a max_steps Limit
Setting a step limit in the configuration stops Devin from burning hours in an infinite loop. Once the limit is hit, you get a chance to step in, and ACU waste stays minimal.
Step 3: Don’t Hesitate to Use “Human Intervention”
That button can feel a little like giving up, but it’s actually the most practical recovery tool available. If Devin keeps trying the same approach over and over, manually redirecting it can save you hours.
Step 4: Break the Task into Smaller Pieces
Instead of asking for one massive refactor in a single shot, splitting the work into smaller pieces across separate sessions keeps ACU consumption in check and lowers the risk of getting stuck. It’s also recommended to kick off 2+ Devin sessions for some tasks — this gives the task a better shot at success since each session might try a different path.
Step 5: Make Your First Instruction as Detailed as Possible
Specific requirements, a high-level description of the task, and what Devin should do after making the changes (testing instructions, PR guidelines, or telling it to wait for CI instead of testing locally) should all go in the first message. It feels like extra work up front, but it takes far less time than intervening later.
Step 6: Add Frequently Used Instructions to Knowledge
If you’re typing the same instructions over and over, it makes sense to add them to Devin’s Knowledge section. Devin automatically recalls this in future sessions, so you don’t have to re-explain it every time.
Step 7: Use a Dockerized Environment
Since Devin’s sandbox is Linux-based, if your project assumes macOS-specific paths or dependencies, you can run into strange, repeating errors. Using Docker mostly eliminates that mismatch.
What Actually Worked For Me
At first I assumed the problem was the ACU limit — “maybe I’m just not giving it enough resources, that’s why it’s stalling out.” I raised the limit, nothing changed, I just burned more ACU for no reason. That was delaying the problem instead of solving it, honestly.
The actual issue was that my task description was too vague. I’d written something like “fix the bug in the auth module” without specifying which file, which function, or what the expected behavior was. Devin kept trying different assumptions as a result, drifting slightly differently each attempt — which, from the outside, looked like it was “stuck,” but it was really just cycling through different guesses.
What ended up fixing it was something I half-remembered from an old forum comment: pointing directly at the file path and line range using @file. Once I did that, Devin went straight to the right place on the first try. Maybe a bit of luck involved, but it almost certainly cut down the context hallucination. Still, on some tasks I end up needing a second session — it doesn’t always get solved in one shot, worth admitting that upfront.
Advanced Fixes and Edge Cases
Machine snapshot startup commands timing out. Each command has a fixed 2-minute timeout, so you can’t run long-running servers through these commands. If you’re seeing it get stuck during the snapshot startup step, you’re probably hitting this limit — move long-running processes to a separate step.
Devin seems stuck on the same action or won’t wake up. Cognition acknowledges this as a known issue and asks users to report it via Slack Connect or [email protected]; they’ll also refund ACUs in cases like this. So instead of debugging this yourself for hours, it’s worth reaching out to support first.
Spotting patterns through the PR Metrics Dashboard. The PR metrics view at app.devin.ai/metrics aggregates every PR Devin has made. Checking this periodically lets you see which task types keep running into trouble at a pattern level, rather than just session by session.
Reconsider looping tasks with Universal Planner. If a task requires repeating the same action many times — say, the same change across hundreds of files — Universal Planner can now handle this kind of work more reliably without needing a Playbook. If you’ve had repeated stuck states on this type of task before, it’s worth trying again on a current version.
Fixes That Sound Right But Rarely Help
Raising the ACU limit is the most commonly suggested “fix,” but it doesn’t actually address the root cause — it just lets Devin keep going down the wrong path for longer. Don’t reach for this first even if budget isn’t an issue.
Restarting the session from scratch sometimes helps too, but more often than not you just land back in the same loop with the same vague task description. Restarting without fixing the task description is a short-term relief that tends to repeat the same problem down the line.
Prevention Tips
- Break tasks into small, checkable pieces from the start
- Always include file paths, expected behavior, and test criteria in the first instruction
- Try to keep sessions around 10 ACU, and move the task to a new session if needed
- Build a Playbook for repetitive tasks; trust Universal Planner for one-off complex tasks
- Use Docker if your project carries platform-specific assumptions
- Check Shell Updates regularly so you can intervene early instead of letting hours pass
FAQ
Why does Devin sometimes take far longer than it should to finish a task? On complex tasks, it might be simulating multiple solutions before picking one — that’s not always a failure, sometimes it’s just slow progress.
How low should I set the max_steps limit? There’s no fixed number, it depends on task complexity. Starting low on simple tasks and raising it as needed is safer than setting a high limit from the start.
I noticed Devin seems to be asleep or not waking up — what should I do? Contact Cognition support — via Slack Connect or [email protected]. This is a known category of issue, and ACU refunds are possible.
Does running multiple sessions for the same task actually help? Usually yes, especially when there’s high ambiguity. Each session might try a different solution path, which improves the overall odds of success.
Is Docker mandatory? Not mandatory, but strongly recommended if your project carries macOS-specific assumptions, otherwise you’re likely to run into strange environment errors.
Editor’s Opinion
The first instinct when Devin AI gets stuck on a long task is usually “give it more resources,” but that’s rarely the actual problem. Tightening up the task description, setting a max_steps limit, and keeping an eye on Shell Updates together solve most stuck states. Not perfect, sometimes you still need a second session, but at least it stops you from burning hours of ACU for nothing.