Agent reads new user messages after tool-call batches, not mid-flight, causing race conditions during iterative work

Resolved 💬 3 comments Opened May 9, 2026 by BSKapps Closed May 12, 2026

Summary

When a user sends a follow-up message while the agent is executing tool calls (e.g. an Edit), the agent appears to:

  1. Finish the in-flight tool call and respond based on the original prompt
  2. Then read the new user message
  3. Then act on that message -- often making a fix the user already corrected, or doing the opposite of what they just asked

The result is a confusing pattern where the agent is "behind and ahead at the same time" -- still acting on outdated context while the user has already moved on or course-corrected.

Expected behavior

The agent should detect new user messages mid-stream and incorporate them into its reasoning before continuing to act, especially during rapid iteration where the user is actively correcting course.

Reproduction

  1. Start a multi-turn iterative task (UI tweaking, bug hunting, design feedback)
  2. While the agent is mid-action on the previous request, type a correction
  3. Send it
  4. Agent finishes its current action based on the previous prompt
  5. Agent then reads the correction
  6. Agent applies a follow-up change -- often undoing what was just fixed, or fixing the wrong thing

Impact

Significant in multi-turn iterative work where the user gives feedback rapidly. Causes:

  • Wasted tool calls (Edit -> revert Edit -> re-Edit)
  • User frustration ("you're behind and ahead at the same time")
  • Confusion about what state the file is actually in
  • Loss of trust in agent decisions

Notes

This was particularly noticeable in auto mode, where the agent is biased toward executing immediately. Auto mode amplifies the problem because the agent doesn't pause to check for new messages before firing the next action.

View original on GitHub ↗

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