Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
Foreground shell commands are causing Cursor to automatically start another Agent request after the main turn has already finished.
In this session, the Agent used normal foreground Shell calls for tests, lint, build and browser QA. It did not request background execution.
After the Agent produced its final report and the turn ended, Cursor showed “Finished 16 background tasks”, automatically resumed the Agent, ran another git status, and generated a second Task Summary.
I did not send another prompt.
Steps to Reproduce
- Start a normal Agent task that runs several finite shell commands such as tests, lint or build.
- Let the Agent run those commands as normal foreground Shell calls.
- Let the Agent finish the task and produce its final response.
- After the main turn ends, Cursor may show “Finished N background tasks”.
- Cursor then automatically resumes the Agent to process those shell completion events.
- The resumed Agent may run additional commands and produce another response even though the user did not send another prompt.
For my reproduced session, 16 foreground shell completions were dispatched immediately after the original Agent turn ended.
Expected Behavior
A shell command that completes as a normal foreground Agent command should not later be treated as a background task completion that resumes the Agent.
Once the Agent has produced its final response and the turn has ended, Cursor should not start another Agent request unless I send another prompt or the Agent explicitly created a background task that requires a later resume.
Screenshots / Screen Recordings
Operating System
Linux
Version Information
Version: 3.20.21
VS Code Extension API: 1.128.0
Commit: f09fca384ceca23f7bf21f9c23655b162641d740
Date: 2026-09-13T19:02:51.781Z
Layout: Agent Window
Build Type: Stable
Release Track: Default
Electron: 42.10.0
Chromium: 148.0.7778.280
Node.js: 24.18.1
V8: 14.8.178.38-electron.0
xterm.js: 6.1.0-beta.291
OS: Linux x64 7.0.0-31-generic
For AI issues: which model did you use?
Gemini 3.8 Flash High
For AI issues: add Request ID with privacy disabled
Automatically resumed request:
9457b996-b90c-48bd-a5ec-ac8f130756fa
Original main request:
fdb6a754-e7b7-436e-9178-9f1c8ba44ad8
Additional Information
I checked the local Cursor transcript and request traces for this specific session.
Agent ID:
da680e0b-cad9-4cde-9886-759221928386
The original Agent turn ended successfully, then Cursor dispatched a second request through dispatchBackgroundTaskCompletionAction.
The 16 shell commands involved were recorded as foreground commands. The Agent did not use:
- run_in_background
- block_until_ms: 0
- notify_on_output
The shell completion events had already settled, but were still queued as background wakeups. Once the main turn ended, Cursor dispatched them and automatically resumed the Agent.
I’m on the legacy request-based plan, so automatic additional Agent requests are particularly noticeable.
Does this stop you from using Cursor
No - Cursor works, but with this issue
