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.
Assistant
I'll start by exploring the repository structure to understand the codebase and find relevant files.
Assistant
Let me look at the specific file mentioned in the issue:
src/renderer/src/lib/agent-status-terminal-title.tsAlso, let me search for files related to "agent-status" and "cursor" to understand the context better.
Assistant
Let me check if the file
agent-status-terminal-title.tsexists yet:Assistant
The file doesn't exist yet. Let me explore related files to understand the existing structure:
Assistant
The file
agent-status-terminal-title.tsdoesn't exist yet. I need to create it. Let me understand the context by reading related files:agent-status-types.ts- for the payload typesagent-status.ts- for how agent status is managed- Any IPC integration that might call this resolver
Let me first look at the existing agent status types and related code.
Assistant
Now let me look at more related files:
Assistant
Now let me look at the IPC integration and the store slices related to agent status to understand how titles are stored:
<tool_call> <function=bash_terminal> <parameter=command> cat /orca/src/renderer/src/store/slices/agent-status.ts </tool_call>
Assistant
Let me view the file properly using cat command.
Assistant
Let me continue reading the agent-status slice to see how terminalTitle is stored:
Assistant
Now let me look at the IPC integration that might call this resolver:
<tool_call> <function=bash_terminal> <parameter=command> find /orca -type f ( -name ".ts" -o -name ".tsx" ) | xargs grep -l "agent-status-terminal-title|resolveAgentStatusTerminalTitle" 2>/dev/null </tool_call>
Assistant
The function
resolveAgentStatusTerminalTitledoesn't exist yet - I need to create it. Let me look at how agent status is processed through IPC to understand where I need to add the resolver call.Assistant
Let me look at where setAgentStatus is called to understand how terminalTitle is passed:
Assistant
Let me look at the pty-connection file where terminalTitle is used:
Assistant
Let me search for where the terminalTitle is being set or passed in the pty-connection file, and also look for any related synthetic title handling:
Assistant
Let me look at more context around these setAgentStatus calls to understand the flow.
Assistant
Let me explore the synthetic-title handling to understand the profile structure:
Assistant
Let me explore the synthetic title related code. I should look at the main process files for synthetic title handling.
Assistant
Let me find the actual synthetic-title-visibility.ts file to understand the synthetic title system better.
Assistant
Let me explore the repository structure more carefully, looking at the synthetic title system and existing agent status handling, to understand how I need to create the
resolveAgentStatusTerminalTitlefunction and where it should be called from.Assistant
Now let me look at how Cursor agent status is handled and look at the main process IPC integration:
Assistant
Let me search for how the issue relates to the "agent-status" and "terminal-title" integration. The issue says that when a Cursor CLI agent finishes, the UI stays in loading state. The evaluation contract mentions creating a
resolveAgentStatusTerminalTitlefunction that maps cursor states to terminal titles.Let me find the agent-detection module to understand how Cursor is detected from terminal titles.
Assistant
Let me continue exploring the relevant code to understand how the integration should work:
Assistant
Let me explore the IPC integration for agent status to understand where the resolver should be called:
Assistant
Let me now look at how the IPC handler processes the agent status and passes the terminal title to the renderer. I need to find the main process side where the terminal title is passed through the IPC.
Assistant
Let me look at the preload to see how the IPC message is received in the renderer:
Assistant
Let me search for where the agentStatus:set IPC handler in the renderer is, to understand where the resolver needs to be called.
Assistant
Let me search more broadly for where the IPC events for agentStatus are handled in the renderer:
Assistant
I need to understand the renderer's IPC handling better. Let me look at how the main process sends data to the renderer via IPC, and how the renderer receives it.
Assistant
Let me take a step back and look at the main process IPC to understand where the terminal title is being set:
Assistant
The issue is that when a Cursor CLI agent finishes its task, the UI shows it's still in a loading/running state. According to the evaluation contract, I need to:
- Create a function
resolveAgentStatusTerminalTitleatsrc/renderer/src/lib/agent-status-terminal-title.ts - This function reconciles hook-reported state with synthetic terminal-title profiles
- For Cursor:
donemaps stale spinner, working, bare native, or permission titles to "Cursor ready"waiting/blockedmaps 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
Let me first explore the existing codebase more thoroughly to understand:
- How terminal titles are currently handled
- Where the resolver should be called from
- What the "synthetic-title profiles" look like for Cursor
- Create a function
Assistant
Let me look at the full context around line 777 and 628:
Assistant
Now I understand the issue better. The Cursor agent has a synthetic-title profile with:
workingLabel: 'Cursor Agent'permissionLabel: 'Cursor - action required'idleLabel: 'Cursor ready'
The issue is that when the agent finishes (state becomes 'done'), the terminal title should be updated to "Cursor ready" but it's not. The UI stays in a loading state.
I need to create the
resolveAgentStatusTerminalTitlefunction that:- Takes
Pick<ParsedAgentStatusPayload, 'agentType' | 'state'>andcurrentTitle: string | undefined - For Cursor with
donestate: replaces spinner/working titles, bare native titles, or stale permission titles with "Cursor ready" - For Cursor with
waiting/blockedstate: maps to "Cursor - action required"
Assistant
Now I see the main process sends an IPC event for
agentStatus:setbut the issue is that the terminal title is not being updated when the Cursor agent finishes. ThedriveSyntheticTitleFromHookfunction in the main process drives synthetic title updates to the terminal, but the issue is about the UI state not updating correctly.Let me look at where the terminal title is actually stored in the renderer's state and where the resolver should be called. The
setAgentStatusfunction in the store slice accepts aterminalTitleparameter. I need to understand:- Where
setAgentStatusis called with the terminal title - Where the IPC handler in the renderer processes
agentStatus:setevents
Let me find the IPC handler in the renderer.
- Where
Assistant
Let me look at the preload file to understand the IPC setup:
Assistant
Now I need to understand where the renderer processes the
agentStatus:setIPC events and callssetAgentStatus. The preload exposesonSetcallback. Let me find where this is used.Assistant
Let me look at the useIpcEvents.ts file around line 2371 to understand how the IPC events are handled.
Assistant
Let me look at the applyAgentStatus function:
Assistant
Let me look at the applyAgentStatus function definition.
Assistant
Assistant
The evaluation contract is clear: I need to create a
resolveAgentStatusTerminalTitlefunction atsrc/renderer/src/lib/agent-status-terminal-title.tsthat reconciles hook-reported state with synthetic terminal-title profiles.For Cursor:
donestate replaces spinner/working titles, bare native "Cursor Agent" title, and stale permission titles with "Cursor ready"waitingorblockedstate maps to "Cursor - action required"- Descriptive completed titles are preserved
- Agents without a synthetic-title profile are preserved
The resolver must be called in the IPC status integration before storing the agent-status snapshot title. That's in
applyAgentStatusin/orca/src/renderer/src/hooks/useIpcEvents.tswherestore.setAgentStatus(data.paneKey, statusPayload, title, ...)is called.Let me create the resolver function and then modify the IPC integration to call it.
Assistant
The
driveSyntheticTitleFromHookfunction is in the main process and sends OSC title updates to the terminal. But the issue is about the renderer's stored title not being updated. Let me look at howdriveSyntheticTitleFromHookworks.Assistant
Assistant
Let me continue searching for the spinner frames and then implement the resolver.
Assistant
Now I have a thorough understanding of the codebase. Let me create the implementation.
Summary of my analysis:
- The issue: When a Cursor CLI agent finishes (state='done'), the renderer's stored
terminalTitleremains stale (e.g., the old "Cursor Agent" or spinner title) because the pane title update hasn't arrived yet - The fix: Create
resolveAgentStatusTerminalTitlethat reconciles hook-reported state with synthetic terminal-title profiles, and call it inapplyAgentStatusbefore storing the title - For Cursor with 'done': replace working/permission/bare-native titles with "Cursor ready", preserve descriptive completed titles
- For Cursor with 'waiting'/'blocked': return "Cursor - action required"
- For agents without a synthetic-title profile: preserve the title
Let me create the resolver function:
- The issue: When a Cursor CLI agent finishes (state='done'), the renderer's stored
Assistant
The create command failed. Let me try using the edit command or a different approach to create the file. Let me use bash to create the file first.
Assistant
Let me verify the file was created correctly:
Assistant
The file was created successfully. Now I need to integrate the resolver into the IPC status integration. The resolver should be called in
applyAgentStatusin/orca/src/renderer/src/hooks/useIpcEvents.tsbefore callingstore.setAgentStatus.Let me find the exact location:
Assistant
Now I need to integrate the resolver into
applyAgentStatusinuseIpcEvents.ts. I need to:- Import the resolver function
- Call it before
setAgentStatusto get the resolved title
Let me first check the imports at the top of the file:
Assistant
The resolver file has been created. Now I need to integrate it into the IPC event handler in
useIpcEvents.ts. The resolver should be called beforestore.setAgentStatus()to get the resolved title.Let me:
- Import the resolver from the new file
- Call it before
setAgentStatusto get the resolved title
Assistant
Now I need to add the import for the resolver and call it in the
applyAgentStatusfunction. Let me add the import first:Assistant
Now I need to add the import for the resolver and call it in the IPC handler. Let me add the import first:
Assistant
Now I need to:
- Add the import for
resolveAgentStatusTerminalTitle - Call it before
setAgentStatusto get the resolved title
- Add the import for
Assistant
Now I need to verify the import was added and then find the exact line where
store.setAgentStatusis called to integrate the resolver:Assistant
Good, the import was added. Now I need to integrate the resolver call before
store.setAgentStatus. Let me find the exact line:Assistant
Now I need to modify the code to call the resolver before setAgentStatus. Let me look at the context around line 2295:
Assistant
Now I need to modify the code to call the resolver before
setAgentStatus. I'll add the resolver call and use its output:Assistant
Let me check what happened with the replacement:
Assistant
The changes look good. Let me verify the file is syntactically correct by checking the TypeScript compilation:
Assistant
I see the issue - the relative import paths are incorrect. The file is at
/orca/src/renderer/src/lib/agent-status-terminal-title.tsand I need to use../../../shared/agent-detection(3 levels up, not 4). Let me fix this:Assistant
Let me verify the changes and make sure everything compiles correctly.
Assistant
The TypeScript compilation passed without errors. Now let me verify the complete implementation by checking both files:
Assistant
Let me now run the existing tests to verify nothing is broken:
Assistant
Let me run a targeted test to verify the TypeScript compilation and basic functionality:
Assistant
TypeScript compilation passes. Let me now write a test file to verify the resolver function works correctly.
Assistant
Let me run the test to verify the resolver function:
Assistant
All 18 tests pass. Now let me verify the TypeScript compilation still passes and run any existing agent-status related tests to make sure I haven't broken anything:
Assistant
Let me now run the existing agent-status tests to ensure I haven't broken anything:
Assistant
The test failure is due to a missing package, not related to my changes. Let me try running the agent-status tests specifically:
Assistant
The test failures are due to missing module resolution issues in the test environment, not related to my changes. Let me verify my implementation is complete by checking the key files:
Assistant
Let me check the git diff to see all the changes I've made:
Assistant
Let me check the git status to see if the new files are tracked:
Assistant
Let me run the test one more time to confirm everything is working:
Assistant
All tests pass. Let me provide a final summary of the implementation:
Summary of Changes
I've implemented a fix for the bug where the Cursor CLI agent stays in a loading state after the task completes.
Files Created:
-
src/renderer/src/lib/agent-status-terminal-title.ts- The new resolver function that reconciles hook-reported state with synthetic terminal-title profiles:- For Cursor with
donestate: replaces stale spinner/working titles, bare native "Cursor Agent" title, and permission titles with "Cursor ready" - For Cursor with
waiting/blockedstate: maps to "Cursor - action required"
- For Cursor with
-
Assistant
All tests pass. Let me submit the solution now.
Assistant
Let me try calling submit without arguments properly.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.