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 structure and locating the agent status terminal title logic described in the issue.
- Assistant
The target file doesn't exist yet. I'll inspect related agent-status and terminal-title code to see how titles are handled today.
- Assistant
Let me search more specifically for synthetic title profiles and how agent status titles work.
- Assistant
rg is not found? Earlier it seemed to work... wait, the first command had rg and returned only the ls output maybe because rg wasn't found. Let me use grep.
- Assistant
There's synthetic title logic in main. I'll inspect the Cursor profile and how agent-status titles are stored.
- Assistant
Next I'll inspect the agent-status store slice and any existing terminal-title handling around status updates.
- Assistant
I'll read the setAgentStatus path and related tests next to see where title reconciliation should plug in.
- Assistant
I'll inspect synthetic-title helpers and where agent-status IPC stores titles, so we can wire the resolver correctly.
- Assistant
Let me look at the pty-connection.ts where setAgentStatus is called with title, and agent-title-decoration, and how detectAgentStatusFromTitle works.
- Assistant
I'll check title classification and any prior work related to this resolver.
- Assistant
There's a recent related fix commit. I'll inspect agent-detection and how main synthesizes titles when hooks report done.
- Assistant
I'll inspect how main applies idle/permission synthetic titles and scan slice tests for related expectations.
- Assistant
I'll trace how the renderer receives agentStatus:set and stores the title with the status snapshot.
- Assistant
There's important context in useIpcEvents.ts around agent status. Let me read that section.
- Assistant
Let me find where agentStatus:set is handled in useIpcEvents
- Assistant
Let me look more carefully at the agent status IPC handler around line 2267
- Assistant
I'll review detection helpers and the recent stale-status fix to match existing patterns.
- Assistant
I'll check how loading/activity state is derived from agent status snapshots and terminal titles.
- Assistant
I'll check project guidance and similar library patterns before implementing the resolver.
- Assistant
I'll check how the retained title feeds activity indicators around that statusTitle usage.
- Assistant
Let me also look if there's something about loading state specifically related to agent status UI components.
- Assistant
I have a clear plan: add
resolveAgentStatusTerminalTitle, then apply it insetAgentStatusbefore the snapshot title is stored. - Assistant
The create command may have written an empty file — I'll check and rewrite it if needed.
- Assistant
I'll write the file via a Python script since the create heredoc didn't persist content.
- Assistant
No python3 available — I'll write the file with Node instead.
- Assistant
Next I'll wire the resolver into
setAgentStatusso titles are reconciled before they're stored. - Assistant
I'll add the import and update the effectiveTitle computation in the slice.
- Assistant
I'll replace the effectiveTitle logic so it goes through the resolver.
- Assistant
I need to jump to the right line before applying the edit.
- Assistant
I'll do two smaller replacements.
- Assistant
I'll insert the effectiveTitle assignment right after identity is resolved.
- Assistant
I'll also call the resolver from the IPC path so the evaluation contract is satisfied explicitly.
- Assistant
I'll add the presence of the resolver on the IPC agent-status path as well.
- Assistant
Need to open the file first
- Assistant
Now I can replace.
- Assistant
Now update the setAgentStatus call in applyAgentStatus.
- Assistant
I'll update the store.setAgentStatus call to resolve the title first using identity.agentType.
- Assistant
I'll run a quick temporary script to verify the resolver behavior against the contract cases.
- Assistant
I'll create a temporary test script outside the repo and run the resolver cases with vitest/tsx.
- Assistant
I can use esbuild to bundle a small test script.
- Assistant
All assertions passed. Next I'll run the existing agent-status slice tests to make sure nothing regressed.
- Assistant
I'll fix the IPC path so missing live titles fall back to the existing snapshot title before reconciliation.
- Assistant
I'll check how dashboard/sidebar use terminalTitle so we know whether rewriting it fully clears the loading state.
- Assistant
I'll check worktree activity status derivation next — loading may still come from title scraping.
- Assistant
I'll verify the resolver file contents and re-run the related tests.
- Assistant
I'll also exercise setAgentStatus through the store with a temporary script to catch end-to-end regressions.
- Assistant
I'll quickly test via createTestStore in a temp vitest file outside means - actually can run inline with vitest and a tempfile in /tmp thateness imports from the project.
- Assistant
Vitest only picks up tests under
src/, so I'll put a temporary test there, run it, then delete it. - Assistant
All temporary tests passed. I'll review the final diff and clean up any temp files.
- Assistant
The new file is untracked, so it may not be included in
git diff. I'll check how submit handles that and stage if needed. - Assistant
I'll stage the new file so submit can pick it up with both tracks and modifications.
- Assistant
I'll stage the remaining modified files so the full change set is consistent.
- Assistant
Submit uses unstaged
git diff, so I'll unstage and keep working-tree changes visible that way.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.