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 to understand the codebase and find the relevant files mentioned in the issue.
Assistant
Let me look for the specific file mentioned in the issue:
src/renderer/src/lib/agent-status-terminal-title.tsAssistant
The file doesn't exist yet. Let me explore the repository structure more:
Assistant
Let me explore the src directory to understand the structure better.
Assistant
Let me look at existing agent status and terminal title files to understand the patterns:
Assistant
Now let me look at the terminal title contrast file to understand the title resolution patterns:
Assistant
Now let me look at the shared types and agent detection files to understand the data structures:
Assistant
Let me look at the agent-status-types.ts file to understand the types:
Assistant
Now let me search for any existing synthetic-title files and understand the pattern:
Assistant
Let me look at the synthetic-title-related files:
Assistant
Now let me search for where agent status and terminal titles interact - particularly where the IPC status integration stores titles:
Assistant
Let me look at the agent-hooks IPC handling in main process:
Assistant
Now let me look at the agent-hook-listener to understand how terminal titles are processed and where the resolver should be called:
Assistant
Let me look at the agent-hook-server to find where titles are stored:
Assistant
Let me search for where agent status titles are stored:
Assistant
Let me search more specifically for the agent status IPC and where terminal titles are set:
Assistant
I need to find where the terminalTitle is being set/populated in the agent status IPC payload. Let me look at the main index.ts file where agentStatus:set is sent.
Assistant
Let me see that section of the main index.ts:
Assistant
Now let me look at the
driveSyntheticTitleFromHookfunction and theSYNTHETIC_TITLE_PROFILESto understand the current pattern:Assistant
Now I understand the issue better. The
driveSyntheticTitleFromHookfunction handles title updates for agents like Cursor, but there's also an IPC status integration that stores terminal titles. Let me search for where the IPC status stores the title snapshot:Assistant
Let me look at the pty-connection.ts file to see how agent status and terminal titles are stored:
Assistant
Now let me look at the
setAgentStatusfunction in the app store to see how it stores the title:Assistant
Now I can see that the
setAgentStatusfunction stores aterminalTitlebut I need to understand where the title resolver should be called. The issue mentions "The IPC status integration must call this resolver before storing the title." Let me search for where the title is stored before callingsetAgentStatus:Assistant
So this is the key location. The
titlevalue comes fromruntimePaneTitlesByTabIdand is passed tosetAgentStatuswithout being resolved. According to the issue, aresolveAgentStatusTerminalTitlefunction should be called to reconcile the terminal title before storing it.Let me also check other places where
setAgentStatusis called with a title:Assistant
Now let me look for where agent status is applied from the IPC side:
Assistant
bash / edit
Assistant
Let me search for where the agentStatus:set IPC listener is set up in the renderer.
Assistant
Let me search more broadly for where IPC agent status events are handled in the renderer.
Assistant
Let me search for where the IPC listener for agent status events is set up in the renderer.
Assistant
Found it! The key file is
useIpcEvents.tsat line 2294. Let me examine that file.Assistant
I found the key location where
setAgentStatusis called with a title. Now I need to see wheretitleis computed before this call. Let me look at more context around line 2294.Assistant
OK, so the title is retrieved from
runtimePaneTitlesByTabIdand passed directly tosetAgentStatus. But the issue says that for Cursor agents, when the agent isdone, the terminal title may still be a spinner/working title, bareCursor Agent, or a permission title — and it should be resolved toCursor readyinstead.Let me see where
titlecomes from — I need to see the beginning of this IPC handler function.Assistant
Now I understand the issue. The
titlecomes fromresolvePaneKey(store, data.paneKey)which gets the raw terminal title. Before storing this title insetAgentStatus, I need to call a resolver that reconciles the terminal title with the agent's synthetic title profile.Let me look at the agent-detection module to understand title patterns:
Assistant
Now I have a good understanding of the problem. The issue states:
- When a Cursor CLI agent finishes, the UI stays in a loading/running state
- The
resolveAgentStatusTerminalTitlefunction needs to be created to reconcile terminal titles with the agent's synthetic title profile - For Cursor:
doneshould replace spinner/working titles, bareCursor Agenttitle, and stale permission titles withCursor ready;waiting/blockedshould useCursor - action required - This resolver must be called before storing agent-status snapshot titles
Let me look at where exactly the title is stored and needs to be resolved:
Assistant
Now I understand the full picture. Let me create the
resolveAgentStatusTerminalTitlefunction atsrc/renderer/src/lib/agent-status-terminal-title.tsand then integrate it into the IPC status handler.Assistant
I need to use the create command differently - it seems the syntax needs adjustment. Let me try creating the file using a different approach.
Assistant
Now I need to integrate this resolver into the IPC status handler in
useIpcEvents.ts. The resolver should be called before storing the title insetAgentStatus. Let me examine the exact location again and make the necessary changes.Assistant
Now I need to add the import and use the resolver. Let me find the right place to add the import.
Assistant
Now I need to add the import for the new resolver and use it in the IPC handler. Let me add the import first.
Assistant
The user is having trouble with the edit command. Let me use a proper format for the edit command. The issue is that I need to provide the edit with the correct format.
Assistant
The user's last command failed. The
editcommand syntax doesn't seem to be working. Let me try usingreplaceor thebash_terminalcommand to modify the file instead.I need to add the import for
resolveAgentStatusTerminalTitleand then use it in the code. Let me usebash_terminalwithsedto make the changes.Assistant
Let me verify the import was added correctly, then find the exact location where I need to use the resolver before storing the title.
Assistant
The import has been added successfully. Now I need to find the exact location where
setAgentStatusis called and thetitleis passed, then wrap that title with the resolver before passing it tosetAgentStatus.Looking back at the code, the key location is around line 2294 where:
store.setAgentStatus(data.paneKey, statusPayload, title, { updatedAt: data.receivedAt, stateStartedAt: data.stateStartedAt })I need to replace
titlewithresolveAgentStatusTerminalTitle(statusPayload, title)so that the terminal title is reconciled with the agent's synthetic profile before storing.Let me check the exact line number since I added a line.
Assistant
Now I need to modify line 2295 to use the resolved title. Let me use sed to replace it.
Assistant
Assistant
The integration looks correct. Now let me create a test file to verify my implementation works correctly.
Assistant
Now let me run the test to see if my implementation is correct.
Assistant
I see the issue. The bare native titles "OpenCode" and "Hermes" are classified as 'idle' by
detectAgentStatusFromTitle(since they contain agent names but no working/permission keywords). I need to fix the logic to replace these bare native titles with the idle label as well.Assistant
All tests pass. Now let me run the existing tests related to agent status to make sure my changes don't break anything.
Assistant
The test failure is unrelated to my changes - it's a pre-existing import issue with
@/lib/ipc-error. Let me verify my changes and run some other relevant tests.Assistant
Let me verify the changes I made are correct by checking the diff and then run the tests again to confirm everything works.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.