bug(cursor): activity state stays "Input Needed" for the whole turn — every tool call re-asserts sticky waiting_input, nothing clears it until stop
Bug
Once a Cursor-adapter session's activity state flips to "Input Needed" (waiting_input), it never clears back to "Working" even after the user sends a follow-up and the agent visibly resumes — editing files, running commands, streaming tool output. The topbar badge and the Activity panel stay glued to "Input Needed" for the entire remainder of the turn, and only reset at the next turn boundary (submitting another prompt, or the agent's stop hook).
Source: local observation, desktop app, agent=cursor | Confidence: High — traced through the full hook → activity-state pipeline, not just the symptom
Analyzed against: origin/main 6b6190deb
Repro
- Start a Cursor-agent session and let it hit a state where it shows "Input Needed" (e.g. it ran a shell/MCP call that Cursor's hook reports as a permission-style event).
- Send a follow-up message in "Add a follow-up".
- Watch the terminal: the agent resumes, edits files, runs tools (visibly active).
- The topbar pill and the Activity panel on the right (Session Inspector → Summary → Activity) keep showing "Input Needed" the whole time, instead of switching to active/working.
Root Cause
Cursor's adapter only installs 5 hooks (backend/internal/adapters/agent/cursor/hooks.go:60-66):
var cursorManagedHooks = []cursorHookSpec{
{Event: "sessionStart", Command: cursorHookCommandPrefix + "session-start"},
{Event: "beforeSubmitPrompt", Command: cursorHookCommandPrefix + "user-prompt-submit"},
{Event: "stop", Command: cursorHookCommandPrefix + "stop"},
{Event: "beforeShellExecution", Command: cursorHookCommandPrefix + "permission-request"},
{Event: "beforeMCPExecution", Command: cursorHookCommandPrefix + "permission-request"},
}
There is no afterShellExecution/afterMCPExecution (post-tool) hook, and cursor has no DetectTerminalActivity fallback either (unlike codex's backend/internal/adapters/agent/codex/terminal_activity.go) — its activity is purely hook-driven via the shared, payload-blind deriver: activitydispatch.Derivers["cursor"] = activitystate.StandardDeriveActivityState (backend/internal/adapters/agent/activitydispatch/dispatch.go:40).
StandardDeriveActivityState (backend/internal/adapters/agent/activitystate/activitystate.go:24-33) maps permission-request → domain.ActivityWaitingInput unconditionally — it can't distinguish "this tool call needs the user's OK" from "this is just a normal shell/MCP call Cursor happens to fire the same pre-execution hook for." Its own doc comment already flags this class of adapter: "permission-request maps to waiting_input, not blocked: none of the sharing adapters install the pre/post-tool-use trio, so a blocked state could never be cleared before the turn end."
The precedence guard that's supposed to stop background tool traffic from re-asserting a sticky state only recognizes Claude-style event names (backend/internal/lifecycle/manager.go:409-412):
func isToolUseEvent(event string) bool {
return event == "pre-tool-use" || event == "post-tool-use" || event == "post-tool-use-failure"
}
Cursor never emits those — its tool-call signal is always "permission-request". So the sticky-suppression branch (manager.go:516-519, case cur.IsSticky() && isToolUseEvent(s.Event): return suppressed) never triggers for cursor, and every beforeShellExecution/beforeMCPExecution during the turn falls through to default (manager.go:522-525) and overwrites the state to waiting_input again, with nothing to demote it until stop or the next user-prompt-submit.
Sequence:
- User sends follow-up →
beforeSubmitPrompt→user-prompt-submit→ state =active. - Cursor's first tool call (edit/shell) →
beforeShellExecution→permission-request→ state =waiting_input(sticky). - Every subsequent tool call for the rest of the turn re-asserts
waiting_input(not suppressed, sinceisToolUseEventdoesn't recognizepermission-request). - Nothing clears it until the agent's
stophook fires — i.e., the badge reads "Input Needed" for the agent's entire active working period.
This is the same structural issue already called out for Copilot's adapter (backend/internal/adapters/agent/copilot/hooks.go:71-80, "every preToolUse currently produces ActivityWaitingInput" — a documented "many-to-one collapse"), but Cursor has no equivalent comment flagging it, and unlike Copilot's guard, cursor's permission-request events aren't even suppressed once already sticky.
Frontend is a pure render of the backend-derived state (frontend/src/renderer/lib/session-presentation.ts:32-34, waiting_input → label: "Input Needed") — confirmed this is not a frontend caching/stale-poll issue.
Suggested Fix
Cursor does have a real post-execution hook AO isn't using: afterShellExecution is documented at cursor.com/docs/hooks with a payload of {command, output, duration, sandbox}, and is one of the events Cursor CLI users report actually firing for cursor-agent (not just the IDE agent) — see the community thread below. AO's adapter currently only installs the before hooks (hooks.go:60-66); it never installs afterShellExecution.
Proposed change:
- Register
afterShellExecutionincursorManagedHooks(hooks.go:60-66), mapped to a post-tool-use-style AO sub-command (e.g. reusepost-tool-use, or a cursor-specific one if the payload doesn't carry atool_use_idcleanly). - Extend
isToolUseEvent(backend/internal/lifecycle/manager.go:409-412) to recognize that event, so the existing sticky-suppression guard (manager.go:516-519) actually protects cursor sessions the way it already protects claude-code/codex — background tool traffic stops re-assertingwaiting_inputonce it's already sticky, and the paired post-hook can demote it back to active. - Open question, needs runtime verification before relying on it: a Cursor forum thread (April 2026, community-sourced, not confirmed against Cursor's official docs) reports that in
cursor-agentCLI specifically,beforeMCPExecution/afterMCPExecutionandbeforeSubmitPromptdo not fire, unlike in the IDE agent — onlybeforeShellExecution/afterShellExecution/afterFileEdit/postToolUse/stop/sessionStartreportedly fire. If accurate, two follow-ups are needed: (a) AO'sbeforeMCPExecutionregistration (hooks.go:65) may currently be dead weight for CLI sessions and MCP tool calls would need a different signal (afterFileEdit/postToolUseare both listed as CLI-supported and worth checking as a substitute), and (b) ifbeforeSubmitPrompttruly never fires, the turn-boundary reset back toactive(activitystate.go:30,user-prompt-submit → active) may not be happening at all today, which would make the bug worse than "stuck for one turn" — worth capturing before scoping the fix. - At minimum, add the same doc-comment callout
copilot/hooks.go:71-80has, oncursor/hooks.go, so this class of gap isn't rediscovered per-adapter.
Sources
- Cursor Hooks reference — confirms
afterShellExecutionexists with{command, output, duration, sandbox}payload - Cursor CLI doesn't send all events defined in hooks (Cursor forum) — community report of CLI vs IDE hook-firing differences; unverified against AO's own runtime, flagged as such above
Related
- Same underlying
StandardDeriveActivityStatemany-to-one collapse as documented for Copilot:backend/internal/adapters/agent/copilot/hooks.go:71-80 - #2814 — kimi activity pill shows Idle while agent is actively working (no mid-turn tool-use hooks) — same family of "adapter has no way to signal true working state" bugs, different symptom (idle vs. stuck waiting_input)
- #2525 — idle_prompt notification conflated with permission_prompt, both set activity=waiting_input
- #2047 — Claude sessions misreport state — active work shown as "ready", idle_prompt shown as "waiting_input"
@illegalcall can you assign me this?
Thanks for contributing to Agent Orchestrator.
This issue is being picked up by the current external contributor on-call pair:
- @illegalcall
- @pulkit7070
If someone is already working on this, please continue as usual. The on-call pair is added for visibility, tracking, and support, not to take over the work. If you need help with review, direction, reproduction, or next steps, please tag @illegalcall and @pulkit7070 here.
For faster context or live questions, you can also join the AO Discord.
Join the session here: https://discord.gg/H6ZDcUXmq
Come by if you want to see what is being built, ask questions, or just hang around with the community.
Fresh real-world repro on macOS, cursor harness, worker session, repo at 3934bc86a — this is still actively misleading orchestrators while #3404 sits unmerged (open since Aug 1).
What an orchestrator saw: ao session get reported status: needs_input / activity: waiting_input for a worker that was continuously executing tool calls. The orchestrator diagnosed it as "stalled waiting on a question" and reported that to the human — twice — and both times it was wrong.
Proof it was never waiting on input: parsing the worker's on-disk transcript (~/.ao/data/cursor/projects/<slug>/agent-transcripts/<uuid>/<uuid>.jsonl) showed zero assistant messages containing a question mark across all 88 rows. The agent never asked anything. Meanwhile the live shell record showed status: running, running_for_ms: 115087 — a long blocking shell call producing no output, exactly the shape your PR description predicts.
Second-order damage worth noting: the status also flipped to active/working shortly after the orchestrator sent a message, so the orchestrator inferred its message had landed and caused the change. It had not — the message was never delivered at all (separate cursor bug, filed as #3634). A status signal that is both wrong and coincidentally correlated with your actions doesn't just mislead, it manufactures false confidence about causation.
The transcript is the only reliable source here, and it isn't exposed by any CLI (filed as #3635).
Fixed by #4495, which landed a Cursor-specific activity mapper and AO-owned execution hooks: waiting_input is now posted only when a tool attempt returns "ask" and clears after execution. Closing as completed.