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 understand the issue:
- The Cursor CLI agent stays in a loading state after the task completes
- The UI continues to show a loading/running state after the agent has finished
The evaluation contract mentions:
- 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
- Do not rewrite agents without a synthetic-title profile
- Apply this resolver before storing agent-status snapshot titles
The interface is:
- Function:
resolveAgentStatusTerminalTitle - Path:
src/renderer/src/lib/agent-status-terminal-title.ts - Input: payload:
Pick<ParsedAgentStatusPayload, 'agentType' | 'state'>, currentTitle:string | undefined - Output:
string | undefined
Let me first explore the repository structure to understand the codebase better.
Assistant
Let me find the file mentioned in the interface:
src/renderer/src/lib/agent-status-terminal-title.ts<tool_call> <function=bash_terminal> <parameter=command> find /orca -path "agent-status-terminal-title" </tool_call>
Assistant
Let me search for the file with a different approach.
Assistant
The file doesn't exist yet. Let me explore the directory structure to understand where it should be created.
Assistant
Let me examine the agent-status.ts file and search for any existing terminal title handling:
Assistant
Let me look for any file related to terminal title handling, specifically in the shared directory as mentioned:
<tool_call> <function=bash_terminal> <parameter=command> ls -la /orca/src/shared/ 2>/dev/null </tool_call>
Assistant
Let me search for files that might contain the agent-status-terminal-title functionality or related terminal title handling.
Assistant
Let me look at the tab-title-resolution file to understand how terminal titles are resolved:
<tool_call> <function=bash_terminal> <parameter=command> cat /orca/src/shared/tab-title-resolution.test.ts </tool_call>
Assistant
Let me look for files related to agent-status-terminal-title more specifically, and also understand the current structure of the project.
Assistant
Now let me look at the actual tab-title-resolution.ts file:
Assistant
Now let me search for where the IPC status integration is that stores agent-status snapshots, or where the terminal title is updated:
Assistant
Now let me look for where IPC handlers for agent status are, and see how terminalTitle is set:
<tool_call> <function=bash_terminal> <parameter=command> grep -r "terminalTitle" /orca/src --include="*.ts" 2>/dev/null | head -30 </tool_call>
Assistant
I need to run a grep command to find terminalTitle references. Let me do that properly.
Assistant
Let me look for the IPC handlers related to agent status:
Assistant
Let me look at the agent-hooks.ts file in the IPC handlers:
Assistant
Let me now look at the agent-hooks server to see how the snapshot is generated and if terminal title is handled there:
<tool_call> <function=bash_terminal> <parameter=command> cat /orca/src/main/agent-hooks/server.ts 2>/dev/null </tool_call>
Assistant
The command failed because I didn't include a proper command structure. Let me try again.
Assistant
Let me now search for where the IPC handlers receive agent status events and see if they handle terminal title. Let me also search for where the "terminalTitle" field is used in agent-status payload:
<tool_call> <function=bash_terminal> <parameter=command> grep -r "terminalTitle" /orca/src/main --include="*.ts" 2>/dev/null </tool_call>
Assistant
I need to use the proper bash_terminal function syntax. Let me try that.
Assistant
Now let me search for where the agent status IPC "set" events are handled. The issue description says the IPC status integration must call the resolver before storing the title.
Let me search for IPC handlers that receive agent status:
Assistant
Let me check the preload file to see how agentStatus:set is handled in the renderer.
Assistant
Now let me look at the main process to see where
agentStatus:setis sent:Assistant
Let me see more of the main/index.ts to understand the full context, especially the SYNTHETIC_TITLE_PROFILES and driveSyntheticTitleFromHook function.
Assistant
Let me look for the SYNTHETIC_TITLE_PROFILES and driveSyntheticTitleFromHook function definitions in main/index.ts.
Assistant
Let me look at the SYNTHETIC_TITLE_PROFILES definition and the driveSyntheticTitleFromHook function.
Assistant
Let me now look at the driveSyntheticTitleFromHook function:
<tool_call> <function=bash_terminal> <parameter=command> sed -n '1014,1120p' /orca/src/main/index.ts 2>/dev/null </tool_call>
Assistant
I need to provide a command to the terminal. Let me look at the driveSyntheticTitleFromHook function properly.
Assistant
Let me look at where the terminal title is stored and check if there's already any terminal title resolution logic:
Assistant
Now let me look at the use-retained-agents.ts file to see how terminal title is handled in the dashboard:
<tool_call> <function=bash_terminal> <parameter=command> find /orca/src/renderer -name "useRetainedAgents.ts" -exec cat {} ; </tool_call>
Assistant
Let me continue exploring the codebase to understand how terminal titles are handled. I need to find where the agent-status state is processed and see how terminalTitle is updated.
Assistant
Now let me look at the agent-status store slice to see how terminalTitle is stored:
<tool_call> <function=bash_terminal> <parameter=command> find /orca/src/renderer -name "agent-status" -type f </tool_call>
Assistant
Let me try a simpler grep command to find the agent-status store file.
Assistant
Let me look at the agent-status store slice to understand how terminalTitle is stored:
<tool_call> <function=bash_terminal> <parameter=command> cat /orca/src/renderer/src/store/slices/agent-status.ts 2>/dev/null | head -250 </tool_call>
Assistant
The grep command is being cut off or taking too long. Let me try again with a simpler command.
Assistant
I need to see more of the agent-status.ts file to understand how terminalTitle is processed and see if there's already any terminal title resolution logic. Let me continue viewing this file.
Assistant
Let me check how terminalTitle is passed through the IPC handler and see if there's any existing resolution logic:
Assistant
Now I need to understand how the
setAgentStatusfunction is called from the renderer. Let me check the agent-status store usage to see how terminalTitle is passed when setting agent status.<tool_call> <function=bash_terminal> <parameter=command> grep -r "setAgentStatus" /orca/src/renderer --include="*.ts" 2>/dev/null | grep -v ".test.ts" | head -20 </tool_call>
Assistant
I need to run a grep command to find setAgentStatus usages. Let me try that.
Assistant
Let me look at the useIpcEvents.ts file to see how terminalTitle is passed through the IPC listener.
<tool_call> <function=bash_terminal> <parameter=command> grep -B 10 -A 10 "store.setAgentStatus.*data.paneKey" /orca/src/renderer/src/hooks/useIpcEvents.ts </tool_call>
Assistant
I need to use the proper bash_terminal tool format. Let me try again.
Assistant
Let me now look at where
titleis coming from in this file to understand how the terminal title is being passed.Assistant
Let me see where the
titlevariable is defined in this context:Assistant
I need to continue exploring the useIpcEvents.ts file to understand how the terminal title is being passed in the agentStatus:set handler.
Assistant
Now I understand the structure better. The
titleis obtained fromresolvePaneKey, which returns the current terminal title for the pane. The issue is that when an agent completes (state becomes 'done'), the terminal title is still showing a "working" indicator instead of transitioning to a "Cursor ready" state for Cursor CLI agents.According to the evaluation contract:
- For Cursor, when
done, replace spinner/working titles, the bareCursor Agenttitle, and stale permission titles withCursor ready waitingorblockedusesCursor - action required- This resolver must be called before storing the title in the IPC integration
Let me look at the file where this resolver needs to be created:
- For Cursor, when
Assistant
Now let me look at the ParsedAgentStatusPayload type to understand the payload structure better:
<tool_call> <function=bash_terminal> <parameter=command> grep -A 5 "type ParsedAgentStatusPayload" /orca/src/shared/agent-status-types.ts </tool_call>
Assistant
Let me try again with the correct command structure.
Assistant
Now I understand the structure. The issue is that when a Cursor CLI agent completes (state becomes 'done'), the terminal title is not being updated to reflect the completed state.
Based on the evaluation contract:
- When
donestate, replace spinner/working titles, bareCursor Agenttitle, and stale permission titles withCursor ready - When
waitingorblockedstate, useCursor - action required - This resolver must be called before storing the title in the IPC integration
The interface described is:
- Function:
resolveAgentStatusTerminalTitle - Path:
src/renderer/src/lib/agent-status-terminal-title.ts - Input:
payload: Pick<ParsedAgentStatusPayload, 'agentType' | 'state'>,currentTitle: string | undefined - Output:
string | undefined
I need to:
- Create the new file
src/renderer/src/lib/agent-status-terminal-title.tswith the resolver function
- When
Assistant
Let me look for where synthetic title profiles are defined and used in the main process.
Assistant
Now I understand the flow. Let me look at lines around 628-630 to understand how the synthetic title is being driven from the hook, and how the terminal title is handled.
<tool_call> <function=bash_terminal> <parameter=command> sed -n '610,660p' /orca/src/main/index.ts </tool_call>
Assistant
Let me try to view the main/index.ts file content around the SYNTHETIC_TITLE_PROFILES usage.
Assistant
The output was truncated due to the command output being too large. Let me try to view the file in chunks.
Now let me see the SYNTHETIC_TITLE_PROFILES definition:
<tool_call> <function=bash_terminal> <parameter=command> sed -n '777,800p' /orca/src/main/index.ts </tool_call>
Assistant
I need to use the bash_terminal tool properly to run commands.
Assistant
Now I understand the structure. The issue is that the synthetic title profiles (like 'Cursor ready') are being used by the
driveSyntheticTitleFromHookfunction to drive terminal OSC titles, but theterminalTitlefield in theAgentStatusEntryis not being updated with the resolved title.According to the evaluation contract:
- When
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
- Do not rewrite agents without a synthetic-title profile
- Apply this resolver before storing agent-status snapshot titles
I need to:
- Create a new file
src/renderer/src/lib/agent-status-terminal-title.tswith theresolveAgentStatusTerminalTitlefunction - Update the main process to call this resolver before storing the title
Let me first look at the shared types to see if there's a type for the payload:
<tool_call> <function=bash_terminal> <parameter=command> grep -n "AgentType|AgentStatusState" /orca/src/shared/agent-status-types.ts | head -20 </tool_call>
- When
Assistant
I need to use the bash_terminal tool correctly. Let me try again.
Assistant
Now I understand the structure. Let me create the
agent-status-terminal-title.tsfile with theresolveAgentStatusTerminalTitlefunction that implements the evaluation contract logic.Assistant
Now I need to update the main process to call this resolver before storing the title. Let me find where the terminalTitle is being passed in the main process.
Assistant
The terminalTitle is not directly in main/index.ts. Let me search for where the IPC handler sends the agent status set event with the title.
Assistant
Let me look at how the terminal title is being passed to the renderer when the agent status is set. I need to understand where the title comes from in the main process.
Assistant
Now I see the flow. The main process sends the
agentStatus:setevent to the renderer with the payload, and the renderer then resolves the terminal title from the pane. The issue is that when the agent completes (state becomes 'done'), the terminal title is not being updated to reflect the completed state.Looking at the code:
driveSyntheticTitleFromHookis called to drive synthetic OSC titles (for spinner display)- But the
terminalTitlefield in theAgentStatusEntryis not being updated with the resolved title from the synthetic profile
The problem is that the title passed to
setAgentStatusin the renderer comes fromresolvePaneKey, which gets the current terminal title from the layout. When the agent completes, the current title might still be "Cursor Agent" (the working title), and it's not being updated to "Cursor ready".I need to modify the main process to send the resolved title in the IPC payload. Let me check what data is being sent:
<tool_call> <function=bash_terminal> <parameter=command> grep -B5 -A30 "agentStatus:set" /orca/src/main/index.ts </tool_call>
Assistant
I need to run a grep command to see the context around the agentStatus:set event.
Assistant
The key issue is that the
terminalTitleis not being resolved in the main process. The main process needs to call the resolver function to get the correct terminal title and send it to the renderer.Let me modify the main/index.ts to include the resolved terminal title in the IPC payload. I'll need to:
- Import the
resolveAgentStatusTerminalTitlefunction (or duplicate the logic in main) - Calculate the resolved title and send it with the IPC event
Actually, since the main process and renderer process share the same codebase (via
src/shared), I should check if there's a way to share the resolver function.Looking at the structure:
/orca/src/renderer/src/lib/agent-status-terminal-title.ts- renderer-only location- I need to move or duplicate the logic to the shared layer
Let me first check if there's a shared lib folder:
<tool_call> <function=bash_terminal> <parameter=command> ls -la /orca/src/shared/ </tool_call>
- Import the
Assistant
Let me run a proper command to see the shared folder.
Assistant
The interface specification says:
- Path:
src/renderer/src/lib/agent-status-terminal-title.ts
This is specifically in the renderer folder, not shared. So the resolver function is only available in the renderer. The IPC integration in main needs to call this resolver before storing the title.
But the issue is that the main process doesn't have access to this renderer-only function. Let me think about how to properly integrate this.
Looking at the issue description again:
- "The IPC status integration must call this resolver before storing the title."
This could mean either:
- Path:
Assistant
I need to run the sed command to see the context around line 2260 in useIpcEvents.ts.
Assistant
I can see that at line 2294, the renderer calls
store.setAgentStatus(data.paneKey, statusPayload, title, {...}). The title is passed as-is from the layout. The fix should be to resolve the terminal title using the new resolver function before passing it tosetAgentStatus.Let me first import the resolver function and update the call:
Assistant
Now let me find where to add the import and see the full file to understand the structure better:
Assistant
I need to add the import for the
resolveAgentStatusTerminalTitlefunction and then use it when callingsetAgentStatus. Let me update the file to import the resolver and apply it to the title before passing tosetAgentStatus.Assistant
Now I'll add the import for the resolver and modify the code to use it when calling
setAgentStatus. Let me first add the import:Assistant
Let me fix the sed command by escaping the @ symbol properly:
Assistant
Now I need to find the line where
setAgentStatusis called and modify it to pass the resolved title. Let me find the exact line:Assistant
Now I need to modify the call to pass the resolved title. Let me see the context around this line:
Assistant
Now I need to modify the
setAgentStatuscall to pass the resolved title instead of the raw title. Let me update this line:Assistant
I need to create a temporary variable for the resolved title and use it in the setAgentStatus call. Let me do this in two steps - first create the resolved title variable, then update the call.
Assistant
Let me verify the changes were applied correctly:
Assistant
Let me verify the import was added:
<tool_call> <function=bash_terminal> <parameter=command> grep "resolveAgentStatusTerminalTitle" /orca/src/renderer/src/hooks/useIpcEvents.ts </tool_call>
Assistant
Let me run a grep command to verify the import was added.
Assistant
Now let me also check if there are any other places where
setAgentStatusis called that might need to be updated:Assistant
Now let me verify that my implementation in the agent-status-terminal-title.ts file is correct. Let me review it:
Assistant
Now let me run the tests to make sure the implementation doesn't break anything. First, let me find any related test files:
Assistant
Let me create a test file for the new function:
Assistant
Now let me run the test to make sure it works:
Assistant
The command timed out. Let me try running the tests with a simpler approach or check if the TypeScript compiles correctly.
<tool_call> <function=bash_terminal> <parameter=command> cd /orca && npx tsc --noEmit --project src/renderer/tsconfig.json 2>&1 | head -50 </tool_call>
Assistant
Let me run a simpler command to check TypeScript compilation.
Assistant
The import path is incorrect. Let me fix the import paths in both files:
<tool_call> <function=bash_terminal> <parameter=command> sed -i "s|import type { AgentType, AgentStatusState } from '../../../../shared/agent-status-types'|import type { AgentType, AgentStatusState } from '../../../../../shared/agent-status-types'|" /orca/src/renderer/src/lib/agent-status-terminal-title.ts </tool_call>
Assistant
Let me fix the import paths in the files. The renderer/src/lib folder needs to use four levels up to reach the shared folder.
Assistant
Let me also fix the test file import path.
<tool_call> <function=bash_terminal> <parameter=command> sed -i "s|import type { AgentStatusState, AgentType } from '../../../../shared/agent-status-types'|import type { AgentStatusState, AgentType } from '../../../../../shared/agent-status-types'|" /orca/src/renderer/src/lib/agent-status-terminal-title.test.ts </tool_call>
Assistant
Let me try to fix the import path in the test file:
Assistant
Let me verify the import paths are now correct:
Assistant
Now let me run the typecheck again:
Assistant
Let me check the directory structure to find the correct import path:
Assistant
Let me check how other files in the renderer/src/lib folder import from shared:
<tool_call> <function=bash_terminal> <parameter=command> grep "from.*shared" /orca/src/renderer/src/lib/agent-status.ts | head -5 </tool_call>
Assistant
Let me run a command to find how other files import from shared.
Assistant
The import path should be
../../../shared/agent-status-types(three levels up). Let me fix the import in my files:<tool_call> <function=bash_terminal> <parameter=command> sed -i "s|import type { AgentType, AgentStatusState } from '../../../../../shared/agent-status-types'|import type { AgentType, AgentStatusState } from '../../../shared/agent-status-types'|" /orca/src/renderer/src/lib/agent-status-terminal-title.ts </tool_call>
Assistant
Let me fix the import path properly. The renderer/src/lib folder needs to go up three levels to reach the shared folder.
Assistant
Let me try a different approach to fix the import path - directly editing the file content:
Assistant
Let me try a simpler sed command to replace the import path:
<tool_call> <function=bash_terminal> <parameter=command> sed -i "1s|import type { AgentType, AgentStatusState } from '../../../../../shared/agent-status-types'|import type { AgentType, AgentStatusState } from '../../../shared/agent-status-types'|" /orca/src/renderer/src/lib/agent-status-terminal-title.ts </tool_call>
Assistant
Let me try a different approach. I'll use a here-doc to rewrite the file with the correct import path.
Assistant
Let me check what the current import path looks like and then fix it properly:
Assistant
Good, it changed one level. Let me try once more to get to the correct path:
Assistant
It looks like it changed once but not from the correct place. Let me see what the path structure is:
- /orca/src/renderer/src/lib/agent-status-terminal-title.ts
- /orca/src/shared/agent-status-types.ts
From lib, I need to go up three levels (../.. to reach src, then ../ to reach orca, then ./shared to reach shared). Let me verify the current path:
Assistant
The current import path
../../../../shared/agent-status-typesis wrong - it would go up to /orca/ and then look for shared there, but shared is at /orca/src/shared/. Let me fix this to../../../shared/agent-status-types:<tool_call> <function=bash_terminal> <parameter=command> head -1 /orca/src/renderer/src/lib/agent-status-terminal-title.ts </tool_call>
Assistant
Let me run the command properly to check the current import path.
Assistant
The path
../../../../shared/agent-status-typesgoes:- From
/orca/src/renderer/src/lib/ - Up one:
src/renderer/src/ - Up two:
src/renderer/ - Up three:
src/ - Up four:
/orca/ - Then
shared/- but there's no shared folder at /orca/shared/
The correct path should be
../../../shared/agent-status-types:- From
/orca/src/renderer/src/lib/ - Up one:
src/renderer/src/ - Up two:
src/renderer/ - Up three:
src/ - Then
shared/- there IS a shared folder at /orca/src/shared/
Let me fix the import path.
- From
Assistant
Let me also fix the test file's import path:
Assistant
Let me fix the test file's import path as well.
Assistant
Now let me verify the import paths are correct:
Assistant
Now let me run the typecheck again to see if the import errors are resolved:
Assistant
The error shows that the
SYNTHETIC_TITLE_PROFILESRecord type needs to include all AgentType members. I need to change the type to be more flexible. Let me update the file to use a correct type:Assistant
The issue is that
Record<AgentType, SyntheticTitleProfile>requires all members of theAgentTypeunion to be present, but we only have a subset. I need to change the type to bePartial<Record<AgentType, SyntheticTitleProfile>>or use a different approach.Let me update the type to use
Partial:Assistant
Now let me run the typecheck again to see if the error is resolved:
<tool_call> <function=bash_terminal> <parameter=command> cd /orca && npm run typecheck 2>&1 | grep "agent-status-terminal-title" | head -10 </tool_call>
Assistant
Let me run the command properly to check the typecheck output.
Assistant
The typecheck passes without any errors related to our new file. Now let me check if there are any errors in the useIpcEvents.ts file:
<tool_call> <function=bash_terminal> <parameter=command> cd /orca && npm run typecheck 2>&1 | head -50 </tool_call>
Assistant
I need to run the typecheck command properly.
<tool_call> <function=bash_terminal> <parameter=command> cd /orca && npm run typecheck 2>&1 | head -50 </tool_call>
Assistant
Let me try running the typecheck in a way that doesn't timeout:
Assistant
The typecheck passes! Now let me verify the changes I made are complete and then submit. Let me check the git diff to see what changes I've made:
<tool_call> <function=bash_terminal> <parameter=command> cd /orca && git status </tool_call>
Assistant
I need to run the git status command properly.
Assistant
Let me see the full diff to confirm the changes are correct.
Assistant
The changes look correct. Let me also verify the new files are correct:
Assistant
Now let me also verify the test file is correct:
<tool_call> <function=bash_terminal> <parameter=command> cat /orca/src/renderer/src/lib/agent-status-terminal-title.test.ts </tool_call>
Assistant
Let me run the command to view the test file.
Assistant
Now let me run the typecheck one more time to ensure everything is correct:
Assistant
All changes are complete and the typecheck passes. Let me submit the solution.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.