Wink: Recovering from Misbehaviors in Coding Agents
Organizations: Meta Platforms, Inc. New York, NY, USA · Meta Platforms, Inc. Bellevue, WA, USA · Meta Platforms, Inc. Menlo Park, CA, USA
Abstract
Autonomous coding agents, powered by large language models (LLMs), are increasingly being adopted in the software industry to automate complex engineering tasks. However, these agents are prone to a wide range of misbehaviors, such as deviating from the user's instructions, getting stuck in repetitive loops, or failing to use tools correctly. These failures disrupt the development workflow and often require resource-intensive manual intervention. In this paper, we present a system for automatically recovering from agentic misbehaviors at scale. We first introduce a taxonomy of misbehaviors grounded in an analysis of production traffic, identifying three primary categories: Specification Drift, Reasoning Problems, and Tool Call Failures, which we find occur in about 30% of all agent trajectories. To address these issues, we developed a lightweight, asynchronous self-intervention system named Wink. Wink observes agent trajectories and provides targeted course-correction guidance to nudge the agent back to a productive path. We evaluated our system on over 10,000 real world agent trajectories and found that it successfully resolves 90% of the misbehaviors that require a single intervention. Furthermore, a live A/B test in our production environment demonstrated that our system leads to a statistically significant reduction in Tool Call Failures, Tokens per Session and Engineer Interventions per Session. We present our experience designing and deploying this system, offering insights into the challenges of building resilient agentic systems at scale.
Figures & tables
| Misbehavior Category | Trajectories Detected | Prevalence |
| Loops | 2232 | 5.21% |
| DNF | 6827 | 15.95% |
| UC | 2833 | 6.62% |
| Tool Call Failure | 6001 | 14.02% |
| Total Misbehavior Categories | 12,499 | 29.2% |
| Misbehavior Category | Prevalence in Sonnet 4.5 (%) | Prevalence in Opus 4.5 (%) |
| Did Not Follow Instructions | 18.69 | 13.19 |
| Unrequested Changes | 6.55 | 5.2 |
| Infinite loops | 2.18 | 3.59 |
| Tool Call Failure | 10.99 | 11.08 |
| Misbehavior Category | Sample Size | Agent Recovered | Agent Not Recovered | % Agent Recovery Rate |
| Reasoning Problems | 963 | 908 | 55 | 94.29 |
| Tool Call Failure | 2604 | 2386 | 218 | 91.63 |
| Specification Drift | 1627 | 1429 | 198 | 87.83 |
| Overall | 5194 | 4723 | 471 | 90.93 |
| Misbehavior Category | Sample Size | Agent Recovered | Agent Not Recovered | % Agent Recovery Rate |
| Reasoning Problems | 2414 | 1781 | 633 | 73.78 |
| Tool Call Failure | 1531 | 1346 | 185 | 87.92 |
| Specification Drift | 1415 | 1111 | 304 | 78.52 |
| Overall | 5360 | 4238 | 1122 | 79.07 |
| Metric | % |
| Tool Call Failures | % ∗∗ |
| Tokens per Session | % ∗∗ |
| Engineer Interventions per Session | % ∗ |
| Agent Execution Time per Session | % |
| Outcome | Reason | % |
| Recovered | Recover from infinite loops | 39 |
| Remind original task with updated plan | 26 | |
| Ask agent to not overdo | 17 | |
| Provide right tool arguments | 17 | |
| Not Recovered | Agent ignored the course-correction instructions | 37 |
| Premature termination | 22 |
LLM Agent Reliability
Large language model (LLM) agent reliability concerns dependable, safe, and verifiable behavior across tools, multi-step tasks, and changing environments.
See all 832 papers