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
Let me analyze the issue:
- The bug is about a Cursor CLI agent staying in a loading state after completing its task
- The evaluation contract describes a function
resolveAgentStatusTerminalTitlethat should reconcile terminal titles with synthetic title profiles - For Cursor agent type:
donestate should replace spinner/working titles, bareCursor Agenttitle, and stale permission titles withCursor readywaitingorblockedstates should useCursor - action required- Preserve descriptive completed titles that are not classified as working or permission
- Don't rewrite agents without a synthetic-title profile
Let me first explore the repository structure to understand the codebase.
Assistant
Let me look at the file structure, specifically looking for the
agent-status-terminal-title.tsfile mentioned in the issue.Assistant
The file
agent-status-terminal-title.tsdoesn't exist yet. Let me search for related files and understand the existing structure better.Assistant
Let me search for the file mentioned in the issue description more broadly.
Assistant
Let me continue exploring the repository to understand the codebase structure.
Assistant
The file
agent-status-terminal-title.tsdoesn't exist yet - I need to create it. Let me look at the existing agent-status files and IPC integration to understand the patterns.Assistant
Good, there are synthetic-title related files. Let me look at these and understand the pattern.
Assistant
Let me continue exploring the codebase to understand the patterns better.
Assistant
Let me explore the agent-status types and IPC integration to understand the patterns better.
Assistant
Now let me look at the agent-status-identity.ts and how IPC integration works.
<tool_call> <function=bash_terminal> <parameter=command> cat /orca/src/shared/agent-status-identity.ts </tool_call>
Assistant
Let me continue exploring the repository to understand the patterns better.
Assistant
Let me explore the IPC integration and where terminal titles are stored.
Assistant
Let me search for where terminal titles are handled in IPC and agent status integration.
Assistant
Let me look at how terminalTitle flows through the IPC system.
Assistant
Let me look at the useIpcEvents.ts file to understand how agent status is handled via IPC.
Assistant
Let me look at more of the IPC events file to understand how agent status is processed.
Assistant
Let me look at the agent status IPC handler to understand how the title is processed.
Assistant
Let me find the
applyAgentStatusfunction to understand how terminal titles are used.Assistant
Let me see the
applyAgentStatusfunction:Assistant
Now let me understand how the IPC status integration works on the main process side:
Assistant
Let me understand the flow better. Let me look at the main process side where agent status is handled and where terminal titles are stored.
Assistant
Now let me look at the agent-hooks server to see how terminalTitle is handled on the main process side.
Assistant
Let me look at how the agent hooks server handles terminal titles and how it sends data to the renderer.
Assistant
The grep found nothing. Let me look at the server.ts file more broadly to understand its structure.
Assistant
Let me now look at how terminal titles are retrieved and sent to the renderer, specifically around the IPC channels.
Assistant
Let me look at the agent-hooks IPC handler to understand how terminal titles flow.
Assistant
Let me look at the cursor hook service to understand how Cursor CLI agent works.
Assistant
Let me explore the cursor hook service to understand how Cursor CLI agents work:
Assistant
Let me look at how terminal titles flow from PTY to the agent status store, and understand where the title resolver should be called.
Assistant
Let me understand how the terminal title flows from PTY to the store and where it should be resolved:
Assistant
Now let me understand the full picture. I need to look at how terminal titles are retrieved and where they flow through the IPC system. Let me also look at how the
resolveHookPayloadAgentTypefunction works as a pattern.Assistant
Now I have a good understanding of the codebase. Let me also look at the existing synthetic-title files and tests to understand the patterns better:
<tool_call> <function=bash_terminal> <parameter=command> cat /orca/src/main/synthetic-title-visibility.test.ts </tool_call>
Assistant
Let me continue exploring the synthetic title tests to understand the patterns better.
Assistant
Now I understand the codebase. Let me review what I need to do:
- Create
src/renderer/src/lib/agent-status-terminal-title.tswith a functionresolveAgentStatusTerminalTitle - The function should reconcile hook-reported state with synthetic terminal-title profiles
- For Cursor agent type:
donestate maps to "Cursor ready" (replacing spinner/working titles, bareCursor Agenttitle, stale permission titles)waitingorblockedstates map to "Cursor - action required"- Descriptive completed titles that are not classified as working/permission should be preserved
- Agents without a synthetic-title profile should not be rewritten
Let me look at the existing test files to understand the pattern for tests:
<tool_call> <function=bash_terminal> <parameter=command> cat /orca/src/renderer/src/lib/agent-status.test.ts </tool_call>
- Create
Assistant
Let me look at the existing agent-status tests for the pattern to follow:
Assistant
Now let me look at how the agent-status.ts handles title detection for Cursor:
Assistant
Let me look at how the title detection works in agent-status.ts to understand the title classification better.
Assistant
Now I have a clear understanding of the codebase. Let me create the solution:
- First, let me create the
agent-status-terminal-title.tsfile with the resolver function:
- First, let me create the
Assistant
Let me create the
agent-status-terminal-title.tsfile:Assistant
Now I need to create the test file for this function. Let me first verify the file was created correctly:
Assistant
Now let me create the test file:
Assistant
Now let me run the tests to verify the implementation:
Assistant
I see the issue - there's a typo in the test. "cUsOr" lowercased is "cusor" (missing 'r'). Let me fix the test:
Assistant
The test case is wrong - "cUsOr" lowercases to "cusor" which is not "cursor". Let me fix the test:
Assistant
The issue is that the test case has a typo - "cUsOr" lowercases to "cusor", not "cursor". Let me fix this test properly:
Assistant
Let me fix the test properly - the issue is that "cUsOr" lowercases to "cusor" (missing 'r'), not "cursor":
Assistant
Let me run the tests again to verify the fix.
Assistant
All tests pass. Now I need to integrate the resolver into the IPC status flow. According to the issue, "The IPC status integration must call this resolver before storing the title."
Let me find where the title is stored in the agent-status IPC flow:
Assistant
I need to integrate the resolver into the IPC status flow. The issue says "The IPC status integration must call this resolver before storing the title."
Looking at the code in useIpcEvents.ts, around line 2294, there's a call to
store.setAgentStatus(data.paneKey, statusPayload, title, {...}). Thetitlevariable here is the current terminal title that's being passed to the store.I need to:
- Import the resolver function in useIpcEvents.ts
- Call it before passing the title to setAgentStatus
- Pass the resolved title instead of the raw title
Let me look at the context around line 2294 to understand exactly what needs to be changed.
Assistant
I need to integrate the resolver into the IPC status flow. Let me look at the imports section of the file:
Assistant
Now I need to add the import and call the resolver. Let me make the changes:
Assistant
Let me add the import and call the resolver in the IPC handler:
Assistant
Now let me verify the import was added correctly and modify the call to use the resolver:
Assistant
The sed command didn't work because the import spans multiple lines. Let me look at the exact import block and fix it properly:
Assistant
Let me fix the import properly:
Assistant
Let me check the current state and fix the import:
Assistant
The sed command didn't insert the import. Let me add it properly after the agent-status-identity import. I need to add the import statement for the resolver function after the existing imports from agent-status-identity. I'll add the import line after the agent-status-identity import block.
Assistant
Let me add the import for the resolver function properly.
Assistant
Let me try a different approach - use sed to insert the import line.
Assistant
Let me verify the import was added correctly.
Assistant
Let me check the exact content around the import:
Assistant
Let me fix the sed command with the correct import path:
Assistant
Let me verify the import was added correctly.
<tool_call> <function=bash_terminal> <parameter=command> grep -n "agent-status-terminal-title" /orca/src/renderer/src/hooks/useIpcEvents.ts </tool_call>
Assistant
Let me continue verifying the import and then update the IPC status handler to use the resolver.
Assistant
The import was added successfully. Now I need to modify the call to
store.setAgentStatusto use the resolver before storing the title. Let me find the exact line and modify it.Assistant
Let me look at the exact lines around 2295 to make the right modification.
Assistant
Now I need to modify the call to
store.setAgentStatusto use the resolver. Let me create the proper replacement:Assistant
I need to modify the line that calls
store.setAgentStatus(data.paneKey, statusPayload, title, {...})to first resolve the title using the resolver function.The current code passes
titledirectly tosetAgentStatus. I need to callresolveAgentStatusTerminalTitlewith the agent type, state, and current title, then pass the resolved result.Looking at the code:
statusPayloadcontains theagentTypeandstatetitleis the current terminal title
I need to:
- Call
resolveAgentStatusTerminalTitle({ agentType: statusPayload.agentType, state: statusPayload.state, currentTitle: title }) - Use the result as the title parameter
Let me modify the code.
Assistant
Now I need to replace the line that calls
store.setAgentStatusto use the resolver. The current code is:typescriptstore.setAgentStatus(data.paneKey, statusPayload, title, { updatedAt: data.receivedAt, stateStartedAt: data.stateStartedAt })I need to change it to use the resolver:
typescriptconst resolvedTitle = resolveAgentStatusTerminalTitle({ agentType: statusPayload.agentType, state: statusPayload.state, currentTitle: title }) store.setAgentStatus(data.paneKey, statusPayload, resolvedTitle, { updatedAt: data.receivedAt, stateStartedAt: data.stateStartedAt })Let me make this change using sed.
Assistant
Let me try a different approach to make the edit:
Assistant
Let me try using sed to make the change:
Assistant
Let me verify the changes were made correctly:
Assistant
I see the sed replacement didn't work correctly - the old line is still there. Let me fix this properly:
Assistant
I see the issue - the sed replacement left the old line. Let me fix it:
Assistant
Let me verify the changes were made correctly now:
Assistant
The changes look correct now. Let me verify the code compiles by running the TypeScript compiler:
Assistant
TypeScript compilation passed. Let me now run the tests to ensure everything works correctly:
Assistant
All tests pass. Let me also run the existing agent-status related tests to make sure I haven't broken anything:
Assistant
The test failure is due to a missing test dependency (unrelated to my changes). Let me run the agent-status tests that can be executed:
Assistant
These test failures are due to missing test dependencies (unrelated to my changes). Let me verify my changes are correct by checking the git diff and ensuring the code structure is right:
Assistant
Let me check if the new files were created:
Assistant
Let me verify the diff of the changes and make sure everything is correct:
Assistant
Let me now verify the new files and ensure the test passes:
Assistant
Let me run the test again to ensure all tests pass:
Assistant
All 29 tests pass. Let me verify the TypeScript compilation passes:
Assistant
Let me continue fixing the test file and verifying everything is working correctly.
Assistant
Let me run the existing tests in the repository to ensure my changes don't break anything.
Assistant
The shared agent-status-types tests pass. Let me also run the synthetic-title tests to verify the overall system still works:
Assistant
Let me run a broader test to ensure existing tests still pass.
Assistant
All shared tests pass. Let me run the main process tests as well to verify the integration:
Assistant
The test failures appear to be pre-existing issues unrelated to my changes. Let me verify by running a quick check on the specific agent-status tests and IPC-related tests:
Assistant
The test failures exist without my changes, so they are pre-existing issues. Let me restore my changes.
Assistant
All changes are in place. Let me run the new test one more time to confirm everything is working:
Assistant
All tests pass. Let me provide a summary of the changes made:
Summary of Changes
Issue
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.
Solution
Created a new function
resolveAgentStatusTerminalTitlethat reconciles hook-reported state with synthetic terminal-title profiles, and integrated it into the IPC status flow.Files Created
-
- Contains the resolver function with:
-
Assistant
Let me submit the solution properly.
Assistant
The submit command seems to require a specific format. Let me try it again.
Assistant
The user is asking me to submit my changes. I need to use the submit command to complete this task. Let me do that.
Assistant
The user is asking me to submit my changes. I've already made all the necessary modifications to fix the issue. Let me use the submit command properly.
Assistant
The solution has been successfully implemented and submitted. Here's a summary of the changes:
Summary
Problem
When running a Cursor CLI agent session in Orca, the UI continued to show a loading/running state after the agent had finished its task, because stale terminal titles (spinner, working, permission) were not being reconciled with the hook-reported
donestate.Solution
New file:
src/renderer/src/lib/agent-status-terminal-title.ts- Contains
resolveAgentStatusTerminalTitle()function that reconciles hook-reported state with synthetic terminal-title profiles - For Cursor/Droid/Hermes agents:
donestate → replaces spinner/working/bare-native/permission titles with "{Agent} ready", preserves descriptive completed titleswaiting/blockedstate → maps to "{Agent} - action required"workingstate → preserves title as-is- Non-synthetic agents → passes through title unchanged
- Contains
Assistant
Based on the context, my solution has been fully implemented. Let me verify the current state:
Assistant
The user is continuing the conversation. Looking at my previous work, I've already:
- Created
src/renderer/src/lib/agent-status-terminal-title.ts- the resolver function - Created
src/renderer/src/lib/agent-status-terminal-title.test.ts- the test file - Modified
src/renderer/src/hooks/useIpcEvents.ts- to integrate the resolver
All tests pass (29 tests), TypeScript compilation passes, and the existing tests still pass.
The submit command was attempted earlier but had issues. Let me try to submit again.
- Created
Assistant
The submit command seems to have issues with the tool invocation format. Let me verify my solution is complete and properly saved, then attempt submit again.
Assistant
All the changes are in place and all 29 tests pass. Let me try submitting the solution.
Assistant
The submit tool call is not working. Let me check if there's an issue with the format. The tool description says:
"Usage: submit [OPTIONS] Submits your current code and terminates the session."
But when I call it, it says "Cannot extract command from tool call
submitwith arguments{}". This suggests the tool expects some specific format. Let me try calling it through bash_terminal or see if there's a different way.Actually, looking at the tool definitions more carefully, I see there's a
submittool defined. Let me try calling it properly.Actually, looking at the error message, it seems like the submit tool is being called but with empty arguments. The tool might not need any arguments, but I need to call it correctly.
Let me just try again with the proper tool call format.
Assistant
The user is asking me to submit my solution. I've already created all the necessary files and modified the existing code. The submit command doesn't seem to be working through the tool invocation. Let me try to submit again with the correct format.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.