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 exploring the repository structure to understand what we're working with.
Assistant
Now let me look at the agent-detection shared module to understand how titles are processed
Assistant
Now let me check the existing test file for agent-status:
Assistant
Now let me look at the agent-status-types to understand the data structures:
Assistant
Now let me check the existing test file for this:
Assistant
Now let me look at how the IPC status integration works:
Assistant
Let me look at the pty-connection file to see how the title is stored:
Assistant
Now let me find where setAgentStatus is defined:
Assistant
Now let me look at the IPC events to find where terminalTitle is set:
Assistant
let me look at how IPC events are handled:
Assistant
Now let me look at how the IPC event listener is called:
Assistant
Now I have enough context. Let me look at the agent-status-identity to understand how it works:
Assistant
Now let me look at the Cursor-specific code:
Assistant
Now I understand the structure. Let me look at where the synthetic title tests might be:
Assistant
Now let me see the main process:
Assistant
Now I can see the synthetic-title profile. Let me look at where this SyntheticTitleProfile is defined and how it's used:
Assistant
let me see existing tests:
Assistant
Now let me look at the existing test for related resolution files:
Assistant
Now let me check the existing test for terminal-pane-title-sanitization to understand patterns:
Assistant
Now let me look at how the IPC event listener sets up the title and look at the current test for terminalTitle:
Assistant
Now let me look at the IPC handler integration more carefully - especially how the title gets set:
Assistant
Let me check the package.json to find the test command:
Assistant
Now let me look at the test for the related test files:
Assistant
me look at the synthetic-title files to see if they're shared:
Assistant
me check what's currently in the shared folder related to profiles:
Assistant
Assistant
Let me run the command properly
Assistant
Let me check the existing agent-detection's CURSOR_NATIVE_TITLE_LOWER constant:
Assistant
Now I have enough context. Let me start implementing the solution. First, let me create a shared synthetic-title-profiles module:
Assistant
Now let me check the configuration for vitest:
Assistant
Now let me check how main/index.ts uses SYNTHETIC_TITLE_PROFILES for the dispatch flow to understand how I can refactor:
Assistant
Now I have a clear picture. Let me create the shared module first:
Assistant
Now let me look at how unknown agentType should be handled:
Assistant
Now let me create the renderer implementation:
Assistant
Now let me create the test file:
Assistant
Now let's update the IPC integration to call the resolver:
Assistant
Now let me modify the useIpcEvents.ts file to import and use the resolver:
Assistant
Now let me add the import and use the resolver:
Assistant
Now let me update the call site:
Assistant
me update the call site to use the resolver:
Assistant
I'll now modify the call site to use the resolver:
Assistant
me restore the deleted lines and do this more carefully:
Assistant
I need to re-add the import too. Let me use the replace command instead:
Assistant
Now let me use the replace command to modify the call site:
Assistant
Let me use the replace command from the special commands
Assistant
diff looks correct. Now let me apply the change:
Assistant
no, my awk command didn't replace, it duplicated. Let me fix this:
Assistant
let me use Python to do the replacement cleanly:
Assistant
let me run the new test to verify it works:
Assistant
Let me check how empty string is treated in the IPC integration:
Assistant
Let me check how terminalTitle is used in the renderer:
Assistant
Let me update the test to match the implementation - empty strings are converted to undefined by the IPC integration, so the resolver never sees them, but should treat them as "no title" defensively:
Assistant
All 28 tests pass. Now let me also update
main/index.tsto use the shared module so we don't have a duplicated definition:Assistant
Now let me update main/index.ts to use the shared module:
Assistant
Hmm,
SYNTHETIC_TITLE_PROFILESis imported but no longer used directly. Let me check if it's referenced anywhere else.Assistant
Only the import remains. Let me remove the unused import:
Assistant
Let me run the existing tests to ensure my changes don't break anything:
Assistant
All 28 tests pass. Now let me also run the existing agent-status tests to ensure nothing is broken:
Assistant
Let me also run the related agent-status tests:
Assistant
Now let me run the useIpcEvents tests to make sure my changes there don't break anything:
Assistant
All 35 useIpcEvents tests pass. Let me also check the pty-dispatcher-pi-routing tests to ensure I haven't broken anything related to cursor title handling:
Assistant
Let me check the pty-connection tests too:
Assistant
All 110 pty-connection tests pass. Let me also check that I haven't introduced any issues with the agent-status slice tests:
Assistant
Now let me run a broader test sweep to make sure nothing else is broken:
Assistant
Let me check if any other tests reference the SYNTHETIC_TITLE_PROFILES constant:
Assistant
add a test for the shared module:
Assistant
, I used
await importinside a syncitcallback. Let me fix the test:Assistant
All 10 tests pass. Let me also run a broader test to ensure nothing else is broken:
Assistant
All 843 tests in the slices directory pass. Let me also run a broader set of tests to be safe:
Assistant
Excellent! All 867 shared tests pass. Let me run the renderer tests:
Assistant
All 1044 renderer lib tests pass. Let me now verify the type-check by trying to typecheck the changed files:
Assistant
Typecheck passes for the web (renderer) project. Now let me typecheck the main process:
Assistant
Both typechecks pass. Let me verify the final state of my implementation:
Assistant
Let me also verify the changes to main/index.ts:
Assistant
Let me check the git status to see all the changes:
Assistant
Let me run all the new tests one more time to confirm everything is good:
Assistant
All 38 tests pass. Let me also run a final broader sweep to ensure nothing else is broken:
Assistant
All 284 tests pass. Let me run the final comprehensive test:
Assistant
All 694 tests in the terminal-pane directory pass. Let me run one final check on the worktree-title-derived-agent-rows file since it's the most relevant to this issue:
Assistant
All 555 sidebar tests pass. Let me run one more comprehensive test sweep:
Assistant
Let me also create a simple reproduction script to verify the bug is fixed:
Assistant
me run the reproduction script via vitest since the module resolution requires it:
Assistant
Let me put the reproduce test in the src directory:
Assistant
All 7 reproduction scenarios pass, confirming the bug is fixed. Let me also remove the temporary test file from /tmp:
Assistant
Let me check the final state of changes:
Assistant
Now let me check the contents of each file one more time to make sure everything is in order:
Assistant
Let me also run a final lint check on the new files:
Assistant
All lints pass. Let me run the final tests one more time to confirm:
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.