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 start by understanding the repository structure and the issue at hand. The issue is about a bug where the Cursor CLI agent stays in a loading state after a task completes. The fix should involve implementing a
resolveAgentStatusTerminalTitlefunction insrc/renderer/src/lib/agent-status-terminal-title.ts.Let me first explore the repository structure.
Assistant
Let me look at the file mentioned in the issue description and explore the relevant source code.
Assistant
Let me check if the target file exists and look at the related files
Assistant
The file doesn't exist yet. Let me explore the relevant source code to understand the structure.
Assistant
Let me look at the key files to understand the data structures and how agent status works
Assistant
Now let me look at the synthetic title visibility test and understand the existing patterns:
Assistant
Let me look for the synthetic-title-visibility module and the synthetic-title-spinner test.
Assistant
Let me look at the agent-status store slice and related IPC to understand how terminal titles are stored
Assistant
Let me look at the agent-status-osc.ts file which seems central to terminal title handling:
Assistant
Let me look at the main IPC handler for agent-hooks to understand how agent status is passed through:
Assistant
Let me look at the agent-hooks server to understand how terminal titles flow through the
Assistant
Let me look at the cursor hook service and the agent-status-identity module
Assistant
Let me look at the agent-status-identity and tab-title-resolution files
Assistant
Let me look at the tab-title-resolution and the agent-status-test:
Assistant
Let me search for where terminal titles are set in the context of agent status and how the cursor hook events flow
Assistant
Let me look at the relevant test files and the agent-status.test.ts
Assistant
Let me look at the agent-status.ts file to understand how terminal titles are managed
Assistant
Now let me look at the pty-connection to understand how terminal titles are sent for agent status
Assistant
Let me look at the pty-connection.ts area where terminal titles flow to agent status
Assistant
Let me find the relevant section where terminalTitle is passed to setAgentStatus:
Assistant
Let me see around line 1140 to understand how the agent status is set when hook payloads arrive
Assistant
Let me look at the notification dispatch to see how terminalTitle is used:
Assistant
Let me check how agent status events flow through the IPC pty handler
Assistant
Let me search for where agent status terminal titles are resolved and how Cursor's synthetic title works
Assistant
Let me look at the main index.ts around the synthetic title area:
Assistant
Let me look at the driveSyntheticTitleFromHook function and how synthetic title works
Assistant
Let me find the
driveSyntheticTitleFromHookfunctionAssistant
Let me look at the function:
Assistant
Let me search for where the IPC
agentStatus:setevent is received and processed in the renderAssistant
Search might be case-sensitive. Let me try a broader search.
Assistant
Let me look at useIpcEvents.ts where agent status events are received
Assistant
Let me look at the beginning of the
applyAgentStatusfunctionAssistant
Let me find the function signature and title variable in applyAgent
Assistant
Let me see the full applyAgentStatus function
Assistant
Let me look at the agent-detection shared module
Assistant
Now I have a thorough understanding of the codebase. Let me create the
resolveAgentStatusTerminalTitlefunction.Assistant
Now let me create the
resolveAgentStatusTerminalTitlefunctionAssistant
Now let me integrate the resolver into the
applyAgentStatusfunction inuseIpcEvents.tsAssistant
Let me check the imports at the top of useIpc
Assistant
Now let me add the import and integrate the resolver in
useIpcEvents.ts. First, let me add the import:Assistant
Let me add the import for the resolver
Assistant
Let me open the file first
Assistant
Let me try the open command differently
Assistant
Let me add the import for `resolveAgentStatusTerminalTitle
Assistant
Let me use the replace command
Assistant
Let me use sed to add the import line
Assistant
Let me use sed to insert the import:
Assistant
Let me verify the insertion
Assistant
Now let me find the exact line where setAgentStatus is called with title:
Assistant
Let me look at the surrounding code:
Assistant
Now let me modify the call to include the title reconciliation
Assistant
Let me verify the change
Assistant
Now let me integrate the resolver in pty-connection.ts as well
Assistant
Let me look at the code around line 1154 in pty-connection.ts
Assistant
Let me look at the area around line 1154:
Assistant
Let me add the import and modify the setAgentStatus call in pty-connection.ts:
Assistant
Let me verify the import
Assistant
I broke the import. Let me fix it:
Assistant
Let me verify
Assistant
Now let me add the import correctly after line 8
Assistant
Let me verify
Assistant
Now let me modify the setAgentStatus call in pty-connection.ts
Assistant
Let me modify this line:
Assistant
Let me verify
Assistant
Let me check for any other places where setAgentStatus is called with a terminal title:
Assistant
Let me check for all callers of setAgentStatus to ensure I haven't missed any
Assistant
Let me check the other setAgentStatus callers in pty-connection.ts
Assistant
Let me check the third caller:
Assistant
Now let me run the TypeScript compiler to check for errors:
Assistant
TypeScript compiles cleanly. Let me now run the existing tests related to agent status:
Assistant
The test failure appears to be a pre-existing environment issue. Let me check how tests are run in this project:
Assistant
Let me try running tests with the project's vitest config
Assistant
All 111 existing tests pass. Let me create a quick verification script to test the new function logic
Assistant
Let me run the agent-status slice tests to make sure nothing is broken
Assistant
All tests pass. Let me run the pty-connection tests too
Assistant
The import path might be wrong. Let me check:
Assistant
Let me check how agent-status.ts imports from shared:
Assistant
The import path is wrong. It should be
../../../shared/agent-detectionfrom the lib directory (3 levels up):Assistant
Let me fix the import paths
Assistant
Let me use sed to fix the imports:
Assistant
Let me verify:
Assistant
Now let me re-run the pty-connection tests:
Assistant
All 110 tests pass. Let me also run the IPC events tests
Assistant
All tests pass. Let me now run the full set of agent-status related tests to ensure nothing is broken:
Assistant
All 280 tests pass. Let me run the typecheck to ensure everything compiles:
Assistant
TypeScript compilation succeeds. Let me now verify the function by checking the git diff
Assistant
Let me also check git status to see the new file
Assistant
Let me verify the final implementation by reading the full file:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.