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
I'll start by exploring the repository structure to understand the codebase.
Assistant
The file
agent-status-terminal-title.tsdoesn't exist yet. I need to create it. Let me look at the relevant files to understand the structure.Assistant
Now let me look at the store slice that handles agent status and where terminal titles are stored:
Assistant
Let me look at the part of
setAgentStatusthat handlesterminalTitle, and find where IPC status is integrated:Assistant
Now let me find where
setAgentStatusis called with the IPC integration (the call site that passes terminalTitle):Assistant
Let me look at the broader
applyAgentStatusfunction to understand howtitleis computed:Assistant
Let me look at the agent-detection module to understand Cursor title patterns:
Assistant
Now let me find where synthetic titles for Cursor are generated:
Assistant
Now I understand the synthetic title profiles. For cursor:
- workingLabel: 'Cursor Agent' (with spinner prefix like "⠋ Cursor Agent")
- permissionLabel: 'Cursor - action required'
- idleLabel: 'Cursor ready'
Now let me understand the bug. When the Cursor agent finishes (state=done), the terminal title might be stuck on a working/spinner title (like "⠋ Cursor Agent") or the bare native title "Cursor Agent" or a stale permission title "Cursor - action required". The resolver should replace these with "Cursor ready" when state=done.
When state is
waitingorblocked, it should use "Cursor - action required".For agents without a synthetic-title profile, preserve the current title.
The function signature:
coderesolveAgentStatusTerminalTitle(payload: Pick<ParsedAgentStatusPayload, 'agentType' | 'state'>, currentTitle: string | undefined): string | undefinedLet me look at the synthetic-title-spinner module to see the profiles and the type.
Assistant
Now let me understand how the synthetic title spinner is started/stopped based on hook state. Let me look at where synthetic titles are set and where the cursor spinner is controlled based on hook events.
Assistant
Now let me understand the bug. When the Cursor agent finishes (state=done), the terminal title might be stuck on a working/spinner title. Let me look at where the synthetic title profiles are defined and whether there's a shared module:
Assistant
Let me look at the agent-detection helpers used for classification, available in the renderer:
Assistant
Let me look at
resolvePaneKeyto understandtitleandidentityTitle:Assistant
Let me check the pty-connection.ts call sites for setAgentStatus:
Assistant
These are mostly for command-code agent, not cursor. The main IPC integration path for cursor is in
useIpcEvents.ts'sapplyAgentStatus. The contract specifically says "The IPC status integration must call this resolver before storing the title." So I'll apply the resolver inapplyAgentStatus.Let me also check the pty-connection.ts call at line 1148-1154.
Assistant
Let me look at existing test files to understand testing conventions, and check if there's a test for agent-status-terminal-title:
Assistant
Now I have a clear understanding. Let me create the shared synthetic title profiles module first:
Assistant
Now let me update
main/index.tsto import from the shared module instead of defining locally:Assistant
Now let me replace the local type and const with imports from the shared module:
Assistant
Now let me add the import and remove the local definitions:
Assistant
Now remove the local type and const definitions:
Assistant
No python3. Let me use the edit command instead. Let me open the file:
Assistant
Now let me create the resolver file:
Assistant
Now let me integrate the resolver into the IPC status integration in
useIpcEvents.ts:Assistant
Now let me update the
setAgentStatuscall inapplyAgentStatusto resolve the title:Assistant
The replace command operates on the currently open file. Let me open the useIpcEvents.ts file:
Assistant
Now let me verify the changes typecheck. Let me run the typecheck/lint:
Assistant
Typechecks pass. Now let me write a temporary test to verify the resolver behavior, then run existing related tests:
Assistant
This is a temporary test to verify my changes (I'll remove it before submitting). Let me run it:
Assistant
All 15 tests pass. Now let me run the existing related tests to make sure I didn't break anything:
Assistant
Let me run the store slice agent-status tests and the IPC drop tests:
Assistant
Let me check if there are tests that exercise the OSC path's setAgentStatus with synthetic-title agents:
Assistant
This test uses codex, which has no synthetic profile, so the resolver would preserve the title. Let me check what
terminalTitleit asserts — 'codex'. Let me look at the setup to understand what title is passed. Actually, the test checksdeps.dispatchNotificationwas called withterminalTitle: 'codex'. The title comes from the store. Let me check whether applying the resolver in the OSC path would break this. The agentType is 'codex' (no synthetic profile), so resolver returns the title unchanged. So no breakage.But the contract specifically says "The IPC status integration must call this resolver before storing the title." The OSC 9999 path is also a form of IPC (it's delivered via the pty transport, parsed in renderer). However, the primary "IPC status integration" referenced is
applyAgentStatusin useIpcEvents.ts, which handles the mainagentStatus:setIPC channel. The contract describes "The IPC status integration must call this resolver before storing the title."Assistant
Those are "cursor" referring to the terminal caret, not the Cursor agent. Now let me apply the resolver in the OSC 9999 fallback path too, for consistency, since it also stores agent-status snapshot titles:
Assistant
Let me check the other call sites that pass titles to ensure consistency:
Assistant
This passes
undefinedas the title. Let me check the launch-agent-background-session and launch-agent-in-new-tab call sites:Assistant
The background/automation paths pass
undefinedtitles, so the stale-title bug doesn't apply there. The contract names the IPC integration specifically, and the snapshot replay path goes throughapplyAgentStatustoo. Let me run the pty-connection tests to make sure my OSC path change didn't break anything:Assistant
All pty-connection tests pass. Now let me run the broader test suites that might be affected by the agent-status changes:
Assistant
Now let me run the full unit test suite to ensure nothing is broken:
Assistant
There are 52 failed test files. Let me check if these are pre-existing failures or caused by my change. Let me look at the failures more carefully:
Assistant
These failures look environmental (native runtime, fs, timeouts, favicon image loading) and unrelated to my changes. Let me verify by stashing my changes and running a couple of these failing tests on the original code:
Assistant
Confirmed: the history-manager failures are pre-existing on the unmodified codebase (3 failed even with my changes stashed), and BrowserTab passed in isolation. The 52 failed files in the full run are environmental — they require the native runtime setup (
ensure-native-runtime) which I didn't run beforevitest. My changes introduce no new failures.Now, per the instructions, I must not add new test files to the repository. Let me remove my temporary test file:
Assistant
Now let me run the renderer lib and store tests (which don't require native runtime) to confirm everything passes with my changes:
Assistant
All renderer tests pass. Let me also run the shared tests and the main synthetic-title-spinner test (since I refactored the profiles into a shared module):
Assistant
Now let me run the linter to make sure my new files conform to the project's style:
Assistant
Lint passes. Now let me run the typecheck once more across all configs to be safe:
Assistant
No type errors. Let me also verify the CLI typecheck config covers the shared module:
Assistant
All typechecks pass. Let me review the complete diff of my changes:
Assistant
The diff looks clean. Let me do a final review of the new resolver file:
Assistant
Let me run the project's formatter on my new/modified files to ensure they conform to style:
Assistant
Let me check what oxfmt changed in index.ts:
Assistant
The formatter just wrapped the import. Now let me re-run the typecheck and the key tests one final time to confirm everything still passes after formatting:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.