Agent enters infinite "Puttering" loop after task completion — consuming tokens with no output

Resolved 💬 3 comments Opened Apr 23, 2026 by EOSTech-dev Closed May 27, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Bug Report: Agent enters infinite "Puttering" loop after completing task — consuming tokens with no output

---

Summary

After completing a full agentic task (web searches + structured response), Claude Code entered an infinite internal loop showing only:

✻ Puttering… (27s · ↓ 783 tokens · still thinking)

This repeated 50+ times without any new output, user interaction, or task progress — burning tokens continuously until manually interrupted.

---

Steps to Reproduce

  1. Send a research-heavy prompt requesting multiple parallel web searches and a structured comparative response
  2. Agent completes all searches and generates the full final answer
  3. Agent does not terminate — instead enters a "Puttering" state loop
  4. Loop repeats indefinitely (observed 50+ iterations) with no output and no stop condition

---

Prompt sent (translated from Portuguese)

"I need ideas to invest up to R$50,000 in a self-scaling business in Brazil. The money will be paid in installments, so the business must cover payments and generate profit. Give me at least 5 real, logical ideas — no hallucination or dreaming. Use specialist skills and web search."

---

Observed Behavior

  • Agent ran 6 web searches correctly
  • Agent generated a complete, well-structured final answer (5 business ideas with comparative table)
  • Instead of terminating, agent re-entered internal loop
  • Terminal showed ✻ Puttering… with token counter incrementing on every cycle
  • No new output was produced
  • Loop only stopped via manual interruption (Ctrl+C)

---

Expected Behavior

Agent should detect task completion after delivering the final response and terminate cleanly.

---

Environment

  • OS: macOS (Apple Silicon M4 Pro)
  • Claude Code version: 2.1.118 (Claude Code)
  • Shell: zsh
  • Task type: multi-step agentic with web search tools

---

Impact

This is not a minor UX issue. The infinite loop consumed a significant number of tokens after the task was already complete, resulting in real financial cost to the user with zero value delivered. This has occurred more than once.

Requesting:

  1. A fix for the missing termination condition after task completion
  2. Clarification on whether token consumption during "Puttering" loops qualifies for usage credit

---

Additional Notes

The agent's final output before the loop was complete and correct — this is purely a loop/termination control bug, not a generation quality issue.

What Should Happen?

After delivering the final response, the agent should detect task completion and terminate cleanly without re-entering any internal loop.

Error Messages/Logs

✻ Puttering… (27s · ↓ 783 tokens · still thinking)

Repeated dozens of times until manually interrupted with Ctrl+C.

Steps to Reproduce

  1. Send a research prompt requesting multiple parallel web searches and a structured response
  2. Agent runs all searches and delivers a complete final answer
  3. Agent does not terminate — enters "Puttering" loop instead
  4. Terminal shows: ✻ Puttering… (27s · ↓ 783 tokens · still thinking)
  5. Loop repeats dozens of times with no output until manually interrupted with Ctrl+C

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.118 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗