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 and understanding the codebase to resolve this issue.
Assistant
Let me look for the file mentioned in the issue description:
src/renderer/src/lib/agent-status-terminal-title.tsAssistant
The file doesn't exist yet. Let me explore the existing agent-status files to understand the codebase structure.
Assistant
I need to explore the repository structure and understand the existing agent-status files before creating the new file mentioned in the issue. Let me start by opening the existing agent-status.ts file to understand the types and patterns used.
Assistant
The user opened a file using the open command. I need to continue exploring the codebase to understand the structure and then create the new file. Let me open the file properly.
Assistant
Now let me look at the shared agent-status-types and agent-detection files to understand the types:
Assistant
Now let me look at the shared agent-detection module to understand the existing patterns for terminal title detection:
Assistant
Now let me look at the store slices for agent-status to understand how the title is stored:
Assistant
Now let me look at the IPC integration for agent status to understand where the title is stored and where I need to call the resolver:
Assistant
Let me look at the IPC handler that stores agent status with terminal titles:
Assistant
Let me search for where terminalTitle is stored and where I need to integrate the resolver:
Assistant
Let me find the IPC handler that processes agent status and stores the terminal title.
Assistant
Let me look at the pty-connection.ts file to understand how terminalTitle is stored:
Assistant
Let me also look at the main process side where the IPC status integration stores the title:
Assistant
The previous grep command returned no output, which means there are no matches for those patterns in the agent-hooks directory. Let me search more broadly for where agent status snapshots are stored in the main process and where the title resolution should be applied. I need to find the IPC status integration that stores agent-status snapshot titles.
Assistant
Let me search for where terminal titles get stored with agent status entries:
Assistant
Now I found it! The
useIpcEvents.tsfile has the IPC status integration that callssetAgentStatus. Let me look at that code to understand how the title is being handled:Assistant
Let me look at more context to see where
titleis defined in this function:Assistant
Let me look even further up to see where
titleandidentityTitleare defined:Assistant
Now let me look at where the
resolveHookPayloadAgentTypeis defined and how thetitleis used. I can see that thetitlevariable comes fromresolvePaneKey. Let me see the context more around the setAgentStatus call:Assistant
Now I see where the title is stored. The issue description says:
Apply this resolver before storing agent-status snapshot titles.
The code at line ~2294 calls
store.setAgentStatus(data.paneKey, statusPayload, title, ...). According to the issue, I need to:- Create a new file
src/renderer/src/lib/agent-status-terminal-title.tswith a functionresolveAgentStatusTerminalTitle - This function reconciles hook-reported state with synthetic terminal-title profiles
- Call this resolver before storing the title in
setAgentStatus
Let me now look at the existing test file to understand the expected behavior better:
- Create a new file
Assistant
The user is telling me that my previous action timed out. I need to continue working on this issue. Let me review what I was doing and continue.
From my analysis so far:
- I need to create a new file
src/renderer/src/lib/agent-status-terminal-title.tswith a functionresolveAgentStatusTerminalTitle - This function should reconcile hook-reported state with synthetic terminal-title profiles for Cursor agent
- For Cursor:
donereplaces spinner/working titles, bareCursor Agenttitle, and stale permission titles withCursor ready;waitingorblockedusesCursor - action required - This resolver needs to be called before storing the title in
setAgentStatusin the IPC integration (useIpcEvents.ts)
Let me continue by looking at the existing test files to understand the expected patterns, then create the new file and integrate it.
- I need to create a new file
Assistant
Let me check the Cursor-related tests in the agent detection to understand the expected title patterns:
Assistant
Now I have a good understanding of the codebase. Let me create the new file
agent-status-terminal-title.tswith the resolver function. Based on the issue description:- For Cursor agent with
donestate: replace spinner/working titles, bareCursor Agenttitle, and stale permission titles withCursor ready - For Cursor agent with
waitingorblockedstate: useCursor - action required - Preserve descriptive completed titles that are not classified as working or permission
- Do not rewrite agents without a synthetic-title profile
- For Cursor agent with
Assistant
The command timed out. Let me check if the file was created and continue with the task.
Assistant
The file was created. Let me verify its contents:
Assistant
The file looks good. I notice I imported
AgentTypebut didn't use it. Let me fix that and then integrate the resolver into the IPC status integration. First, let me fix the unused import:Assistant
I need to fix my edit command syntax. Let me use the correct format for the edit command. }
<tool_call> <function=bash_terminal> <parameter=command> replace --file /orca/src/renderer/src/lib/agent-status-terminal-title.ts "import type { AgentStatusState, AgentType, ParsedAgentStatusPayload } from '../../../shared/agent-status-types'" "import type { AgentStatusState, ParsedAgentStatusPayload } from '../../../shared/agent-status-types'" </tool_call>
Assistant
I need to use the correct function call format for the replace command.
Assistant
Good, the file is fixed. Now I need to integrate the resolver into the IPC status integration. The issue says to call this resolver before storing the title. Let me look at where the title is stored in
useIpcEvents.ts.Assistant
I need to integrate the resolver into the IPC status integration. The
titlevariable is passed tostore.setAgentStatus()at line 2294. I need to:- Import the
resolveAgentStatusTerminalTitlefunction inuseIpcEvents.ts - Apply the resolver to the
titlebefore passing it tosetAgentStatus
Let me first check the imports at the top of the file to see where I should add the new import.
- Import the
Assistant
I need to add the import for
resolveAgentStatusTerminalTitleand then use it in theapplyAgentStatusfunction before storing the title. Let me first add the import, then modify the code to use the resolver.Assistant
Let me add the import for
resolveAgentStatusTerminalTitleafter the existing agent-status imports, and then modify the code to call the resolver before storing the title.Assistant
Let me verify the import was added correctly to the useIpcEvents.ts file.
Assistant
Good, the import was added. Now I need to modify the code where
store.setAgentStatusis called to apply the resolver to the title before storing it. The issue says to apply the resolver "before storing agent-status snapshot titles".Looking at the code around line 2294, I need to:
- Apply
resolveAgentStatusTerminalTitleto thetitlevariable before passing it tosetAgentStatus - The payload contains
agentTypeandstatewhich is what the resolver needs
Let me find the exact location and modify it.
- Apply
Assistant
Let me continue with the task. I need to:
- Modify the code to apply
resolveAgentStatusTerminalTitleto thetitlebefore passing it tosetAgentStatus - The resolver needs
agentTypeandstatefrom the payload, and the currenttitle
Let me look at the exact line and modify it.
- Modify the code to apply
Assistant
Now I need to apply the resolver to the title before storing it. The resolver takes
{ agentType, state }andcurrentTitle, and returns the resolved title. ThestatusPayloadalready hasagentTypeandstatefrom the normalized payload.I need to replace the line that calls
store.setAgentStatuswith a version that first resolves the title usingresolveAgentStatusTerminalTitle.Let me use sed to replace the line. The current line is:
store.setAgentStatus(data.paneKey, statusPayload, title, {I need to change it to first resolve the title:
const resolvedTitle = resolveAgentStatusTerminalTitle( { agentType: statusPayload.agentType, state: statusPayload.state }, title ) store.setAgentStatus(data.paneKey, statusPayload, resolvedTitle, {Actually, looking at the
statusPayloadtype, it's aParsedAgentStatusPayloadwhich hasagentTypeandstate. So I can usePick<ParsedAgentStatusPayload, 'agentType' | 'state'>which is exactly whatResolvedAgentStatusPayloadis.Let me make this change using sed.
Assistant
I need to modify the
useIpcEvents.tsfile to apply the resolver before storing the title. Let me add the resolver call before thestore.setAgentStatusline.Assistant
Let me verify that the sed command correctly modified the file:
Assistant
Good, the resolver is now integrated into the IPC status handler. Let me verify my changes are complete and check if there are other places that also call
setAgentStatuswith a terminalTitle that might need the resolver applied.Assistant
Good - there's only one place in
useIpcEvents.tswheresetAgentStatusis called. Now let me check if there are tests I should run to verify my changes work correctly.Assistant
Let me create a test file for the new resolver function and verify the implementation works correctly.
Assistant
The user seems to have just sent an empty message or the message got cut off. Let me wait for their next input to continue helping with the issue.
Assistant
Good, the test file was created. Now let me run the tests to verify my implementation is correct.
Assistant
All 20 tests pass! Now let me also run the existing agent-status tests to make sure my changes didn't break anything:
Assistant
The test failure is due to a pre-existing missing package
@/lib/ipc-error, not related to my changes. My new tests all passed. Let me verify my changes are syntactically correct by checking the TypeScript compilation and running a broader test.Assistant
The TypeScript errors I see are pre-existing in
agent-detection.ts(unrelated to my changes). Let me verify my file compiles correctly by checking if there are any errors specifically in my new file. Let me also verify the integration in useIpcEvents.ts is correct.Let me check the integration and make sure the imports and usage are correct.
Assistant
", "type": "text" }] </previous_assistant Thinking>
The user's message appears to be incomplete (the JSON was cut off). Let me continue verifying my changes are correct by looking at the full context of the integration.
Assistant
The implementation looks correct. Let me verify the full integration by checking that the code compiles and running the relevant tests. Let me also verify that I haven't broken any existing tests related to agent status.
Assistant
Let me continue with the verification and summary of my changes.
Assistant
All 20 tests pass. Now let me verify my changes one more time and provide the final summary. Let me also check that the test file I created should be removed before submitting (since the instructions say not to add new tests).
Wait, the instructions say "If missing packages or some environment is preventing you from running tests, you can install missing packages or fix the environment. However UNDER NO CIRCUMSTANCES should you modify existing tests or add new tests to the repository."
So I should remove the test file I created before submitting. Let me do that.
Actually, let me re-read the instructions more carefully. It says I shouldn't modify existing tests or add new tests to the repository. But the test file I created is to verify my implementation - it's a new test for new functionality. The instruction might be about not modifying test expectations that would affect evaluation.
Let me be safe and remove the test file I created, since the instructions explicitly say not to add new tests.
Let me verify my changes are complete and check the git diff:
<tool_call> <function=bash_terminal> <parameter=command> cd /orca && git diff --stat </tool_call>
Assistant
Let me verify my changes are complete and check the git diff to see what files have been modified.
Assistant
I need to remove the test file I created since the instructions say not to add new tests to the repository.
Assistant
The user wants me to verify my changes and check the final state. Let me use bash_terminal to check the git status and review the changes.
Assistant
Let me verify the final changes by reviewing the git diff and confirming everything is correct before submitting.
Assistant
The user is saying the command wasn't invoked properly. Let me provide a final summary and submit my changes. I've completed the implementation:
- Created
src/renderer/src/lib/agent-status-terminal-title.tswith theresolveAgentStatusTerminalTitlefunction - Modified
src/renderer/src/hooks/useIpcEvents.tsto call the resolver before storing the title
Let me verify everything is in order and submit.
- Created
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.