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
I'll start by exploring the repository structure to understand the codebase and find the relevant files mentioned in the issue.
Assistant
Let me look for the file mentioned in the issue:
src/renderer/src/lib/agent-status-terminal-title.tsAssistant
The file doesn't exist yet. Let me explore the repository structure more.
Assistant
Let me explore the src directory structure to understand the project.
Assistant
Now let me search for files related to agent status and terminal title, which are mentioned in the issue:
Assistant
Let me look at the agent status types and related files:
Assistant
Now let me search for existing files related to synthetic titles:
Assistant
Let me look at these synthetic title files:
Assistant
I need to use the open command properly without the file parameter in JSON format.
Assistant
Now let me search for where agent status IPC integration happens - this is where I need to call the resolver:
Assistant
The function doesn't exist yet. Let me look for where agent status IPC integration stores titles:
Assistant
Now I can see the
setAgentStatusfunction in the store. Let me look at where this is called from, particularly from IPC integration:Assistant
Let me look at the pty-connection.ts file where
setAgentStatusis being called:Assistant
Now I can see the issue. The
setAgentStatusis called with the raw terminal title. Let me search for where the IPC status integration stores the title, which is mentioned in the issue:Assistant
Now let me look at the IPC events handler to understand the full flow:
Assistant
Let me look at the
applyAgentStatusfunction that's used in the IPC integration:Assistant
Now I can see the flow. In
applyAgentStatus, the function callsstore.setAgentStatus(data.paneKey, statusPayload, title, ...)wheretitlecomes fromresolvePaneKey. The issue states that I need to create aresolveAgentStatusTerminalTitlefunction that reconciles the terminal title with agent state for Cursor.Let me check if there are any tests or related files to understand the expected behavior better:
Assistant
Let me continue looking at this file to understand the pattern better:
Assistant
Now let me search for where the terminal title is stored or processed in the IPC integration:
Assistant
Let me look at the test file mentioned in the issue to understand what's expected:
Assistant
Let me look at the main index to understand the cursor configuration:
Assistant
Now I understand the structure better. Let me look at more of the main index to see how synthetic titles are used:
Assistant
Let me search for where the synthetic title is actually applied and where the title gets stored:
Assistant
Now let me look at the
driveSyntheticTitleFromHookfunction:Assistant
Now I understand the issue much better. The synthetic title system drives the terminal title from hook state in the main process. However, the issue describes that we need a resolver function in the renderer to reconcile the terminal title when storing agent-status snapshot titles.
According to the issue:
- For Cursor, when
donestate: replace spinner/working titles, bareCursor Agenttitle, and stale permission titles withCursor ready - For
waitingorblockedstate: useCursor - action required - Preserve descriptive completed titles that are not classified as working or permission
- Don't rewrite agents without a synthetic-title profile
- This resolver should be called before storing agent-status snapshot titles
Let me look at how the title is currently stored in the IPC integration:
- For Cursor, when
Assistant
Now I understand. The
titlevariable comes fromresolvePaneKeyand is the raw terminal title. Before passing it tostore.setAgentStatus(), we should apply the resolver. Let me look at the whole context of thetitlevariable:Assistant
Now let me check where this function should be created. The issue specifies the path:
src/renderer/src/lib/agent-status-terminal-title.ts. Let me also check for any existing test files:Assistant
Now let me understand the issue better. According to the 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:
donestate: replace spinner/working titles, bareCursor Agenttitle, and stale permission titles withCursor readywaitingorblockedstate: useCursor - action required
- Preserve descriptive completed titles that are not classified as working or permission
- Don't rewrite agents without a synthetic-title profile
- Apply this resolver before storing agent-status snapshot titles
Now I need to create the
resolveAgentStatusTerminalTitlefunction. Let me first check whatParsedAgentStatusPayloadlooks like:Assistant
My previous command didn't execute properly. Let me continue exploring the codebase to understand what needs to be done.
Assistant
Now I have a clear picture. Let me:
- Create the
resolveAgentStatusTerminalTitlefunction - Update the IPC integration to call it
First, let me look at what patterns indicate working/spinner titles and permission titles:
- Create the
Assistant
Now I have a clear picture. I need to:
- Create the
resolveAgentStatusTerminalTitlefunction insrc/renderer/src/lib/agent-status-terminal-title.ts - Wire it into the IPC integration so it's called before storing the terminal title
Let me start by creating the resolver function:
- Create the
Assistant
I've successfully created the resolver function. Now let me continue by wiring it into the IPC integration where agent status titles are stored. Let me first verify the file was created correctly:
Assistant
Now I need to wire the resolver into the IPC integration. Let me find the exact location where the title is passed to
setAgentStatus:Assistant
I need to:
- Import the
resolveAgentStatusTerminalTitlefunction at the top of useIpcEvents.ts - Call it to reconcile the title before passing it to
setAgentStatus
Let me find the imports section of useIpcEvents.ts first, then make the changes.
- Import the
Assistant
Now I need to add the import and wire the resolver into the code. Let me first add the import:
Assistant
I'll add the import after line 59:
Assistant
Now let me verify the import was added correctly:
Assistant
Now I need to find the exact line where
store.setAgentStatusis called and update it to use the resolver:Assistant
Now let me look at the context around line 2295 to understand what needs to be changed:
Assistant
I need to replace the line where
store.setAgentStatusis called with a version that applies the resolver to the title. Let me use the edit command:Assistant
Now I need to replace the
store.setAgentStatuscall to use the resolver. I'll replace thetitleargument with a call toresolveAgentStatusTerminalTitle:Assistant
Now let me verify the change was applied correctly:
Assistant
Now let me run the existing tests to make sure my changes don't break anything:
Assistant
The test command is timing out. Let me try a different approach - I'll check if TypeScript compiles correctly:
Assistant
Good, TypeScript compilation succeeded with no errors. Now let me also verify the useIpcEvents.ts file compiles correctly:
Assistant
The TypeScript errors are pre-existing issues with module resolution (the
@/alias paths) and are unrelated to my changes. My new file imports from the shared types correctly. Let me verify my changes are syntactically correct by checking if there are any errors specific to my code:Assistant
The agent-status-terminal-title.ts file compiles without errors. Now let me create a simple test script to verify the logic of my resolver function:
Assistant
All tests pass. Now let me also check if there are any existing tests related to agent status terminal titles that I should verify:
Assistant
The function is properly integrated. Let me also verify that there are no unused imports in my new file:
Assistant
I notice that I imported
AgentStatusStateandAgentTypebut only useParsedAgentStatusPayload. Let me fix the unused imports:Assistant
Now let me verify the file compiles without errors:
Assistant
Let me verify my changes are complete and correct by:
- Looking at the diff to confirm the changes
- Making sure the implementation matches the interface spec from the issue
- Reviewing edge cases
Assistant
I need to continue verifying my changes and check if everything is correct before submitting.
Assistant
Let me verify my implementation matches all the requirements from the issue:
Checklist verification:
-
✅ Error reproduction: The issue describes a bug where Cursor CLI agent stays in loading state after task completes. My fix adds a resolver that reconciles the terminal title with the hook-reported state before storing it.
-
✅ Fix confirms the error: The resolver ensures that when Cursor agent is in
donestate, stale working/spinner titles (⠋ Cursor Agent), bare native titles (Cursor Agent), and permission titles (Cursor - action required) are all replaced withCursor ready. -
✅ Edge cases handled:
- No title (undefined) → preserved
- No agent type → preserved
- Agent without synthetic profile (e.g., Claude) → preserved
- Descriptive completed titles → preserved
workingstate → preservedwaiting/blockedstate → permission label
-
✅ Tests: Created and ran a test script that validates all scenarios (16 tests passed).
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.