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
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /orca, current file: none) bash-$
Assistant
Let me start by exploring the repository structure to understand the codebase.
Assistant
Now let me look at the existing terminal title handling, the agent-status store, and the IPC integration that stores titles.
Assistant
Let me look at the IPC integration that stores titles - useIpcEvents.ts and the agent-status-osc.ts.
Assistant
Now let me look at the part around line 2290 where the title is passed to setAgentStatus. I want to see what
titleis and where the resolver should be applied. The contract says: "The IPC status integration must call this resolver before storing the title."Let me look at the area where
titlecomes from and where store.setAgentStatus is called with the title. The title comes fromresolvePaneKey. Let me look at that whole context more carefully.Let me check the section around line 2280-2300.
Assistant
Now I understand the integration. The
titleis passed tosetAgentStatus. The contract says I should create a functionresolveAgentStatusTerminalTitleatsrc/renderer/src/lib/agent-status-terminal-title.ts. Let me explore the cursor module and existing title handling.Assistant
There's already a synthetic title system. Let me look at the main/index.ts around line 620-760 and the SYNTHETIC_TITLE_PROFILES.
Assistant
Now let me look at the
driveSyntheticTitleFromHookfunction.Assistant
Let me look at the agent-status-osc.ts and the title tracker to understand the title detection and how the synthetic title interacts with the stored
terminalTitle.Assistant
Now let me understand the title detection system - the
detectAgentStatusFromTitlereferenced in the comments. Let me look at how the terminal title is used to derive agent status, and the keyword/spinner classification. This is the basis for the resolver's "spinner/working titles", "bare Cursor Agent title", "permission titles", "descriptive completed titles".Let me look for detectAgentStatusFromTitle.
Assistant
I now have a good understanding. Let me look at existing tests related to agent-status terminal title handling to understand the expected behavior and avoid breaking things.
Assistant
Let me find all call sites of
setAgentStatusin the renderer to apply the resolver consistently.Assistant
The contract says: "The IPC status integration must call this resolver before storing the title." The IPC status integration is in useIpcEvents.ts (the
applyAgentStatusfunction). Let me look at the full applyAgentStatus to see wheretitleis computed and where the snapshot path stores title.Assistant
Let me check how main stores the
terminalTitlein the durable cache/snapshot, since the snapshot replay path also calls setAgentStatus.Assistant
Let me look at the existing
src/renderer/src/lib/agent-status.tsto follow conventions.Assistant
Now let me look at the existing test conventions in agent-status.test.ts.
Assistant
Now I have a good understanding. Let me check the test runner and look at how
resolvePaneKeyreturns the title (to confirmtitleis the right "current title" to pass).Assistant
Now I understand the full flow. Let me check existing tests that verify
terminalTitleafter agent-status updates, to make sure my change won't break them.Assistant
Let me check if there's a test file for useIpcEvents and look at the imports at the top of useIpcEvents.ts.
Assistant
I now have a complete understanding. Let me create the resolver file.
Assistant
Now let me wire the resolver into the IPC integration. First, add the import.
Assistant
Now let me update the call site to apply the resolver before storing the title.
Assistant
The search text didn't match because the file has slightly different whitespace/indentation. Let me use the edit command with the exact line content. Let me use the edit command on the line range.
Assistant
Both the live path and the snapshot replay path go through
applyAgentStatus, which now applies the resolver. Now let me verify the resolver works. Let me create a temporary test file to validate behavior (I'll remove it before submitting).Assistant
All 16 tests pass. Let me remove the temporary test file.
Assistant
Now let me verify type-checking passes. Let me check the available scripts and run a typecheck.
Assistant
Typecheck passes. Let me run the existing related tests to make sure I didn't break anything.
Assistant
The failures appear to be a pre-existing module resolution issue (
@/lib/ipc-error). Let me verify these tests fail without my changes by stashing.Assistant
These test failures are pre-existing (they fail without my changes too) due to a test-environment module resolution issue with
@/lib/ipc-error, unrelated to my change. Let me confirm theagent-status.test.tsfailure is the same pre-existing issue.Assistant
Confirmed — these are pre-existing environment issues (the
@/lib/ipc-erroralias isn't resolved in this vitest environment), unrelated to my change. The authoritativetsgotypecheck passed. Let me verify theuseIpcEvents.test.tssituation is also pre-existing.Assistant
Confirmed pre-existing. Let me run the linter on the new file and the modified file to ensure code quality.
Assistant
Lint passes. Let me check the formatter (the repo uses oxfmt) on the new file.
Assistant
Everything passes. Let me review the final diff.
Assistant
My changes are complete. Let me do a final review of the new resolver file.
Assistant
Let me run the store slice tests for agent-status to make sure nothing breaks (these don't have the
@/lib/ipc-errorchain).Assistant
The
@/alias isn't being resolved by vitest in this environment — a pre-existing configuration issue. Let me check the vitest config to confirm.Assistant
The vitest config is at
config/vitest.config.ts, not the root. Let me run tests using the proper config (check package.json test script).Assistant
All 176 tests pass with the proper config. My earlier failures were just from not passing
--config. Let me run a broader set of affected tests.Assistant
All 105 tests pass (the stderr is expected test log output). Let me run the remaining agent-status IPC-related tests.
Assistant
All tests pass. My implementation is complete and verified.
Let me provide a final summary of the checklist:
Checklist review:
-
✅ Reproduced the error: I traced the root cause — the main process sends the
agentStatus:setIPC event before the synthesized "Cursor ready" OSC title frame (driveSyntheticTitleFromHookruns after the IPC send insrc/main/index.ts). So when the renderer'sapplyAgentStatusreads the pane title, it's still the stale working/spinner/bare-native "Cursor Agent" title. That stale title gets stored in the agent-status snapshot, leaving the UI in a loading state. I verified the resolver behavior with a temporary test (now removed) covering all contract cases. -
✅ Confirmed the fix resolves the error: The temporary test confirmed
resolveAgentStatusTerminalTitlemaps stale spinner/working/bare-native/permission titles to "Cursor ready" ondone, andwaiting/blockedto "Cursor - action required", while preserving descriptive completed titles and non-profile agents. The IPC integration (applyAgentStatus) now applies the resolver beforestore.setAgentStatus, on both the live and snapshot-replay paths. -
✅ Edge cases handled: undefined
currentTitle(preserved fordone, permission label forwaiting/blocked);workingstate preserved (spinner owns the title); non-profile agents (claude, codex, unknown, undefined agentType) preserved verbatim; descriptive completed titles preserved; case-insensitive/whitespace-trimmed bare-native detection; all four synthetic profiles (cursor, opencode, droid, hermes) reconciled consistently with main'sSYNTHETIC_TITLE_PROFILES. -
✅ Existing tests pass: Ran the affected test suites (
agent-status.test.ts111,useIpcEvents.test.ts35,pty-dispatcher-pi-routing.test.ts6,agent-status.test.tsslice 24,store-cascades62, dashboard/sidebar 105, pty-connection/completion 149) — all pass.tsgotypecheck,oxlint, andoxfmt --checkall clean.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →