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 to understand its structure and locate relevant files for the issue. Let's first get an overview.
- Assistant
Let me explore the repository structure more broadly.
- Assistant
Let me explore the source directory structure.
- Assistant
Let me look at the specific file mentioned in the interface description:
src/renderer/src/lib/agent-status-terminal-title.ts - Assistant
I see the file
src/renderer/src/lib/agent-status-terminal-title.tsdoesn't exist yet. I need to create it. Let me first understand the existing codebase structure and types. - Assistant
Now let me look at the agent-status.ts file to understand how agent status is managed:
- Assistant
Now let me look at the agent-detection module which seems to be imported:
- Assistant
Now let me look at the agent-status store slice and how it handles terminal titles:
- Assistant
Now let me check how agent status IPC events are processed in the renderer. Let me look at the agent-status hooks and IPC integration:
- Assistant
Let me search for the IPC integration and where the title gets stored.
- Assistant
Good, the function doesn't exist yet. Let me search for how agent-status IPC is handled in the renderer:
- Assistant
Let me look at the useIpcEvents hook to understand how agent status IPC events are handled:
- Assistant
Let me look at the IPC event handler for agent status:
- Assistant
Let me look at lines around 2371 where the IPC event handler is set up:
- Assistant
Let me find the applyAgentStatus function:
- Assistant
Let me look at the applyAgentStatus function:
- Assistant
Let me search for
resolvePaneKeyto understand how the terminal title is resolved: - Assistant
Let me look at the resolvePaneKey function:
- Assistant
Let me search for existing synthetic-title profiles or patterns:
- Assistant
Let me look at the synthetic-title-spinner.ts file:
- Assistant
Let me look at the synthetic-title-visibility.ts file:
- Assistant
Let me look at how the synthetic title spinner is used in the main process:
- Assistant
Let me look at more context around the synthetic title spinner usage:
- Assistant
Let me look at the SyntheticTitleProfile and the profiles:
- Assistant
Now let me look at the
driveSyntheticTitleFromHookfunction: - Assistant
Let me look at that function: evaluation contract: 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: PickNow I have a good understanding of the codebase. Let me look at how the agent status hooks work to understand where to insert the resolver:
- Assistant
Let me look at one thing at a time.
- Assistant
Now I understand the architecture. Let me look at the
driveSyntheticTitleFromHookfunction to understand the synthetic title logic: - Assistant
Now I understand the architecture. Let me look at the existing test files for agent status to understand patterns:
- Assistant
Now I have a clear picture of the issue. Let me understand the full flow:
- The main process has synthetic title profiles for agents like Cursor, which generate OSC titles for working/permission/idle states
- When the agent finishes (done state), the terminal title might still show a spinner/working title because of timing
- The resolver function needs to reconcile the agent state with the terminal title before storing it in the agent-status snapshot
Let me first look at how the synthetic title profiles work and understand the cursor title patterns:
- Assistant
Now let me look at existing test files for agent status to understand patterns better:
- Assistant
Let me look at the synthetic title test files:
- Assistant
Now I have a good understanding of the codebase. Let me create the
resolveAgentStatusTerminalTitlefunction and integrate it. Let me first check how the title flows through the system: - Assistant
Let me look at the full
setAgentStatusfunction: - Assistant
Now I have a clear understanding of the problem. Let me check one more thing - the
resolveHookPayloadAgentTypefunction to understand how agent types are resolved: - Assistant
Let me look at the
resolveHookPayloadAgentTypefunction: - Assistant
Now I have a clear understanding of the problem. Let me create the solution:
-
The issue is that when the Cursor agent reports
donestate, the terminal title might still show a working/spinner title because there's a race condition between the agent status IPC event and the synthetic title update. TheresolveAgentStatusTerminalTitlefunction needs to reconcile these before the title is stored. -
I need to create
src/renderer/src/lib/agent-status-terminal-title.tsand integrate it into the IPC handler.
Let me first check what tests exist and then create the solution:
-
- Assistant
Now I have a clear understanding of the problem. Let me create the resolver function and integrate it.
The issue is that when a Cursor CLI agent finishes its task and reports
donestate, the terminal title stored in the agent-status snapshot might still show a spinner/working title (like "⠋ Cursor Agent") or the bare native title ("Cursor Agent"), because the synthetic title update races with the IPC event. The resolver needs to reconcile these titles with the agent's synthetic-title profile before storing them.Let me create the resolver:
- Assistant
Now let me integrate the resolver into the IPC handler. Let me look at the exact location where
setAgentStatusis called: - Assistant
Now I need to integrate the resolver. Let me first check the imports section:
- Assistant
Now I need to add the import and integrate the resolver. Let me add the import first:
- Assistant
Let me add the import after the existing agent-status imports:
- Assistant
Let me try a different approach:
- Assistant
Let me use the replace command instead.
- Assistant
Now let me integrate the resolver into the
applyAgentStatusfunction. I need to resolve the title before passing it tosetAgentStatus: - Assistant
Now I need to modify the line where
store.setAgentStatusis called to use the resolved title: - Assistant
Let me verify the change was applied correctly:
- Assistant
Let me verify the import was added correctly:
- Assistant
Good. Now let me verify the resolver file was created correctly:
- Assistant
Wait, the output seems to have merged two files. Let me check:
- Assistant
Good. Now let me run the existing tests to make sure the changes don't break anything:
- Assistant
The test failure is a pre-existing issue unrelated to my changes. Let me check if there are other tests that might be relevant:
- Assistant
Good. Let me also check if there are tests for the agent-status IPC handling:
- Assistant
Let me check if there are tests for the agent-status store slice:
- Assistant
Let me check what tests can actually run and look for any related to agent detection:
- Assistant
Now let me write a test to verify the new resolver function works correctly:
- Assistant
Now let me run the test to verify:
- Assistant
All 19 tests pass. Now let me remove the test file before submitting since the instructions say not to add tests to the repository:
- Assistant
Let me verify the existing test failures are pre-existing and not related to my changes:
- Assistant
The files exist but the test runner has module resolution issues. Let me verify my changes compile correctly:
- Assistant
The errors are pre-existing in
agent-detection.ts, not my changes. Let me also check that the import in useIpcEvents.ts is valid by checking if it can resolve: - Assistant
Let me check how other files in the same directory handle their imports:
- Assistant
The imports are consistent with the existing codebase. The
.jsextension warnings are from runningtscdirectly; the project uses Vite which handles this differently. Let me verify with the project's tsconfig: - Assistant
Let me check the web tsconfig to understand how the renderer files are compiled:
- Assistant
Let me check the base tsconfig:
- Assistant
Let me check the base tsconfig.json:
- Assistant
Good, the project uses
"moduleResolution": "bundler"which doesn't require.jsextensions. My imports are consistent with the existing codebase.Let me now verify the complete set of changes:
- Assistant
Let me look at the diff to make sure everything is correct:
- Assistant
Let me also verify the new file content:
- Assistant
Let me run the test one more time to make sure everything is good:
- Assistant
All 19 tests pass. Let me clean up the test file:
- Assistant
Let me do a final review of all changes:
- Assistant
Let me also verify the new file is clean and complete:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.