ISSUE DESCRIPTION [Bug]: Cursor CLI agent stays in loading state after task completes…
- User
ISSUE DESCRIPTION
[Bug]: Cursor CLI agent stays in loading state after task completes
Operating system
macOS
Orca version
Unknown (please add from Orca > About Orca if available)
Details
Summary
When running a Cursor CLI agent session in Orca, the UI continues to show a loading/running state after the agent has finished its task — as if work is still in progress.
Steps to reproduce
- Start a Cursor CLI agent session in Orca.
- Give the agent a task and wait for it to complete (agent finishes and produces final output).
- Observe the session UI state.
Expected behavior
Once the Cursor CLI agent finishes, the session should transition to an idle/completed state — loading indicators should stop and the UI should reflect that no work is in progress.
Actual behavior
The session remains in a loading/running state after the task is done, giving the impression the agent is still working.
Environment
- macOS: darwin 25.4.0
- Agent: Cursor CLI
Additional notes
- Reproduces when the agent has clearly finished (final response delivered) but Orca does not update the activity/loading indicator accordingly.
- May cause confusion about whether it is safe to send a follow-up prompt or close the session.
Evaluation contract
When a synthetic-title agent reports a non-working state, reconcile the terminal title with that agent's synthetic title profile. For Cursor,
donereplaces spinner/working titles, the bareCursor Agenttitle, and stale permission titles withCursor ready;waitingorblockedusesCursor - action required. Preserve descriptive completed titles that are not classified as working or permission, and do not rewrite agents without a synthetic-title profile. Apply this resolver before storing agent-status snapshot titles.Interface
Type: Function Name: resolveAgentStatusTerminalTitle Path: src/renderer/src/lib/agent-status-terminal-title.ts Input: payload: Pick<ParsedAgentStatusPayload, 'agentType' | 'state'>, currentTitle: string | undefined Output: string | undefined Description: Reconciles hook-reported state with synthetic terminal-title profiles. For Cursor, done maps stale spinner, working, bare native, or permission titles to "Cursor ready"; waiting/blocked maps to "Cursor - action required". Descriptive completed titles and agents without a synthetic profile are preserved. The IPC status integration must call this resolver before storing the title.
ADDITIONAL ADVICE
Assistant
Let me start by exploring the repository structure to understand the codebase.
Assistant
Let me look at the structure of the src directory, particularly the renderer part.
Assistant
Let me look at the agent-status.ts file and the agent-status.test.ts file.
Assistant
Now let me look at the agent-status-types and related files.
Assistant
Let me look at the test file and search for existing terminal title handling.
Assistant
Let me look at the shared agent-detection.ts file.
Assistant
Now let me search for where the agent status IPC title is stored and where the cursor agent synthesizes titles.
Assistant
Let me look at the useIpcEvents.ts where the terminal title is stored.
Assistant
Let me look at the context around where
titleis defined before the setAgentStatus call.Assistant
Let me check if there's already a test file for the new function and look at existing title detection tests.
Assistant
The function doesn't exist yet. Let me look at how Cursor titles are synthesized in the main process.
Assistant
Let me search for where the cursor title is synthesized (the "⠋ Cursor Agent" and "Cursor ready" strings).
Assistant
Let me look at the pty-transport.ts where synthesized titles are emitted.
Assistant
Let me look at the main process index.ts around line 620 and the synthetic title emission.
Assistant
Let me look at
driveSyntheticTitleFromHookfunction.Assistant
Let me understand how
terminalTitleis used in status display and the loading indicator.Assistant
Let me look at the pty-connection.ts around line 395 to understand how title relates to status display.
Assistant
Let me search for how the working state is computed and how the title drives the spinner.
Assistant
Let me look at worktree-card-status.ts to understand the combination of explicit status and title heuristic.
Assistant
Let me look at worktree-title-derived-agent-rows.ts and smart-attention.ts to see how terminalTitle drives the status.
Assistant
Let me now look at smart-attention.ts to understand how the title affects the status, specifically lines around 300-325.
Assistant
Let me look at resolvePaneKey to understand the
titlesource.Assistant
Let me look at worktree-title-derived-agent-rows.ts more fully to understand how hook-covered panes are skipped.
Assistant
Let me look at how the dashboard uses the agent status entry to show the loading state.
Assistant
Let me look at how the dashboard card renders the state/loading indicator.
Assistant
Now I understand the data flow. Let me look at the agent-status-count.test.ts to understand test conventions and how to run tests.
Assistant
Let me check the test script in package.json and how to run tests.
Assistant
Now let me look at how the cursor hook payload's agentType flows to the IPC.
Assistant
Let me check how the cursor hook sets agentType. Let me look at the cursor hook payload flow. The cursor hook posts to
/hook/cursor. Let me find where the agentType is set from the URL path.Assistant
Let me look at normalizeHookPayload to confirm agentType is set from the source.
Assistant
Let me check the cursor done state mapping.
Assistant
Now I have a full understanding. Let me create the resolver file.
Assistant
I noticed a stray
*in a comment. Let me check the file for syntax issues.Assistant
Line 28-30 has a
/*-style comment in a//line. Let me look at lines 27-31.Assistant
Let me fix the stray comment markers.
Assistant
Let me verify the file compiles.
Assistant
Now let me create a temporary test to verify the resolver behavior.
Assistant
All tests pass. Now let me wire it into the IPC integration. Let me look at the imports in useIpcEvents.ts.
Assistant
Now let me add the import and use the resolver. First, add the import.
Assistant
Now let me update the
setAgentStatuscall to use the resolver. Let me view the current code around the call.Assistant
Let me open the file and then edit.
Assistant
Now let me verify it compiles.
Assistant
Let me run the existing tests to make sure nothing breaks.
Assistant
Let me find and run tests related to useIpcEvents and the agent-status store slice.
Assistant
Let me run the full test suite to make sure nothing breaks.
Assistant
Let me run targeted tests around affected areas.
Assistant
All 334 test files passed. Let me check if there are existing tests that assert on cursor terminalTitle storage behavior that might be affected.
Assistant
Let me run the cursor-related pty dispatcher test specifically.
Assistant
Let me run the linter on the new file and the modified file.
Assistant
Let me check the formatting with the repo's formatter.
Assistant
Now let me remove the temporary test file before submitting.
Assistant
Let me review the final diff of all changes.
Assistant
Let me review the final new file once more.
Assistant
Let me check
applyInitialAgentStatusin pty-connection.ts to see if it also stores terminalTitle and should use the resolver.Assistant
Let me run the final verification on the affected test suites.
Assistant
All tests pass. Let me do a final TypeScript check.
Assistant
The implementation is complete. Let me review the final state of all changes once more before submitting.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.