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 start by understanding the repository structure and finding the relevant file mentioned in the issue description.
The issue is about a function called
resolveAgentStatusTerminalTitlethat needs to be implemented or fixed insrc/renderer/src/lib/agent-status-terminal-title.ts.Let me explore the repository structure first.
Assistant
Let me explore the source structure and find the relevant file.
Assistant
Let me find the specific file mentioned in the issue.
Assistant
The file doesn't exist yet. Let me look at the renderer source structure and any related files
Assistant
Let me look at the renderer lib directory and search for related files.
Assistant
The file doesn't exist yet. Let me search for related code patterns to understand the context
Assistant
Let me explore the key files to understand the data structures
Assistant
Now let me look at the agent-hook-listener.ts and search for synthetic-title related
Assistant
Let me search for existing synthetic-title related code and understand the patterns.
Assistant
Let me look at the synthetic-title related files
Assistant
Let me look at the synthetic title integration in the main process index
Assistant
Let me look at the relevant sections of main/index.ts around the synthetic title handling
Assistant
Let me look at the SyntheticTitleProfile type and how drives are set up
Assistant
Let me see the SyntheticTitleProfile type and the profiles defined.
Assistant
Let me find where driveSyntheticTitleFromHook is called to see how profiles are used.
Assistant
Let me see the context around line 630 of main/index.ts
Assistant
Now let me look at the agent-status store slice to understand where titles are stored.
Assistant
Let me see more of the setAgentStatus function to find where terminalTitle is stored.
Assistant
Let me search for where setAgentStatus is called to understand the terminalTitle flow.
Assistant
Let me look at how setAgentStatus is called in pty-connection.ts to understand the title flow.
Assistant
Let me see the other setAgentStatus calls in pty-connection.ts.
Assistant
Let me look at useIpcEvents.ts to see the IPC path.
Assistant
Let me see how
titleis obtained in the IPC path.Assistant
Let me search for the title variable in this function context.
Assistant
Let me look at resolvePaneKey and resolveHookPayloadAgentType.
Assistant
Let me see these functions.
Assistant
Now let me understand the full picture. Let me look at the existing test for agent-status.ts and see if there are any related tests.
Assistant
Let me now look at the complete SYNTHETIC_TITLE_PROFILES and understand the spinner frame pattern.
Assistant
Let me look at the referenced agent-status.test.ts for pinned classifications.
Assistant
Let me look at agent-status.ts for the title detection logic.
Assistant
Let me look at the shared agent-detection module to understand title
Assistant
Now I have a thorough understanding of the architecture. Let me create the
resolveAgentStatusTerminalTitlefunction. The issue is clear:- Cursor's native OSC title is always "Cursor Agent" — it never changes even after the agent completes
- The synthetic-title system in main injects spinner frames and state labels into the PTY stream
- But the renderer-side
terminalTitlestored in the agent-status snapshot may still carry the working/spinner title or the bare "Cursor Agent" when the agent is done - This function resolves the discrepancy
Let me create the file:
Assistant
Now let me integrate the resolver in the IPC path. Let me check the import section of useIpcEvents.ts.
Assistant
Let me look at the area around the setAgentStatus call
Assistant
Now let me check the imports at the end of the import block to add mine
Assistant
Let me see the full import section and find where to add the import
Assistant
Let me see more of the import section around agent-status imports.
Assistant
Now let me add the import and the call. First, let me add
Assistant
Now I'll add the import for the new function:
Assistant
Now let me modify the
setAgentStatuscall to use the resolver. Let me see the exact lines:Assistant
Let me look at the exact context to do the replacement:
Assistant
Now let me modify the setAgentStatus call to use the resolver
Assistant
Let me try with the explicit --file option:
Assistant
Let me try opening the file at the right line:
Assistant
Now let me edit line 2295:
Assistant
Now let me verify the created file and test with TypeScript compilation:
Assistant
Let me verify the import was added correctly and check compilation:
Assistant
Let me try to run TypeScript to check for compilation errors:
Assistant
Good, TypeScript compiled without errors. Let me now check if there are any tests I should run related to this change:
Assistant
Let me run the existing tests to make sure my changes don't break anything:
Assistant
That test failure appears to be a pre-existing environment issue. Let me check if the test infrastructure works with a simpler test:
Assistant
Let me check what test files are available:
Assistant
Let me check for renderer-side tests related to agent-status:
Assistant
Let me check if there are tests related to useIpcEvents agent status:
Assistant
Let me verify the path alias configuration to ensure the import works:
Assistant
Good, the path alias is correct. Now let me verify the existing code around my changes to make sure everything is consistent:
Assistant
Let me reconsider my logic. Looking at the done handler, I think there's a minor redundancy. The
isSyntheticSpinnerTitle(currentTitle)check is covered bystripSpinnerPrefix+stripped === labels.workingLabel. Let me refine:Assistant
The edit went wrong and created duplicate code. Let me look at the full file and fix it
Assistant
The file is corrupted. Let me rewrite it completely:
Assistant
Let me verify the file is correct now
Assistant
Good, the file is correct now. Let me verify compilation and the useIpcEvents.ts change:
Assistant
Compilation passes. Let me verify both files are correct:
Assistant
Let me check the call site:
Assistant
Let me also check if the OSC path in pty-connection.ts needs the resolver. Looking at the earlier code:
The issue description says: "The IPC status integration must call this resolver before storing the title." This specifically points to the IPC path. The OSC path in pty-connection.ts handles the OSC 9999 fallback, which is a different mechanism.
But let me also think about whether the other
setAgentStatuscalls (like inseedCommandCodeOutputWorkingStatus,applyInitialAgentStatus) need this too. Those are for command-code and initial status, which are not synthetic-title agents.Let me verify my changes with git diff:Let me now verify all changes with git diff:
Assistant
Let me also check the git status to see the new file:
Assistant
The changes look correct. Let me now do a final review of the code:
Assistant
Let me run TypeScript compilation one more time to be sure:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.